SphericalPoint

A metatype for representing a 3D point using Spherical coordinates.

Attributes

Name Type Description
r double Euclidian distance to the origin, in m.
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.SphericalPoint(r, theta, phi, frame)

pumas.SphericalPoint{r, theta, phi, frame}

pumas.SphericalPoint(coordinates)

Note

For the two first forms the r, 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
r number Euclidian distance to the origin, in m.
theta number θ angle counter-clockwise w.r.t. the z-axis, in radians.
phi number φ 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 point coordinates e.g. as returned by State.position.

See also

CartesianPoint, CartesianVector, GeodeticPoint, HorizontalVector, SphericalVector.

SphericalPoint.clone

Get a copy (clone) of the coordinates instance.


Synopsis

SphericalPoint:clone()

Arguments

None, except self.

Returns

Type Description
SphericalPoint Copy of the point coordinates.

See also

get, set, transform.

SphericalPoint.get

Get the point 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

SphericalPoint: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

clone, set, transform.

SphericalPoint.set

Set the point coordinates from another Coordinates instance.


Synopsis

SphericalPoint:set(coordinates)

Arguments

Name Type Description
coordinates Coordinates Input coordinates.

Note

The input coordinates must be a point instance (CartesianPoint, GeodeticPoint, SphericalPoint) or a C array, e.g. as returned by State.position.

Returns

Type Description
SphericalPoint Reference to the updated coordinates.

See also

clone, get, transform.

SphericalPoint.transform

Transform the point coordinates to a new reference frame. The transform occurs in-place.


Synopsis

SphericalPoint: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
SphericalPoint Reference to the updated coordinates.

See also

clone, get, set.