Transforms

Contains functions for transforming positions to various reference frames.

Members

static Cesium.Transforms.earthOrientationParameters : EarthOrientationParameters

The source of Earth Orientation Parameters (EOP) data, used for computing the transformation between the Fixed and ICRF axes. By default, zero values are used for all EOP values, yielding a reasonable but not completely accurate representation of the ICRF axes.
See:

Methods

static Cesium.Transforms.computeFixedToIcrfMatrix(date, result)Matrix3|undefined

Computes a rotation matrix to transform a point or vector from the Earth-Fixed frame axes (ITRF) to the International Celestial Reference Frame (GCRF/ICRF) inertial frame axes at a given time. This function may return undefined if the data necessary to do the transformation is not yet loaded.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result. If this parameter is not specified, a new instance is created and returned.
Returns:
The rotation matrix, or undefined if the data necessary to do the transformation is not yet loaded.
Example:
// Transform a point from the Fixed axes to the ICRF axes.
const now = Cesium.JulianDate.now();
const pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const fixedToIcrf = Cesium.Transforms.computeFixedToIcrfMatrix(now);
let pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
    pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
}
See:

static Cesium.Transforms.computeIcrfToCentralBodyFixedMatrix(date, result)Matrix3|undefined

The default function to compute a rotation matrix to transform a point or vector from the International Celestial Reference Frame (GCRF/ICRF) inertial frame axes to the central body, typically Earth, fixed frame axis at a given time for use in lighting and transformation from inertial reference frames. This function may return undefined if the data necessary to do the transformation is not yet loaded.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result. If this parameter is not specified, a new instance is created and returned.
Returns:
The rotation matrix, or undefined if the data necessary to do the transformation is not yet loaded.
Example:
// Set the default ICRF to fixed transformation to that of the Moon.
Cesium.Transforms.computeIcrfToCentralBodyFixedMatrix = Cesium.Transforms.computeIcrfToMoonFixedMatrix;
See:

static Cesium.Transforms.computeIcrfToFixedMatrix(date, result)Matrix3|undefined

Computes a rotation matrix to transform a point or vector from the International Celestial Reference Frame (GCRF/ICRF) inertial frame axes to the Earth-Fixed frame axes (ITRF) at a given time. This function may return undefined if the data necessary to do the transformation is not yet loaded.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result. If this parameter is not specified, a new instance is created and returned.
Returns:
The rotation matrix, or undefined if the data necessary to do the transformation is not yet loaded.
Example:
scene.postUpdate.addEventListener(function(scene, time) {
  // View in ICRF.
  const icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);
  if (Cesium.defined(icrfToFixed)) {
    const offset = Cesium.Cartesian3.clone(camera.position);
    const transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);
    camera.lookAtTransform(transform, offset);
  }
});
See:

static Cesium.Transforms.computeIcrfToMoonFixedMatrix(date, result)Matrix3

Computes a rotation matrix to transform a point or vector from the International Celestial Reference Frame (GCRF/ICRF) inertial frame axes to the Moon-Fixed frame axes at a given time.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result. If this parameter is not specified, a new instance is created and returned.
Returns:
The rotation matrix.
Example:
// Set the default ICRF to fixed transformation to that of the Moon.
Cesium.Transforms.computeIcrfToCentralBodyFixedMatrix = Cesium.Transforms.computeIcrfToMoonFixedMatrix;

static Cesium.Transforms.computeMoonFixedToIcrfMatrix(date, result)Matrix3

Computes a rotation matrix to transform a point or vector from the Moon-Fixed frame axes to the International Celestial Reference Frame (GCRF/ICRF) inertial frame axes at a given time.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result. If this parameter is not specified, a new instance is created and returned.
Returns:
The rotation matrix.
Example:
// Transform a point from the Fixed axes to the ICRF axes.
const now = Cesium.JulianDate.now();
const pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const fixedToIcrf = Cesium.Transforms.computeMoonFixedToIcrfMatrix(now);
let pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
    pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
}

static Cesium.Transforms.computeTemeToPseudoFixedMatrix(date, result)Matrix3

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.
Name Type Description
date JulianDate The time at which to compute the rotation matrix.
result Matrix3 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix3 instance if none was provided.
Example:
//Set the view to the inertial frame.
scene.postUpdate.addEventListener(function(scene, time) {
   const now = Cesium.JulianDate.now();
   const offset = Cesium.Matrix4.multiplyByPoint(camera.transform, camera.position, new Cesium.Cartesian3());
   const transform = Cesium.Matrix4.fromRotationTranslation(Cesium.Transforms.computeTemeToPseudoFixedMatrix(now));
   const inverseTransform = Cesium.Matrix4.inverseTransformation(transform, new Cesium.Matrix4());
   Cesium.Matrix4.multiplyByPoint(inverseTransform, offset, offset);
   camera.lookAtTransform(transform, offset);
});

static Cesium.Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, result)Matrix4

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.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 optional The object onto which to store the result.
Returns:
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.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);

