Transforms

Transforms

Transforms

Contains functions for transforming positions to various reference frames.

Methods

<static> computeTemeToPseudoFixedMatrix

Computes a rotation matrix to transform a point or vector from True Equator Mean Equinox (TEME) axes to the pseudo-fixed axes at a given time. This method treats the UT1 time standard as equivalent to UTC.

Parameters:
Name Type Argument Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : date is required.
Returns:
Matrix3 The modified result parameter or a new Matrix3 instance if none was provided.
Example
//Set the view to in the inertial frame.
function updateAndRender() {
    var now = new JulianDate();
    scene.initializeFrame();
    scene.setSunPosition(computeSunPosition(now));
    scene.getCamera().transform = Matrix4.fromRotationTranslation(Transforms.computeTemeToPseudoFixedMatrix(now), Cartesian3.ZERO);
    scene.render();
    requestAnimationFrame(updateAndRender);
}
updateAndRender();

<static> eastNorthUpToFixedFrame

Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes centered at the provided origin to the provided ellipsoid's fixed reference frame. The local axes are defined as:

  • The x axis points in the local east direction.
  • The y axis points in the local north direction.
  • The z axis points in the direction of the ellipsoid surface normal which passes through the position.

Parameters:
Name Type Argument Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 <optional>
The object onto which to store the result.
Throws:
DeveloperError : origin is required.
Returns:
Matrix4 The modified result parameter or a new Matrix4 instance if none was provided.
Example
// Get the transform from local east-north-up at cartographic (0.0, 0.0) to Earth's fixed frame.
var ellipsoid = Ellipsoid.WGS84;
var center = ellipsoid.cartographicToCartesian(Cartographic.ZERO);
var transform = Transforms.eastNorthUpToFixedFrame(center);

<static> northEastDownToFixedFrame

Computes a 4x4 transformation matrix from a reference frame with an north-east-down axes centered at the provided origin to the provided ellipsoid's fixed reference frame. The local axes are defined as:

  • The x axis points in the local north direction.
  • The y axis points in the local east direction.
  • The z axis points in the opposite direction of the ellipsoid surface normal which passes through the position.

Parameters:
Name Type Argument Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 <optional>
The object onto which to store the result.
Throws:
DeveloperError : origin is required.
Returns:
Matrix4 The modified result parameter or a new Matrix4 instance if none was provided.
Example
// Get the transform from local north-east-down at cartographic (0.0, 0.0) to Earth's fixed frame.
var ellipsoid = Ellipsoid.WGS84;
var center = ellipsoid.cartographicToCartesian(Cartographic.ZERO);
var transform = Transforms.northEastDownToFixedFrame(center);

<static> pointToWindowCoordinates

Transform a point from model coordinates to window coordinates.

Parameters:
Name Type Argument Description
modelViewProjectionMatrix Matrix4 The 4x4 model-view-projection matrix.
viewportTransformation Matrix4 The 4x4 viewport transformation.
point Cartesian3 The point to transform.
result Cartesian2 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian2 The modified result parameter or a new Cartesian2 instance if none was provided.
See: