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:
修改后的 result 参数,如果未提供则为新的 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 变换矩阵,从以所提供的原点为中心、采用东-北-上(east-north-up)轴的参考坐标系 转换到所提供的椭球体的固连参考坐标系。 局部坐标轴定义如下:
  • x 轴指向局部的东方向。
  • y 轴指向局部的北方向。
  • z 轴指向穿过该位置的椭球体表面法线方向。
Name Type Default Description
origin Cartesian3 局部参考坐标系的原点。
ellipsoid Ellipsoid Ellipsoid.default optional 转换中所使用的椭球体(以其固连坐标系)。
result Matrix4 optional 存储结果的物体。
Returns:
修改后的 result 参数,如果未提供则为新的 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:
修改后的 result 参数,如果未提供则为新的 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:
修改后的 result 参数,如果未提供则为新的 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:
修改后的 result 参数,如果未提供则为新的 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 变换矩阵,从以所提供的原点为中心、采用北-东-下(north-east-down)轴的参考坐标系 转换到所提供的椭球体的固连参考坐标系。 局部坐标轴定义如下:
  • x 轴指向局部的北方向。
  • y 轴指向局部的东方向。
  • z 轴指向穿过该位置的椭球体表面法线的相反方向。
Name Type Default Description
origin Cartesian3 局部参考坐标系的原点。
ellipsoid Ellipsoid Ellipsoid.default optional 转换中所使用的椭球体(以其固连坐标系)。
result Matrix4 optional 存储结果的物体。
Returns:
修改后的 result 参数,如果未提供则为新的 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 变换矩阵,从以所提供的原点为中心、采用北-上-东(north-up-east)轴的参考坐标系 转换到所提供的椭球体的固连参考坐标系。 局部坐标轴定义如下:
  • x 轴指向局部的北方向。
  • y 轴指向穿过该位置的椭球体表面法线方向。
  • z 轴指向局部的东方向。
Name Type Default Description
origin Cartesian3 局部参考坐标系的原点。
ellipsoid Ellipsoid Ellipsoid.default optional 转换中所使用的椭球体(以其固连坐标系)。
result Matrix4 optional 存储结果的物体。
Returns:
修改后的 result 参数,如果未提供则为新的 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 变换矩阵,从以所提供的原点为中心、采用北-西-上(north-west-up)轴的参考坐标系 转换到所提供的椭球体的固连参考坐标系。 局部坐标轴定义如下:
  • x 轴指向局部的北方向。
  • y 轴指向局部的西方向。
  • z 轴指向穿过该位置的椭球体表面法线方向。
Name Type Default Description
origin Cartesian3 局部参考坐标系的原点。
ellipsoid Ellipsoid Ellipsoid.default optional 转换中所使用的椭球体(以其固连坐标系)。
result Matrix4 optional 存储结果的物体。
Returns:
修改后的 result 参数,如果未提供则为新的 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:
修改后的 result 参数,如果未提供则为新的 Cartesian2 实例。

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

预加载在给定时间间隔内、在 ICRF 与 Fixed 轴之间(任一方向)进行转换所需的数据。 此函数返回一个 promise,当该 promise 被 resolve 时, 表示预加载已完成。
Name Type Description
timeInterval TimeInterval 要预加载的时间间隔。
Returns:
一个 promise,当被 resolve 时,表示预加载已完成, 并且在间隔内任意时刻对 fixed 与 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:
修改后的 result 参数,如果未提供则为新的 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:
修改后的 result 参数,如果未提供则为新的 Matrix4 实例。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。