SphericalVector
A metatype for representing a 3D vector using spherical coordinates.
Attributes
Name | Type | Description |
---|---|---|
norm | double |
Euclidian (ℓ2) norm. |
theta | double |
θ angle counter-clockwise w.r.t. the z-axis, in radians. |
phi | double |
φ angle counter-clockwise w.r.t. the x-axis, in radians. |
frame | UnitaryTransformation or nil |
Reference frame of the coordinates if different from the simulation one or nil . |
Constructor
Synopsis
pumas.SphericalVector(x, y, z, frame)
pumas.SphericalVector{x, y, z, frame}
pumas.SphericalVector(coordinates)
Note
For the two first forms the norm, theta, phi 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 |
---|---|---|
norm | number |
Euclidian (ℓ2) norm. |
theta | double |
θ angle counter-clockwise w.r.t. the z-axis, in radians. |
phi | double |
φ angle counter-clockwise w.r.t. the x-axis, in radians. |
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, CartesianVector, GeodeticPoint, HorizontalVector, SphericalPoint.
SphericalVector.clone
Get a copy (clone) of the coordinates instance.
Synopsis
SphericalVector:clone()
Arguments
None, except self.
Returns
Type | Description |
---|---|
SphericalVector | Copy of the vector coordinates. |
See also
SphericalVector.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
SphericalVector: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
SphericalVector.set
Set the vector coordinates from another Coordinates instance.
Synopsis
SphericalVector: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 |
---|---|
SphericalVector | Reference to the updated coordinates. |
See also
SphericalVector.transform
Transform the vector coordinates to a new reference frame. The transform occurs in-place.
Synopsis
SphericalVector: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 |
---|---|
SphericalVector | Reference to the updated coordinates. |