CartesianVector
A metatype for representing a 3D vector using Cartesian coordinates.
Attributes
Name | Type | Description |
---|---|---|
x | double |
First (x) coordinate. |
y | double |
Second (y) coordinate. |
z | double |
Third (z) coordinate. |
frame | UnitaryTransformation or nil |
Reference frame of the coordinates if different from the simulation one or nil . |
Constructor
Synopsis
pumas.CartesianVector(x, y, z, frame)
pumas.CartesianVector{x=, y=, z=, frame=}
pumas.CartesianVector(coordinates)
Note
For the two first forms the x, y, z and frame arguments are
optional, but for the sake of simplicity only the full forms are reported.
When an argument is missing the corresponding attribute is set to zero or
nil
.
Arguments
Name | Type | Description |
---|---|---|
x | number |
First (x) coordinate. |
y | number |
Second (y) coordinate. |
z | number |
Third (z) coordinate. |
frame | UnitaryTransformation or nil |
UnitaryTransformation representing the reference frame e.g. as returned by LocalFrame or nil if the coordinates are expressed in the simulation frame. |
coordinates | Coordinates | Other vector coordinates e.g. as returned by State.direction. |
See also
CartesianPoint, GeodeticPoint, HorizontalVector, SphericalPoint, SphericalVector.
CartesianVector.clone
Get a copy (clone) of the coordinates instance.
Synopsis
CartesianVector:clone()
Arguments
None, except self.
Returns
Type | Description |
---|---|
CartesianVector | Copy of the vector coordinates. |
See also
CartesianVector.get
Get the vector coordinates in the simulation frame as a double [3]
array of
x, y and z Cartesian coordinates. The coordinates are prealably
transformed to the simulation frame if needed, e.g. if the frame attribute is
not nil
.
Synopsis
CartesianVector:get()
Arguments
None, except self.
Returns
Type | Description |
---|---|
double [3] |
C array containing the x, y and z coordinates in the simulation frame. |
See also
CartesianVector.set
Set the vector coordinates from another Coordinates instance.
Synopsis
CartesianVector:set(coordinates)
Arguments
Name | Type | Description |
---|---|---|
coordinates | Coordinates | Input coordinates. |
Note
The input coordinates must be a vector instance (CartesianVector, HorizontalVector, SphericalVector) or a C array, e.g. as returned by State.direction.
Returns
Type | Description |
---|---|
CartesianVector | Reference to the updated coordinates. |
See also
CartesianVector.transform
Transform the vector coordinates to a new reference frame. The transform occurs in-place.
Synopsis
CartesianVector:transform(frame)
Arguments
Name | Type | Description |
---|---|---|
frame | UnitaryTransformation or nil |
UnitaryTransformation representing the new frame or nil in order to transform to the simulation frame. |
Returns
Type | Description |
---|---|
CartesianVector | Reference to the updated coordinates. |