Skip to content

Point Classes

The Point and OrientedPoint classes represent points in 3D space, implemented using the three.js library.

  • Point is the base class representing a point with a position in 3D space.

  • OrientedPoint extends Point and adds orientation information using quaternions. It can also have a camera attached for scene rendering and perspective control.

Points can be retrieved from the scene via the point function (see below). These classes are seldomly interacted with directly except through the latter function. When we do retrieve them, it is mostly to use the getter methods. For example, when we want the basis vector for the reference frame of an OrientedPoint.

Very sparingly one interacts on user scripts with this classes except to retrieve some information from them , such as position or orientation, or to use of the methods on them.

Class: Point

The Point class provides basic functionality for positioning a point in 3D space using a THREE.Group object.

Properties

PropertyTypeDescription
geometryTHREE.GroupThe underlying Three.js object that stores the point's position and transformations.
positionVector3Getter: Returns the current position as a tuple [x, y, z].
Setter: Sets the point's position in 3D space.

Class: OrientedPoint (Subclass of Point)

The OrientedPoint class extends Point and introduces orientation in 3D space using quaternions. It also supports adding a camera to the point.

Constructor

typescript
constructor(geometry: THREE.Group, camera?: THREE.PerspectiveCamera)
ParameterTypeDescription
geometryTHREE.GroupA THREE.Group object representing the point in 3D space.
cameraTHREE.PerspectiveCamera(Optional) A camera to be attached to the point.

If a camera is provided, it is added to the point's THREE.Group and named _camera for identification.

Properties

PropertyTypeDescription
frame{ x, y, z: Vector3 }Returns the local coordinate frame vectors (x, y, z) of the point. Each vector is represented as a tuple [x, y, z].
cameraTHREE.Camera | nullGetter: Returns the first attached camera named "Camera" in the point's group or null if no such camera exists.

Methods

addCamera

Adds a THREE.PerspectiveCamera with the specified field of view (FOV) to the point's group.

ParametersTypeReturnsDescription
fov: numbernumbervoidFull FOV of the camera in degrees
camera_orientation[number, number, number, number]voidOrientation of the camera with respect to the body frame. Defaults to the identity quaternion with the camera assumed to point in the +z direction.

Throws an error if a camera with the name "Camera" already exists. |

point

Returns a point in the scene state.

Arguments

ParameterTypeDescription
pointstringThe name of the point.

Returns

A Point or OrientedPoint (see above).

Example

javascript
// Calculate the angle between the x-axis of the `sat` point
// and the nadir direction
angle("nadir", point("sat").frame.x);