一组 4 维坐标,用于表示 3 维空间中的旋转。 A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
x |
number |
0.0
|
可选 optional X 分量。 The X component. |
y |
number |
0.0
|
可选 optional Y 分量。 The Y component. |
z |
number |
0.0
|
可选 optional Z 分量。 The Z component. |
w |
number |
0.0
|
可选 optional W 分量。 The W component. |
另见: See:
成员 Members
static constant Cesium.Quaternion.IDENTITY : Quaternion
一个不可变的四元数实例,初始化为 (0.0, 0.0, 0.0, 1.0)。 An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 1.0).
用于将对象以其可插值形式存储到数组中的元素数量。 The number of elements used to store the object into an array in its interpolatable form.
用于将对象打包到数组中的元素数量。 The number of elements used to pack the object into an array.
static constant Cesium.Quaternion.ZERO : Quaternion
一个不可变的四元数实例,初始化为 (0.0, 0.0, 0.0, 0.0)。 An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).
W 分量。 The W component.
-
默认值: Default Value:
0.0
X 分量。 The X component.
-
默认值: Default Value:
0.0
Y 分量。 The Y component.
-
默认值: Default Value:
0.0
Z 分量。 The Z component.
-
默认值: Default Value:
0.0
方法 Methods
static Cesium.Quaternion.add(left, right, result) → Quaternion
计算两个四元数的分量和。 Computes the componentwise sum of two quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Quaternion | 第一个四元数。 The first quaternion. |
right |
Quaternion | 第二个四元数。 The second quaternion. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.clone(quaternion, result) → Quaternion
Duplicates a Quaternion instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要复制的四元数。 The quaternion to duplicate. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 (如果四元数未定义,则返回未定义) The modified result parameter or a new Quaternion instance if one was not provided. (Returns undefined if quaternion is undefined)
计算提供的四元数的旋转角度。 Computes the angle of rotation of the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要使用的四元数。 The quaternion to use. |
返回: Returns:
旋转角度。 The angle of rotation.
static Cesium.Quaternion.computeAxis(quaternion, result) → Cartesian3
计算所提供的四元数的旋转轴。 Computes the axis of rotation of the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要使用的四元数。 The quaternion to use. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.computeInnerQuadrangle(q0, q1, q2, result) → Quaternion
计算内四边形点。 Computes an inner quadrangle point.
这将计算确保小队曲线为 C 的四元数 This will compute quaternions that ensure a squad curve is C1.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
q0 |
Quaternion | 第一个四元数。 The first quaternion. |
q1 |
Quaternion | 第二个四元数。 The second quaternion. |
q2 |
Quaternion | 第三个四元数。 The third quaternion. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
- Quaternion#squad
另见: See:
static Cesium.Quaternion.conjugate(quaternion, result) → Quaternion
计算所提供的四元数的共轭。 Computes the conjugate of the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要共轭的四元数。 The quaternion to conjugate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.convertPackedArrayForInterpolation(packedArray, startingIndex, lastIndex, result)
将打包数组转换为适合插值的形式。 Converts a packed array into a form suitable for interpolation.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
packedArray |
Array.<number> | 打包的数组。 The packed array. | |
startingIndex |
number |
0
|
可选 optional 要转换的第一个元素的索引。 The index of the first element to be converted. |
lastIndex |
number |
packedArray.length
|
可选 optional 要转换的最后一个元素的索引。 The index of the last element to be converted. |
result |
Array.<number> | 可选 optional 用于存储结果的对象。 The object into which to store the result. |
static Cesium.Quaternion.divideByScalar(quaternion, scalar, result) → Quaternion
将提供的四元数按分量除以提供的标量。 Divides the provided quaternion componentwise by the provided scalar.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要除的四元数。 The quaternion to be divided. |
scalar |
number | 要除以的标量。 The scalar to divide by. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
计算两个四元数的点(标量)积。 Computes the dot (scalar) product of two quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Quaternion | 第一个四元数。 The first quaternion. |
right |
Quaternion | 第二个四元数。 The second quaternion. |
返回: Returns:
点积。 The dot product.
按组件比较提供的四元数并返回 Compares the provided quaternions componentwise and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Quaternion | 可选 optional 第一个四元数。 The first quaternion. |
right |
Quaternion | 可选 optional 第二个四元数。 The second quaternion. |
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.
按组件比较提供的四元数并返回 Compares the provided quaternions componentwise and returns
true 如果它们在提供的 epsilon 范围内, if they are within the provided epsilon,
false otherwise.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
left |
Quaternion | 可选 optional 第一个四元数。 The first quaternion. | |
right |
Quaternion | 可选 optional 第二个四元数。 The second quaternion. | |
epsilon |
number |
0
|
可选 optional 用于相等性测试的 epsilon。 The epsilon to use for equality testing. |
返回: Returns:
true 如果 left 和 right 在提供的 epsilon 范围内, if left and right are within the provided epsilon, false otherwise.
static Cesium.Quaternion.exp(cartesian, result) → Quaternion
指数四元数函数。 The exponential quaternion function.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
cartesian |
Cartesian3 | 笛卡尔。 The cartesian. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.fastSlerp(start, end, t, result) → Quaternion
使用提供的四元数计算 t 处的球面线性插值或外推。这个实现速度比 Computes the spherical linear interpolation or extrapolation at t using the provided quaternions. This implementation is faster than
Quaternion#slerp,但最多只能精确到 10 , but is only accurate up to 10-6.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
start |
Quaternion | 对应于 0.0 处 t 的值。 The value corresponding to t at 0.0. |
end |
Quaternion | 对应于 1.0 时 t 的值。 The value corresponding to t at 1.0. |
t |
number | 沿 t 进行插值的点。 The point along t at which to interpolate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
- Quaternion#slerp
另见: See:
static Cesium.Quaternion.fastSquad(q0, q1, s0, s1, t, result) → Quaternion
计算四元数之间的球形四边形插值。一个比以下更快的实现 Computes the spherical quadrangle interpolation between quaternions. An implementation that is faster than
Quaternion#squad,但不太准确。 , but less accurate.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
q0 |
Quaternion | 第一个四元数。 The first quaternion. |
q1 |
Quaternion | 第二个四元数。 The second quaternion. |
s0 |
Quaternion | 第一个内四边形。 The first inner quadrangle. |
s1 |
Quaternion | 第二个内四边形。 The second inner quadrangle. |
t |
number | [0,1] 中的时间用于插值。 The time in [0,1] used to interpolate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.
- Quaternion#squad
另见: See:
static Cesium.Quaternion.fromAxisAngle(axis, angle, result) → Quaternion
计算表示绕轴旋转的四元数。 Computes a quaternion representing a rotation around an axis.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
axis |
Cartesian3 | 旋转轴。 The axis of rotation. |
angle |
number | 绕轴旋转的角度(以弧度为单位)。 The angle in radians to rotate around the axis. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if one was not provided.
static Cesium.Quaternion.fromHeadingPitchRoll(headingPitchRoll, result) → Quaternion
根据给定的航向、俯仰角和横滚角计算旋转。航向是绕负 z 轴的旋转。俯仰角是绕负 y 轴的旋转。滚动是绕正 x 轴的旋转。 Computes a rotation from the given heading, pitch and roll angles. Heading is the rotation about the negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about the positive x axis.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
headingPitchRoll |
HeadingPitchRoll | 旋转表示为航向、俯仰和滚转。 The rotation expressed as a heading, pitch and roll. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if none was provided.
static Cesium.Quaternion.fromRotationMatrix(matrix, result) → Quaternion
从提供的 Matrix3 实例计算四元数。 Computes a Quaternion from the provided Matrix3 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix3 | 旋转矩阵。 The rotation matrix. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if one was not provided.
另见: See:
static Cesium.Quaternion.inverse(quaternion, result) → Quaternion
计算提供的四元数的倒数。 Computes the inverse of the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要标准化的四元数。 The quaternion to normalize. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.lerp(start, end, t, result) → Quaternion
使用提供的四元数计算 t 处的线性插值或外推。 Computes the linear interpolation or extrapolation at t using the provided quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
start |
Quaternion | 对应于 0.0 处 t 的值。 The value corresponding to t at 0.0. |
end |
Quaternion | 对应于 1.0 时 t 的值。 The value corresponding to t at 1.0. |
t |
number | 沿 t 进行插值的点。 The point along t at which to interpolate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.log(quaternion, result) → Cartesian3
对数四元数函数。 The logarithmic quaternion function.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 单位四元数。 The unit quaternion. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
计算提供的四元数的大小。 Computes magnitude for the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要共轭的四元数。 The quaternion to conjugate. |
返回: Returns:
幅度。 The magnitude.
计算提供的四元数的幅度平方。 Computes magnitude squared for the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要共轭的四元数。 The quaternion to conjugate. |
返回: Returns:
幅度的平方。 The magnitude squared.
static Cesium.Quaternion.multiply(left, right, result) → Quaternion
计算两个四元数的乘积。 Computes the product of two quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Quaternion | 第一个四元数。 The first quaternion. |
right |
Quaternion | 第二个四元数。 The second quaternion. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.multiplyByScalar(quaternion, scalar, result) → Quaternion
将提供的四元数按分量乘以提供的标量。 Multiplies the provided quaternion componentwise by the provided scalar.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要缩放的四元数。 The quaternion to be scaled. |
scalar |
number | 要相乘的标量。 The scalar to multiply with. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.negate(quaternion, result) → Quaternion
对提供的四元数求反。 Negates the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要求反的四元数。 The quaternion to be negated. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.normalize(quaternion, result) → Quaternion
计算所提供的四元数的标准化形式。 Computes the normalized form of the provided quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
quaternion |
Quaternion | 要标准化的四元数。 The quaternion to normalize. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
将提供的实例存储到提供的数组中。 Stores the provided instance into the provided array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
value |
Quaternion | 包装的价值。 The value to pack. | |
array |
Array.<number> | 要打包到的数组。 The array to pack into. | |
startingIndex |
number |
0
|
可选 optional 开始打包元素的数组索引。 The index into the array at which to start packing the elements. |
返回: Returns:
被打包成的数组 The array that was packed into
static Cesium.Quaternion.slerp(start, end, t, result) → Quaternion
使用提供的四元数计算 t 处的球面线性插值或外推。 Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
start |
Quaternion | 对应于 0.0 处 t 的值。 The value corresponding to t at 0.0. |
end |
Quaternion | 对应于 1.0 时 t 的值。 The value corresponding to t at 1.0. |
t |
number | 沿 t 进行插值的点。 The point along t at which to interpolate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
- Quaternion#fastSlerp
另见: See:
static Cesium.Quaternion.squad(q0, q1, s0, s1, t, result) → Quaternion
计算四元数之间的球形四边形插值。 Computes the spherical quadrangle interpolation between quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
q0 |
Quaternion | 第一个四元数。 The first quaternion. |
q1 |
Quaternion | 第二个四元数。 The second quaternion. |
s0 |
Quaternion | 第一个内四边形。 The first inner quadrangle. |
s1 |
Quaternion | 第二个内四边形。 The second inner quadrangle. |
t |
number | [0,1] 中的时间用于插值。 The time in [0,1] used to interpolate. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
- Quaternion#computeInnerQuadrangle
示例: Example:
// 1. compute the squad interpolation between two quaternions on a curve
const s0 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[i - 1], quaternions[i], quaternions[i + 1], new Cesium.Quaternion());
const s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[i], quaternions[i + 1], quaternions[i + 2], new Cesium.Quaternion());
const q = Cesium.Quaternion.squad(quaternions[i], quaternions[i + 1], s0, s1, t, new Cesium.Quaternion());
// 2. compute the squad interpolation as above but where the first quaternion is a end point.
const s1 = Cesium.Quaternion.computeInnerQuadrangle(quaternions[0], quaternions[1], quaternions[2], new Cesium.Quaternion());
const q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t, new Cesium.Quaternion());
另见: See:
static Cesium.Quaternion.subtract(left, right, result) → Quaternion
计算两个四元数的分量差。 Computes the componentwise difference of two quaternions.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Quaternion | 第一个四元数。 The first quaternion. |
right |
Quaternion | 第二个四元数。 The second quaternion. |
result |
Quaternion | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Quaternion.unpack(array, startingIndex, result) → Quaternion
从打包数组中检索实例。 Retrieves an instance from a packed array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组。 The packed array. | |
startingIndex |
number |
0
|
可选 optional 要解包的元素的起始索引。 The starting index of the element to be unpacked. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object into which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if one was not provided.
static Cesium.Quaternion.unpackInterpolationResult(array, sourceArray, firstIndex, lastIndex, result) → Quaternion
从转换后的打包数组中检索实例 Retrieves an instance from a packed array converted with
convertPackedArrayForInterpolation.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
array |
Array.<number> | 之前打包用于插值的数组。 The array previously packed for interpolation. | |
sourceArray |
Array.<number> | 原始打包数组。 The original packed array. | |
firstIndex |
number |
0
|
可选 optional 用于转换数组的firstIndex。 The firstIndex used to convert the array. |
lastIndex |
number |
packedArray.length
|
可选 optional 用于转换数组的lastIndex。 The lastIndex used to convert the array. |
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object into which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if one was not provided.
clone(result) → Quaternion
复制此四元数实例。 Duplicates this Quaternion instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
result |
Quaternion | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的四元数实例(如果未提供)。 The modified result parameter or a new Quaternion instance if one was not provided.
将此与提供的四元数分量进行比较并返回 Compares this and the provided quaternion componentwise and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
right |
Quaternion | 可选 optional 右侧四元数。 The right hand side quaternion. |
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.
将此与提供的四元数分量进行比较并返回 Compares this and the provided quaternion componentwise and returns
true 如果它们在提供的 epsilon 范围内, if they are within the provided epsilon,
false otherwise.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
right |
Quaternion | 可选 optional 右侧四元数。 The right hand side quaternion. | |
epsilon |
number |
0
|
可选 optional 用于相等性测试的 epsilon。 The epsilon to use for equality testing. |
返回: Returns:
true 如果 left 和 right 在提供的 epsilon 范围内, if left and right are within the provided epsilon, false otherwise.
返回表示该四元数的字符串,格式为 (x, y, z, w)。 Returns a string representing this quaternion in the format (x, y, z, w).
返回: Returns:
表示该四元数的字符串。 A string representing this Quaternion.
