Skip to content

Geometry Commands

addPoint

Adds a new point to the scene. If a quaternion is provided, the point will have a basis frame attached to it with the orientation implied by the quaternion.

ParameterTypeDescription
namestringName of the point
coordinatesarrayCartesian coordinates [x, y, z]
quaternionarray(Optional) Initial rotation as quaternion [x, y, z, w]

Example

js
// Add a point named `point`` at NULL Island with the same orientation of the
// global ECEF frame.
addPoint("point1", [6371, 0, 0], [0, 0, 0, 1]);

createLine

Creates a line between two points or coordinates.

ParameterTypeDescription
namestringName of the line
startArgarray|stringStarting point or coordinates
endArgarray|stringEnding point or coordinates

listPoints

Lists all points currently present in the scene. Takes no arguments.

Example

js
listPoints();
// Output:
// - sat
// - KS

angle

Calculates the angle between two vectors.

ParameterTypeDescription
vec1Argarray|stringFirst vector. See valid input options here
vec2Argarray|stringSecond vector. See valid input options here

Returns the angle in degrees.

xyz2geo

Converts Cartesian coordinates to geographic coordinates (latitude, longitude, and altitude).

ParameterTypeDescription
xyzarrayCartesian coordinates [x, y, z]

Notes: Assumes a spherical Earth.

Example:

js
// Should return lat=0, long=0, altitude=0. Just over NULL Island!
xyz2geo([6371, 0, 0]);

geo2xyz

Converts geographic coordinates to Cartesian coordinates.

ParameterTypeDescription
geoarrayGeographic coordinates [latitude, longitude, altitude]

Notes: Assumes a spherical Earth.

Example:

js
// Opposite of the previous example
geo2xyz([0, 0, 0]);

sph2xyz

Converts spherical coordinates to Cartesian coordinates.

ParameterTypeDescription
spharraySpherical coordinates [latitude, longitude, radius]

Notes: Assumes a spherical Earth.

xyz2sph

Converts Cartesian coordinates to spherical coordinates.

ParameterTypeDescription
xyzarrayCartesian coordinates [x, y, z]

Notes: Assumes a spherical Earth.