Transforms

包含用于将位置转换为各种参考帧的函数。

Methods

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

计算旋转矩阵以从地球固定坐标系轴 (ITRF) 转换点或矢量 至国际天体参考系 (GCRF/ICRF) 惯性系轴 在给定时间。 如果数据需要 执行尚未加载的转换。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。 如果该参数为 未指定,则创建并返回一个新实例。
Returns:
旋转矩阵,如果执行 尚未加载转换。
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

用于计算旋转矩阵以转换国际天体的点或向量的默认函数 参考系 (GCRF/ICRF) 惯性系轴到中心体,通常是地球,固定系轴位于给定的 用于照明和从惯性参考系转换的时间。如果 执行转换所需的数据尚未加载。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。如果该参数为 未指定,则创建并返回一个新实例。
Returns:
旋转矩阵,如果执行 尚未加载转换。
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

计算旋转矩阵以转换 International Celestial 中的点或向量 参考系 (GCRF/ICRF) 惯性系轴到地球固定系轴 (ITRF) 在给定时间。 如果数据需要 执行尚未加载的转换。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。 如果该参数为 未指定,则创建并返回一个新实例。
Returns:
旋转矩阵,如果执行 尚未加载转换。
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

计算旋转矩阵以转换 International Celestial 中的点或向量 参考系 (GCRF/ICRF) 惯性系轴到月球固定系轴 在给定时间。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。 如果该参数为 未指定,则创建并返回一个新实例。
Returns:
旋转矩阵。
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

计算旋转矩阵以从 Moon-Fixed 帧轴转换点或向量 至国际天体参考系 (GCRF/ICRF) 惯性系轴 在给定时间。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。 如果该参数为 未指定,则创建并返回一个新实例。
Returns:
旋转矩阵。
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

计算旋转矩阵,以将点或向量从真赤道平均分 (TEME) 轴变换到 给定时间的伪固定轴。 此方法将 UT1 时间标准视为等效于 UTC。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者新的 Matrix3 实例(如果未提供)。
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

从具有东-北向上轴的参考系计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。 局部轴定义为:
  • x 轴指向本地东方向。
  • y 轴指向本地北方向。
  • z 轴指向通过该位置的椭球体表面法线的方向。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
result Matrix4 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
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

根据特定参考系中的变换计算航向-俯仰-滚动角度。航向是从当地向东开始的旋转 正角度向东增加的方向。Pitch 是从本地东西向北平面的旋转。正俯仰角 位于平面上方。负俯仰角位于平面下方。Roll 是围绕本地东轴应用的第一个旋转。
Name Type Default Description
transform Matrix4 转换
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4 变换 从参考系到提供的椭球体的固定参考系的矩阵
result HeadingPitchRoll optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者新的 HeadingPitchRoll 实例(如果未提供)。

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

从参考系计算四元数,轴从航向-俯仰-滚动角度计算 以提供的原点为中心。航向是从当地向东开始的旋转 正角度向东增加的方向。Pitch 是从本地东西向北平面的旋转。正俯仰角 位于平面上方。负俯仰角位于平面下方。Roll 是围绕本地东轴应用的第一个旋转。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
headingPitchRoll HeadingPitchRoll 航向、俯仰和滚动。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4 变换 从参考系到提供的椭球体的固定参考系的矩阵
result Quaternion optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者新的 Quaternion 实例(如果未提供)。
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

从参考系计算 4x4 变换矩阵,其轴根据航向-俯仰-滚动角度计算 以提供的原点为中心,以提供的椭球体的固定参考系为中心。航向是从当地向东开始的旋转 正角度向东增加的方向。Pitch 是从本地东西向北平面的旋转。正俯仰角 位于平面上方。负俯仰角位于平面下方。Roll 是围绕本地东轴应用的第一个旋转。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
headingPitchRoll HeadingPitchRoll 航向、俯仰和滚动。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4 变换 从参考系到提供的椭球体的固定参考系的矩阵
result Matrix4 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
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

生成一个函数,该函数从参考帧计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。
Name Type Description
firstAxis string 局部参考帧的第一个轴的名称。必须为 'east', 'north', 'up', 'west', 'south' 或 'down'.
secondAxis string 本地参考帧的第二个轴的名称。必须为 'east', 'north', 'up', 'west', 'south' 或 'down'.
Returns:
将计算 来自参考系的 4x4 变换矩阵,其中第一轴和第二轴符合参数,

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

从具有东北向下轴的参考帧计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。 局部轴定义为:
  • x 轴指向本地北向。
  • y 轴指向本地东方向。
  • z 轴指向通过该位置的椭球体表面法线的相反方向。
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 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
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

从具有北向上东轴的参考系计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。 局部轴定义为:
  • x 轴指向本地北向。
  • y 轴指向通过该位置的椭球体表面法线的方向。
  • z 轴指向本地东方向。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
result Matrix4 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
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

从西北向上轴的参考系计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。 局部轴定义为:
  • x 轴指向本地北向。
  • y 轴指向本地西方向。
  • z 轴指向通过该位置的椭球体表面法线的方向。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
result Matrix4 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
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 要在其上存储结果的对象。
Returns:
修改后的结果参数 or a new Cartesian2 instance if none was provided.

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

预加载在 ICRF 轴和固定轴之间转换所需的数据,包括 方向,在给定的间隔内。 此函数返回一个 Promise,当解析时, 表示预加载已完成。
Name Type Description
timeInterval TimeInterval 预加载的间隔。
Returns:
一个 Promise,当解析时,表示预加载已完成 对固定轴和 ICRF 轴之间的变换的评估将 不再在间隔内的某个时间内返回 undefined。
Example:
const interval = new Cesium.TimeInterval(...);
await Cesium.Transforms.preloadIcrfFixed(interval));
// the data is now loaded
See:

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

将位置和速度转换为旋转矩阵。
Name Type Default Description
position Cartesian3 要转换的位置。
velocity Cartesian3 要变换的速度向量。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
result Matrix3 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者新的 Matrix3 实例(如果未提供)。

Type Definitions

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

从参考系计算 4x4 变换矩阵 以提供的原点为中心,以提供的椭球体的固定参考系为中心。
Name Type Default Description
origin Cartesian3 本地参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.default optional 在变换中使用其固定框架的椭球体。
result Matrix4 optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者一个新的 Matrix4 实例(如果未提供)。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.