static Cesium.Transforms.fixedFrameToHeadingPitchRoll(transform, ellipsoid, fixedFrameTransform, result)HeadingPitchRoll

Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local east direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
Name Type Default Description
transform Matrix4 The transform
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional A 4x4 transformation matrix from a reference frame to the provided ellipsoid's fixed reference frame
result HeadingPitchRoll optional The object onto which to store the result.
Returns:
The modified result parameter or a new HeadingPitchRoll instance if none was provided.

static Cesium.Transforms.getPositionInVVLH(targetEntity, referenceEntity, time, currentTime, referenceFrame)Cartesian3

Computes the position of a target entity in the VVLH (Vehicle Velocity Local Horizontal) reference frame of a reference entity. The VVLH reference frame is an Earth-Centered, Earth-Fixed (ECEF) frame that is aligned with the velocity vector of the reference entity. The origin of the VVLH frame is the position of the reference entity at the provided `time`.
Name Type Default Description
targetEntity Entity The entity for which the position is to be computed in the VVLH frame of the reference entity.
referenceEntity Entity The reference entity used to define the VVLH frame.
time JulianDate The time at which the position of the target entity is to be computed.
currentTime JulianDate The current time used to obtain the position and orientation of the reference entity in its VVLH frame.
referenceFrame ReferenceFrame ReferenceFrame.FIXED optional The reference frame in which to perform the calculations. Optional, defaults to ReferenceFrame.FIXED.
Returns:
The position of the target entity in the VVLH frame of the reference entity.
Throws:
  • DeveloperError : referenceEntity and targetEntity positions must be defined.
Example:
const referenceSatellite = viewer.entities.getById('satellite1');
const targetSatellite = viewer.entities.getById('satellite2');
const computedPosition = Transforms.getPositionInVVLH(referenceSatellite, targetSatellite, Cesium.JulianDate.now(), Cesium.JulianDate.now());
console.log(computedPosition);

static Cesium.Transforms.getTransformToFixedFrame(referenceFrame, time, position)function

Returns the appropriate transform function based on the provided reference frame. This function encapsulates the logic for determining which transform to use for various reference frames.
Name Type Description
referenceFrame ReferenceFrame The reference frame identifier.
time JulianDate optional The time at which to retrieve the position. Optional, but required for certain reference frames.
position Property optional A time-dynamic property which returns the Cartesian3 position. Optional.
Returns:
The transform function to convert from the local frame to the fixed frame.
Example:
const transformToFixedFrame = Transforms.getTransformToFixedFrame(referenceFrame, currentTime, positionProperty);
const fixedFrameMatrix = transformToFixedFrame(origin, ellipsoid, result);

static Cesium.Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)Quaternion

Computes a quaternion from a reference frame with axes computed from the heading-pitch-roll angles centered at the provided origin. Heading is the rotation from the local east direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
headingPitchRoll HeadingPitchRoll The heading, pitch, and roll.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional A 4x4 transformation matrix from a reference frame to the provided ellipsoid's fixed reference frame
result Quaternion optional The object onto which to store the result.
Returns:
The modified result parameter or a new Quaternion instance if none was provided.
Example:
// Get the quaternion from local heading-pitch-roll at cartographic (0.0, 0.0) to Earth's fixed frame.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const heading = -Cesium.Math.PI_OVER_TWO;
const pitch = Cesium.Math.PI_OVER_FOUR;
const roll = 0.0;
const hpr = new HeadingPitchRoll(heading, pitch, roll);
const quaternion = Cesium.Transforms.headingPitchRollQuaternion(center, hpr);

static Cesium.Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)Matrix4

Computes a 4x4 transformation matrix from a reference frame with axes computed from the heading-pitch-roll angles centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local east direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
headingPitchRoll HeadingPitchRoll The heading, pitch, and roll.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional A 4x4 transformation matrix from a reference frame to the provided ellipsoid's fixed reference frame
result Matrix4 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.
Example:
// Get the transform from local heading-pitch-roll at cartographic (0.0, 0.0) to Earth's fixed frame.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const heading = -Cesium.Math.PI_OVER_TWO;
const pitch = Cesium.Math.PI_OVER_FOUR;
const roll = 0.0;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, hpr);

static Cesium.Transforms.localFrameToFixedFrameGenerator(firstAxis, secondAxis)Transforms.LocalFrameToFixedFrame

Generates a function that computes a 4x4 transformation matrix from a reference frame centered at the provided origin to the provided ellipsoid's fixed reference frame.
Name Type Description
firstAxis string name of the first axis of the local reference frame. Must be 'east', 'north', 'up', 'west', 'south' or 'down'.
secondAxis string name of the second axis of the local reference frame. Must be 'east', 'north', 'up', 'west', 'south' or 'down'.
Returns:
The function that will computes a 4x4 transformation matrix from a reference frame, with first axis and second axis compliant with the parameters,

static Cesium.Transforms.localToFixedFrameQuaternion(origin, localQuaternion, ellipsoid, fixedFrameTransform, result)Quaternion

