Transforms

包含将位置转换到各种参考框架的函数。

Methods

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

计算一个旋转矩阵,将点或向量从地球固定框架轴(ITRF) 转换为国际天文学参考框架(GCRF/ICRF)惯性框架轴 在给定时间内。如果进行变换所需的数据尚未加载, 此函数可能返回undefined。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 存储结果的对象。如果未指定此参数,则创建并返回一个新实例。
Returns:
旋转矩阵,如果进行变换所需的数据尚未加载,则返回undefined。
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)惯性框架轴转换到中央天体(通常是地球)固定框架轴在给定 时间的变换,通常用于照明和从惯性参考框架的变换。如果进行变换所需的数据尚未加载, 此函数可能返回undefined。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 存储结果的对象。如果未指定此参数,则创建并返回一个新实例。
Returns:
旋转矩阵,如果进行变换所需的数据尚未加载,则返回 undefined。
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

计算一个旋转矩阵,将点或向量从国际天文学参考框架 (GCRF/ICRF)惯性框架轴转换为地球固定框架轴(ITRF) 在给定时间内。 如果进行变换所需的数据尚未加载, 此函数可能返回undefined。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 存储结果的对象。如果未指定此参数,则创建并返回一个新实例。
Returns:
旋转矩阵,如果进行变换所需的数据尚未加载,则返回undefined。
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

计算一个旋转矩阵,将点或向量从国际天文学参考框架 (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

计算一个旋转矩阵,将点或向量从月球固定框架轴转换为 国际天文学参考框架(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

从特定参考框架中的变换计算航向-俯仰-横滚角度。航向是从本地东向的旋转, 其中正角度向东增加。俯仰是从本地东-北平面的旋转。正的俯仰角度 位于平面上方。负的俯仰角度位于平面下方。横滚是绕本地东轴应用的第一个旋转。
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

从以提供的原点为中心的参考框架(使用从航向-俯仰-横滚角计算的轴)计算一个四元数。 航向是从本地东向的旋转,其中正角度向东增加。俯仰是从本地东-北平面的旋转。正的俯仰角度 位于平面上方。负的俯仰角度位于平面下方。横滚是绕本地东轴应用的第一个旋转。
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变换矩阵。 航向是从本地东向的旋转,其中正角度向东增加。俯仰是从本地东-北平面的旋转。正的俯仰角度 位于平面上方。负的俯仰角度位于平面下方。横滚是绕本地东轴应用的第一个旋转。
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 本地参考框架的中心点。
ellipsoid Ellipsoid Ellipsoid.default optional 用于变换的椭球体,其固定框架将用于转换。
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

将点从模型坐标转换为窗口坐标。
Name Type Description
modelViewProjectionMatrix Matrix4 4x4模型-视图-投影矩阵。
viewportTransformation Matrix4 4x4视口变换矩阵。
point Cartesian3 要转换的点。
result Cartesian2 optional 存储结果的对象。
Returns:
修改后的结果参数,如果未提供则返回一个新实例的Cartesian2。

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

预加载在给定区间内,ICRF轴和固定轴之间的转换所需的数据,无论哪个方向。 此函数返回一个承诺,当其解决时,表示预加载已完成。
Name Type Description
timeInterval TimeInterval 要预加载的区间。
Returns:
一个承诺,当其解决时,表示预加载已完成, 且在区间内,固定轴与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实例。
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.