new Transforms()
Contains functions that convert positions into various reference frames.
Members
-
static eastNorthUpToFixedFrame
-
Calculate a 4x4 transformation matrix from a reference frame centered at the provided origin and oriented along the east-west upward axis to a fixed ellipsoid reference frame provided
- The x-axis points to the local east direction.
- The y-axis points to the local north direction.
- The z-axis points to the normal direction of the ellipsoid at that position.
Example
// Get the transform from local east-north-up at cartographic (0.0, 0.0) to Earth's fixed frame. var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var transform = SuperMap3D.Transforms.eastNorthUpToFixedFrame(center); -
static northEastDownToFixedFrame
-
Calculate a 4x4 transformation matrix from a reference frame with a northeast southwest axis centered at the provided origin to a fixed ellipsoid reference frame provided:
- The x-axis points to the local north direction.
- The y-axis points to the local east direction.
- The z-axis points to the opposite direction of the ellipsoid normal at that position.
Example
// Get the transform from local north-east-down at cartographic (0.0, 0.0) to Earth's fixed frame. var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var transform = SuperMap3D.Transforms.northEastDownToFixedFrame(center); -
static northUpEastToFixedFrame
-
Calculate a 4x4 transformation matrix from a reference frame centered at the provided origin and facing north to east to a fixed ellipsoid reference frame provided:
- The x-axis points to the local north direction.
- The y-axis points to the normal direction of the ellipsoid at that position.
- The z-axis points to the local east direction.
Example
// Get the transform from local north-up-east at cartographic (0.0, 0.0) to Earth's fixed frame. var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var transform = SuperMap3D.Transforms.northUpEastToFixedFrame(center); -
static northWestUpToFixedFrame
-
Calculate a 4x4 transformation matrix from a reference frame centered at the provided origin and with the coordinate axis pointing northwest to a fixed ellipsoid reference frame provided. The definition of local axis is as follows:
- The x-axis points to the local north direction.
- The y-axis points to the local west direction.
- The z-axis points to the normal direction of the ellipsoid at that position.
Example
// Get the transform from local north-West-Up at cartographic (0.0, 0.0) to Earth's fixed frame. var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var transform = SuperMap3D.Transforms.northWestUpToFixedFrame(center);
Methods
-
static computeFixedToIcrfMatrix(date, result){Matrix3}
-
Calculate the rotation matrix to transform a point or vector from the Earth's fixed frame axis (ITRF) to the inertial frame axis of the International Astronomical Reference Frame (GCRF/ICRF) within a given time. If the data required for conversion has not been loaded yet, this function may return undefined results.
Name Type Description dateJulianDate Calculate the time for the rotation matrix.
resultMatrix3 optional The object that stores the results. If this parameter is not specified, a new instance will be created and returned.
Returns:
Type Description Matrix3 The rotation matrix is undefined if the required data for transformation has not been loaded yet. Example
// Transform a point from the ICRF axes to the Fixed axes. var now = SuperMap3D.JulianDate.now(); var pointInFixed = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var fixedToIcrf = SuperMap3D.Transforms.computeIcrfToFixedMatrix(now); var pointInInertial = new SuperMap3D.Cartesian3(); if (SuperMap3D.defined(fixedToIcrf)) { pointInInertial = SuperMap3D.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial); } -
static computeIcrfToFixedMatrix(date, result){Matrix3}
-
Calculate the rotation matrix to convert a point or vector from the inertial frame axis of the International Astronomical Reference Framework (GCRF/ICRF) to the Earth fixed frame axis (ITRF) within a given time. If the data required for conversion has not been loaded yet, this function may return undefined results.
Name Type Description dateJulianDate Calculate the time for the rotation matrix.
resultMatrix3 optional The object that stores the results. If this parameter is not specified, a new instance will be created and returned.
Returns:
Type Description Matrix3 The rotation matrix is undefined if the required data for transformation has not been loaded yet. Example
scene.preRender.addEventListener(function(scene, time) { var icrfToFixed = SuperMap3D.Transforms.computeIcrfToFixedMatrix(time); if (SuperMap3D.defined(icrfToFixed)) { var offset = SuperMap3D.Matrix4.multiplyByPoint(camera.transform, camera.position, new SuperMap3D.Cartesian3()); var transform = SuperMap3D.Matrix4.fromRotationTranslation(icrfToFixed) var inverseTransform = SuperMap3D.Matrix4.inverseTransformation(transform, new SuperMap3D.Matrix4()); SuperMap3D.Matrix4.multiplyByPoint(inverseTransform, offset, offset); camera.lookAtTransform(transform, offset); } }); -
static computeTemeToPseudoFixedMatrix(date, result){Matrix3}
-
Calculate the rotation matrix to transform a point or vector from the true equatorial equipartition (TEME) axis to a pseudo fixed axis at a given time. This method equates the UT1 time standard to UTC.
Name Type Description dateJulianDate Calculate the time for the rotation matrix.
resultMatrix3 optional The object that stores the results.
Returns:
Type Description Matrix3 The modified result parameters, or a new Matrix3 instance (if not provided). Example
scene.preRender.addEventListener(function(scene, time) { var now = SuperMap3D.JulianDate.now(); var offset = SuperMap3D.Matrix4.multiplyByPoint(camera.transform, camera.position, new SuperMap3D.Cartesian3()); var transform = SuperMap3D.Matrix4.fromRotationTranslation(SuperMap3D.Transforms.computeTemeToPseudoFixedMatrix(now)); var inverseTransform = SuperMap3D.Matrix4.inverseTransformation(transform, new SuperMap3D.Matrix4()); SuperMap3D.Matrix4.multiplyByPoint(inverseTransform, offset, offset); camera.lookAtTransform(transform, offset); }); -
static headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransformOrResult, result){Quaternion}
-
Calculate a quaternion from the reference frame based on the axis calculated from heading spacing rolling angle, with the provided origin as the center. Orientation refers to rotating from the local north towards the east, with the positive angle increasing towards the east. The pitch angle is the rotation starting from the local northeast plane. The positive elevation angle is above the plane. The negative pitch angle is below the plane. Rolling is the first rotation around the local east axis.
Name Type Default Description originCartesian3 The center point of the local reference frame.
headingPitchRollHeadingPitchRoll Direction, pitch, and roll.
ellipsoidEllipsoid Ellipsoid.WGS84 optional Ellipsoid, with its fixed frame used for transformation.
fixedFrameTransformOrResultTransforms~LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4 transformation matrix from reference frame to provided ellipsoid fixed reference frame
resultQuaternion optional The object that stores the results.
Returns:
Type Description Quaternion The modified result parameters, or a new Matrix4 instance (if not provided). Example
var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var heading = -SuperMap3D.Math.PI_OVER_TWO; var pitch = SuperMap3D.Math.PI_OVER_FOUR; var roll = 0.0; var hpr = new HeadingPitchRoll(heading, pitch, roll); var quaternion = SuperMap3D.Transforms.headingPitchRollQuaternion(center, hpr); -
static headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransformOrResult, result){Matrix4}
-
Calculate a 4x4 transformation matrix from the reference frame, where the coordinate axes of the reference frame are calculated from the heading pitch roll angles centered on the provided origin, and the transformation matrix is calculated from the ellipsoidal fixed reference frame provided. Orientation refers to rotating from the local north towards the east, with the positive angle increasing towards the east. The pitch angle is the rotation starting from the local northeast plane. The positive elevation angle is above the plane. The negative pitch angle is below the plane. Rolling is the first rotation around the local east axis.
Name Type Default Description originCartesian3 The center point of the local reference frame.
headingPitchRollHeadingPitchRoll Direction, pitch, and roll.
ellipsoidEllipsoid Ellipsoid.WGS84 optional Ellipsoid, with its fixed frame used for transformation.
fixedFrameTransformOrResultTransforms~LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4 transformation matrix from reference frame to provided ellipsoid fixed reference frame
resultMatrix4 optional The object that stores the results.
Returns:
Type Description Matrix4 The modified result parameters, or a new Matrix4 instance (if not provided). Example
var center = SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0); var heading = -SuperMap3D.Math.PI_OVER_TWO; var pitch = SuperMap3D.Math.PI_OVER_FOUR; var roll = 0.0; var hpr = new SuperMap3D.HeadingPitchRoll(heading, pitch, roll); var transform = SuperMap3D.Transforms.headingPitchRollToFixedFrame(center, hpr); -
static localFrameToFixedFrameGenerator(firstAxis, secondAxis){localFrameToFixedFrameGenerator~resultat}
-
Generate a function that calculates a 4x4 transformation matrix from a reference frame centered at a given origin to a fixed reference frame for a given ellipsoid.
Name Type Description firstAxisString The name of the first axis in the local reference frame. It must be "east", "north", "up", "west", "south" or "down".
secondAxisString The name of the second axis of the local reference frame. It must be "east", "north", "up", "west", "south" or "down".
Returns:
Type Description localFrameToFixedFrameGenerator~resultat The function will calculate a 4x4 transformation matrix from the reference frame, with the first and second axes conforming to the parameters. -
static pointToWindowCoordinates(modelViewProjectionMatrix, viewportTransformation, point, result){Cartesian2}
-
Convert a point from model coordinates to window coordinates.
Name Type Description modelViewProjectionMatrixMatrix4 4x4 model - perspective - projection matrix.
viewportTransformationMatrix4 4x4 viewport transformation.
pointCartesian3 Key points of transformation.
resultCartesian2 optional The object that stores the results.
Returns:
Type Description Cartesian2 The modified result parameters, or a new Cartesian2 instance (if not provided). -
static preloadIcrfFixed(timeInterval){Promise.<undefined>}
-
Preloading the data required for any directional conversion between the ICRF axis and the fixed axis within a given time interval. This function returns a Promise, which indicates that the preload has been completed when the Promise is parsed.
Name Type Description timeIntervalTimeInterval The time interval for preloading.
Returns:
Type Description Promise.<undefined> A Promise, after parsing, indicates that the preload has been completed. When evaluating the transformation between the fixed axis and ICRF axis, undefined results will no longer be returned within the time interval. Example
var interval = new SuperMap3D.TimeInterval(...); when(SuperMap3D.Transforms.preloadIcrfFixed(interval), function() { // the data is now loaded });
Type Definitions
-
LocalFrameToFixedFrame(origin, ellipsoid, result){Matrix4}
-
Calculate the 4x4 transformation matrix from the reference frame centered at the given origin to the fixed reference frame of the given ellipsoid.
Name Type Default Description originCartesian3 The center point of the local reference frame.
ellipsoidEllipsoid Ellipsoid.WGS84 optional Ellipsoid, with its fixed frame used for transformation.
resultMatrix4 optional The object that stores the results.
Returns:
Type Description Matrix4 The modified result parameters, or a new Matrix4 instance (if not provided).