Transforms

包含将位置转换为各种参考坐标系的函数。

Methods

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

计算旋转矩阵以从地球固定框架轴(ITRF)转换点或向量 国际天文参考系(GCRF/ICRF)惯性系轴 在特定的时间。如果需要返回未定义的数据 do转换尚未加载。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要存储结果的对象。如果此参数为 如果未指定,则会创建并返回一个新实例。
Returns:
或未定义的旋转矩阵,如果数据需要做 转换尚未加载。
Example:
// Transform a point from the ICRF axes to the Fixed axes.
var now = Cesium.JulianDate.now();
var pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var fixedToIcrf = Cesium.Transforms.computeIcrfToFixedMatrix(now);
var pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
    pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
}
See:

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

计算一个旋转矩阵来转换来自国际天体的点或向量 参考坐标系(GCRF/ICRF)惯性系轴至地球固定坐标系轴(ITRF) 在特定的时间。如果需要返回未定义的数据 do转换尚未加载。
Name Type Description
date JulianDate 计算旋转矩阵的时间。
result Matrix3 optional 要存储结果的对象。如果此参数为 如果未指定,则会创建并返回一个新实例。
Returns:
或未定义的旋转矩阵,如果数据需要做 转换尚未加载。
Example:
scene.postUpdate.addEventListener(function(scene, time) {
  // View in ICRF.
  var icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);
  if (Cesium.defined(icrfToFixed)) {
    var offset = Cesium.Cartesian3.clone(camera.position);
    var transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);
    camera.lookAtTransform(transform, offset);
  }
});
See:

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) {
   var now = Cesium.JulianDate.now();
   var offset = Cesium.Matrix4.multiplyByPoint(camera.transform, camera.position, new Cesium.Cartesian3());
   var transform = Cesium.Matrix4.fromRotationTranslation(Cesium.Transforms.computeTemeToPseudoFixedMatrix(now));
   var 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变换矩阵 以所提供的原点为中心到所提供的椭球体的固定参考系。 局部轴定义为:
  • 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 局部参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.WGS84 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.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);

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

从特定参考系中的变换计算航向俯仰滚转角。航向是指从当地北方开始的旋转 正角向东增加的方向。螺距是从当地的东北平面旋转而来的。正俯仰角 在飞机上方。负俯仰角低于平面。滚转是绕局部东轴应用的第一个旋转。
Name Type Default Description
transform Matrix4 变换
ellipsoid Ellipsoid Ellipsoid.WGS84 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.WGS84 optional 在变换中使用固定框架的椭球体。
fixedFrameTransform Transforms.LocalFrameToFixedFrame Transforms.eastNorthUpToFixedFrame optional 4x4转换 从参考坐标系到所提供椭球体固定参考系的矩阵
result Quaternion optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的四元数实例(如果未提供)。
Example:
// Get the quaternion from local heading-pitch-roll at cartographic (0.0, 0.0) to Earth's fixed frame.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var heading = -Cesium.Math.PI_OVER_TWO;
var pitch = Cesium.Math.PI_OVER_FOUR;
var roll = 0.0;
var hpr = new HeadingPitchRoll(heading, pitch, roll);
var 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.WGS84 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.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var heading = -Cesium.Math.PI_OVER_TWO;
var pitch = Cesium.Math.PI_OVER_FOUR;
var roll = 0.0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, hpr);

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

生成从参考帧计算4x4变换矩阵的函数 以所提供的原点为中心到所提供的椭球体的固定参考系。
Name Type Description
firstAxis String 局部参照系的第一个轴的名称。必须是 “东”、“北”、“上”、“西”、“南”或“下”。
secondAxis String 局部参照系的第二个轴的名称。必须是 “东”、“北”、“上”、“西”、“南”或“下”。
Returns:
将计算 参考坐标系的4x4变换矩阵,第一轴和第二轴符合参数,

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

从具有东北方向下轴的参考坐标系计算4x4变换矩阵 以所提供的原点为中心到所提供的椭球体的固定参考系。 局部轴定义为:
  • 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 局部参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.WGS84 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.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var transform = Cesium.Transforms.northEastDownToFixedFrame(center);

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

从具有东北向东轴的参考坐标系计算4x4变换矩阵 以所提供的原点为中心到所提供的椭球体的固定参考系。 局部轴定义为:
  • 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 局部参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.WGS84 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.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var transform = Cesium.Transforms.northUpEastToFixedFrame(center);

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

从具有西北向上轴的参考坐标系计算4x4变换矩阵 以所提供的原点为中心到所提供的椭球体的固定参考系。 局部轴定义为:
  • 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 局部参考系的中心点。
ellipsoid Ellipsoid Ellipsoid.WGS84 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.
var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var 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:
var interval = new Cesium.TimeInterval(...);
when(Cesium.Transforms.preloadIcrfFixed(interval), function() {
    // 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.WGS84 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.WGS84 optional 在变换中使用固定框架的椭球体。
result Matrix4 optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的Matrix4实例(如果未提供)。