Computes a quaternion representing orientation in the fixed frame of an ellipsoid from a given local orientation.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
localQuaternion Quaternion The orientation of the local frame defined as a quaternion.
ellipsoid Ellipsoid Cesium.Ellipsoid.WGS84 optional The ellipsoid whose fixed frame is used in the transformation.
fixedFrameTransform Transforms.LocalFrameToFixedFrame Cesium.Transforms.eastNorthUpToFixedFrame optional A 4x4 transformation matrix from a reference frame to the provided ellipsoid's fixed reference frame.
result Quaternion optional The object onto which to store the result.
Returns:
- The quaternion representing the orientation in the fixed frame.
Example:
// Get the quaternion representing orientation in Earth's fixed frame from a local quaternion at cartographic (0.0, 0.0).
const origin = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const localQuaternion = Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Z, Cesium.Math.toRadians(45));
const fixedFrameQuaternion = Cesium.Transforms.localToFixedFrameQuaternion(origin, localQuaternion);

static Cesium.Transforms.normalizeHPRQuaternion(sensorOrientation, referenceFrame, time)Quaternion

Name Type Description
sensorOrientation Quaternion The original sensor orientation.
referenceFrame ReferenceFrame The reference frame in which the orientation is defined.
time JulianDate The time at which to calculate the orientation.
Returns:
- The modified orientation quaternion.

static Cesium.Transforms.northEastDownToFixedFrame(origin, ellipsoid, result)Matrix4

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.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 optional The object onto which to store the result.
Returns:
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.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const transform = Cesium.Transforms.northEastDownToFixedFrame(center);

static Cesium.Transforms.northUpEastToFixedFrame(origin, ellipsoid, result)Matrix4

Computes a 4x4 transformation matrix from a reference frame with an north-up-east 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 direction of the ellipsoid surface normal which passes through the position.
  • The z axis points in the local east direction.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.
Example:
// Get the transform from local north-up-east at cartographic (0.0, 0.0) to Earth's fixed frame.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const transform = Cesium.Transforms.northUpEastToFixedFrame(center);

static Cesium.Transforms.northWestUpToFixedFrame(origin, ellipsoid, result)Matrix4

Computes a 4x4 transformation matrix from a reference frame with an north-west-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 north direction.
  • The y axis points in the local west direction.
  • The z axis points in the direction of the ellipsoid surface normal which passes through the position.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.
Example:
// Get the transform from local north-West-Up at cartographic (0.0, 0.0) to Earth's fixed frame.
const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
const transform = Cesium.Transforms.northWestUpToFixedFrame(center);

static Cesium.Transforms.pointToWindowCoordinates(modelViewProjectionMatrix, viewportTransformation, point, result)Cartesian2

Transform a point from model coordinates to window coordinates.
Name Type 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.
Returns:
The modified result parameter or a new Cartesian2 instance if none was provided.

static Cesium.Transforms.preloadIcrfFixed(timeInterval)Promise.<void>

Preloads the data necessary to transform between the ICRF and Fixed axes, in either direction, over a given interval. This function returns a promise that, when resolved, indicates that the preload has completed.
Name Type Description
timeInterval TimeInterval The interval to preload.
Returns:
A promise that, when resolved, indicates that the preload has completed and evaluation of the transformation between the fixed and ICRF axes will no longer return undefined for a time inside the interval.
Example:
const interval = new Cesium.TimeInterval(...);
await Cesium.Transforms.preloadIcrfFixed(interval));
// the data is now loaded
See:

static Cesium.Transforms.reverseHeadingQuaternion(orientation)Quaternion

Reverses the heading of an orientation quaternion.
Name Type Description
orientation Quaternion The original orientation quaternion.
Returns:
The new orientation quaternion with reversed heading.

static Cesium.Transforms.rotationMatrixFromPositionVelocity(position, velocity, ellipsoid, result)Matrix3

Transform a position and velocity to a rotation matrix.
Name Type Default Description
position Cartesian3 The position to transform.
velocity Cartesian3 The velocity vector to transform.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix3 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix3 instance if none was provided.

static Cesium.Transforms.vvlhToFixed(position, time, result, deltaFactor)Matrix4

Create a transform matrix from VVLH (Vehicle Velocity, Local Horizontal) to a fixed frame reference.
Name Type Default Description
position Property A time-dynamic property which returns the Cartesian3 position.
time JulianDate The time at which to retrieve the position.
result Matrix4 optional The matrix to store the result. If not provided, a new Matrix4 instance will be created.
deltaFactor number 0.01 optional The matrix to store the result. If not provided, a new Matrix4 instance will be created.
Returns:
The transformed position in the fixed frame.
Example:
const fixedTransform = Transforms.vvlhToFixed(positionProperty, currentTime);

Type Definitions

Cesium.Transforms.LocalFrameToFixedFrame(origin, ellipsoid, result)Matrix4

Computes a 4x4 transformation matrix from a reference frame centered at the provided origin to the provided ellipsoid's fixed reference frame.
Name Type Default Description
origin Cartesian3 The center point of the local reference frame.
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid whose fixed frame is used in the transformation.
result Matrix4 optional The object onto which to store the result.
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.
Need help? [email protected]