A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
x |
number |
0.0
|
可选 The X component. |
y |
number |
0.0
|
可选 The Y component. |
z |
number |
0.0
|
可选 The Z component. |
w |
number |
0.0
|
可选 The W component. |
成员(属性)
static constant Cesium.Quaternion.IDENTITY : Quaternion
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
An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).
The W component.
-
默认值:
0.0
The X component.
-
默认值:
0.0
The Y component.
-
默认值:
0.0
The Z component.
-
默认值:
0.0
方法
static Cesium.Quaternion.add(left, right, result) → Quaternion
Computes the componentwise sum of two quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
Quaternion | The first quaternion. |
right |
Quaternion | The second quaternion. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.clone(quaternion, result) → Quaternion
Duplicates a Quaternion instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to duplicate. |
result |
Quaternion | 可选 The object onto which to store the result. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to use. |
返回值:
The angle of rotation.
static Cesium.Quaternion.computeAxis(quaternion, result) → Cartesian3
Computes the axis of rotation of the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to use. |
result |
Cartesian3 | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.computeInnerQuadrangle(q0, q1, q2, result) → Quaternion
Computes an inner quadrangle point.
This will compute quaternions that ensure a squad curve is C1.
参数名称 | 类型 | 描述信息 |
---|---|---|
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. |
返回值:
The modified result parameter.
- Quaternion#squad
参考:
static Cesium.Quaternion.conjugate(quaternion, result) → Quaternion
Computes the conjugate of the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to conjugate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.convertPackedArrayForInterpolation(packedArray, startingIndex, lastIndex, result)
Converts a packed array into a form suitable for interpolation.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
packedArray |
Array.<number> | The packed array. | |
startingIndex |
number |
0
|
可选 The index of the first element to be converted. |
lastIndex |
number |
packedArray.length
|
可选 The index of the last element to be converted. |
result |
Array.<number> | 可选 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.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to be divided. |
scalar |
number | The scalar to divide by. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
Computes the dot (scalar) product of two quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
Quaternion | The first quaternion. |
right |
Quaternion | The second quaternion. |
返回值:
The dot product.
Compares the provided quaternions componentwise and returns
true
if they are equal, false
otherwise.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
Quaternion | 可选 The first quaternion. |
right |
Quaternion | 可选 The second quaternion. |
返回值:
true
if left and right are equal, false
otherwise.
Compares the provided quaternions componentwise and returns
true
if they are within the provided epsilon,
false
otherwise.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
left |
Quaternion | 可选 The first quaternion. | |
right |
Quaternion | 可选 The second quaternion. | |
epsilon |
number |
0
|
可选 The epsilon to use for equality testing. |
返回值:
true
if left and right are within the provided epsilon, false
otherwise.
static Cesium.Quaternion.exp(cartesian, result) → Quaternion
The exponential quaternion function.
参数名称 | 类型 | 描述信息 |
---|---|---|
cartesian |
Cartesian3 | The cartesian. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.fastSlerp(start, end, t, result) → Quaternion
Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
This implementation is faster than
Quaternion#slerp
, but is only accurate up to 10-6.
参数名称 | 类型 | 描述信息 |
---|---|---|
start |
Quaternion | The value corresponding to t at 0.0. |
end |
Quaternion | The value corresponding to t at 1.0. |
t |
number | The point along t at which to interpolate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
- Quaternion#slerp
参考:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
q0 |
Quaternion | The first quaternion. |
q1 |
Quaternion | The second quaternion. |
s0 |
Quaternion | The first inner quadrangle. |
s1 |
Quaternion | The second inner quadrangle. |
t |
number | The time in [0,1] used to interpolate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter or a new instance if none was provided.
- Quaternion#squad
参考:
static Cesium.Quaternion.fromAxisAngle(axis, angle, result) → Quaternion
Computes a quaternion representing a rotation around an axis.
参数名称 | 类型 | 描述信息 |
---|---|---|
axis |
Cartesian3 | The axis of rotation. |
angle |
number | The angle in radians to rotate around the axis. |
result |
Quaternion | 可选 The object onto which to store the result. |
返回值:
The modified result parameter or a new Quaternion instance if one was not provided.
static Cesium.Quaternion.fromHeadingPitchRoll(headingPitchRoll, result) → Quaternion
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
headingPitchRoll |
HeadingPitchRoll | The rotation expressed as a heading, pitch and roll. |
result |
Quaternion | 可选 The object onto which to store the result. |
返回值:
The modified result parameter or a new Quaternion instance if none was provided.
static Cesium.Quaternion.fromRotationMatrix(matrix, result) → Quaternion
Computes a Quaternion from the provided Matrix3 instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
matrix |
Matrix3 | The rotation matrix. |
result |
Quaternion | 可选 The object onto which to store the result. |
返回值:
The modified result parameter or a new Quaternion instance if one was not provided.
static Cesium.Quaternion.inverse(quaternion, result) → Quaternion
Computes the inverse of the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to normalize. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.lerp(start, end, t, result) → Quaternion
Computes the linear interpolation or extrapolation at t using the provided quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
start |
Quaternion | The value corresponding to t at 0.0. |
end |
Quaternion | The value corresponding to t at 1.0. |
t |
number | The point along t at which to interpolate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.log(quaternion, result) → Cartesian3
The logarithmic quaternion function.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The unit quaternion. |
result |
Cartesian3 | The object onto which to store the result. |
返回值:
The modified result parameter.
Computes magnitude for the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to conjugate. |
返回值:
The magnitude.
Computes magnitude squared for the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to conjugate. |
返回值:
The magnitude squared.
static Cesium.Quaternion.multiply(left, right, result) → Quaternion
Computes the product of two quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
Quaternion | The first quaternion. |
right |
Quaternion | The second quaternion. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.multiplyByScalar(quaternion, scalar, result) → Quaternion
Multiplies the provided quaternion componentwise by the provided scalar.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to be scaled. |
scalar |
number | The scalar to multiply with. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.negate(quaternion, result) → Quaternion
Negates the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to be negated. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.normalize(quaternion, result) → Quaternion
Computes the normalized form of the provided quaternion.
参数名称 | 类型 | 描述信息 |
---|---|---|
quaternion |
Quaternion | The quaternion to normalize. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
Stores the provided instance into the provided array.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
value |
Quaternion | The value to pack. | |
array |
Array.<number> | The array to pack into. | |
startingIndex |
number |
0
|
可选 The index into the array at which to start packing the elements. |
返回值:
The array that was packed into
static Cesium.Quaternion.slerp(start, end, t, result) → Quaternion
Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
start |
Quaternion | The value corresponding to t at 0.0. |
end |
Quaternion | The value corresponding to t at 1.0. |
t |
number | The point along t at which to interpolate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
- Quaternion#fastSlerp
参考:
static Cesium.Quaternion.squad(q0, q1, s0, s1, t, result) → Quaternion
Computes the spherical quadrangle interpolation between quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
q0 |
Quaternion | The first quaternion. |
q1 |
Quaternion | The second quaternion. |
s0 |
Quaternion | The first inner quadrangle. |
s1 |
Quaternion | The second inner quadrangle. |
t |
number | The time in [0,1] used to interpolate. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
- Quaternion#computeInnerQuadrangle
使用示例:
// 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());
参考:
static Cesium.Quaternion.subtract(left, right, result) → Quaternion
Computes the componentwise difference of two quaternions.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
Quaternion | The first quaternion. |
right |
Quaternion | The second quaternion. |
result |
Quaternion | The object onto which to store the result. |
返回值:
The modified result parameter.
static Cesium.Quaternion.unpack(array, startingIndex, result) → Quaternion
Retrieves an instance from a packed array.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
array |
Array.<number> | The packed array. | |
startingIndex |
number |
0
|
可选 The starting index of the element to be unpacked. |
result |
Quaternion | 可选 The object into which to store the result. |
返回值:
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
.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
array |
Array.<number> | The array previously packed for interpolation. | |
sourceArray |
Array.<number> | The original packed array. | |
firstIndex |
number |
0
|
可选 The firstIndex used to convert the array. |
lastIndex |
number |
packedArray.length
|
可选 The lastIndex used to convert the array. |
result |
Quaternion | 可选 The object into which to store the result. |
返回值:
The modified result parameter or a new Quaternion instance if one was not provided.
clone(result) → Quaternion
Duplicates this Quaternion instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
result |
Quaternion | 可选 The object onto which to store the result. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
right |
Quaternion | 可选 The right hand side quaternion. |
返回值:
true
if left and right are equal, false
otherwise.
Compares this and the provided quaternion componentwise and returns
true
if they are within the provided epsilon,
false
otherwise.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
right |
Quaternion | 可选 The right hand side quaternion. | |
epsilon |
number |
0
|
可选 The epsilon to use for equality testing. |
返回值:
true
if left and right are within the provided epsilon, false
otherwise.
Returns a string representing this quaternion in the format (x, y, z, w).
返回值:
A string representing this Quaternion.