new Quaternion(x, y, z, w)
A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
| Name | Type | Default | Description |
|---|---|---|---|
x |
Number |
0.0
|
optional The X component. |
y |
Number |
0.0
|
optional The Y component. |
z |
Number |
0.0
|
optional The Z component. |
w |
Number |
0.0
|
optional The W component. |
See:
Source:
Core/Quaternion.js, line 34
Members
-
staticQuaternion.IDENTITY
-
An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 1.0).Source: Core/Quaternion.js, line 1078
-
staticQuaternion.packedInterpolationLength :Number
-
The number of elements used to store the object into an array in its interpolatable form.Source: Core/Quaternion.js, line 250
-
staticQuaternion.packedLength :Number
-
The number of elements used to pack the object into an array.Source: Core/Quaternion.js, line 190
-
staticQuaternion.ZERO
-
An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).Source: Core/Quaternion.js, line 1072
-
w :Number
-
The W component.
-
Default Value:
0.0Source: Core/Quaternion.js, line 61 -
x :Number
-
The X component.
-
Default Value:
0.0Source: Core/Quaternion.js, line 40 -
y :Number
-
The Y component.
-
Default Value:
0.0Source: Core/Quaternion.js, line 47 -
z :Number
-
The Z component.
-
Default Value:
0.0Source: Core/Quaternion.js, line 54
Methods
-
staticQuaternion.add(left, right, result) → Quaternion
-
Computes the componentwise sum of two quaternions.
Name Type Description leftQuaternion The first quaternion. rightQuaternion The second quaternion. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 436 -
staticQuaternion.clone(quaternion, result) → Quaternion
-
Duplicates a Quaternion instance.
Name Type Description quaternionQuaternion The quaternion to duplicate. resultQuaternion 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)Source: Core/Quaternion.js, line 319 -
staticQuaternion.conjugate(quaternion, result) → Quaternion
-
Computes the conjugate of the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to conjugate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 343 -
staticQuaternion.convertPackedArrayForInterpolation(packedArray, startingIndex, lastIndex, result)
-
Converts a packed array into a form suitable for interpolation.
Name Type Default Description packedArrayNumber[] The packed array. startingIndexNumber 0optional The index of the first element to be converted. lastIndexNumber packedArray.lengthoptional The index of the last element to be converted. resultNumber[] optional The object into which to store the result. Source: Core/Quaternion.js, line 261 -
staticQuaternion.divideByScalar(quaternion, scalar, result) → Quaternion
-
Divides the provided quaternion componentwise by the provided scalar.
Name Type Description quaternionQuaternion The quaternion to be divided. scalarNumber The scalar to divide by. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 613 -
staticQuaternion.dot(left, right) → Number
-
Computes the dot (scalar) product of two quaternions.
Name Type Description leftQuaternion The first quaternion. rightQuaternion The second quaternion. Returns:
The dot product.Source: Core/Quaternion.js, line 518 -
staticQuaternion.equals(left, right) → Boolean
-
Compares the provided quaternions componentwise and returns
trueif they are equal,falseotherwise.Name Type Description leftQuaternion optional The first quaternion. rightQuaternion optional The second quaternion. Returns:
trueif left and right are equal,falseotherwise.Source: Core/Quaternion.js, line 1031 -
staticQuaternion.equalsEpsilon(left, right, epsilon) → Boolean
-
Compares the provided quaternions componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description leftQuaternion optional The first quaternion. rightQuaternion optional The second quaternion. epsilonNumber The epsilon to use for equality testing. Returns:
trueif left and right are within the provided epsilon,falseotherwise.Source: Core/Quaternion.js, line 1052 -
staticQuaternion.exp(cartesian, result) → Quaternion
-
The exponential quaternion function.
Name Type Description cartesianCartesian3 The cartesian. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new instance if one was not provided.Source: Core/Quaternion.js, line 804 -
staticQuaternion.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.Name Type Description startQuaternion The value corresponding to t at 0.0. endQuaternion The value corresponding to t at 1.0. tNumber The point along t at which to interpolate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.- Quaternion#slerp
See:
Source: Core/Quaternion.js, line 940 -
staticQuaternion.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 q0Quaternion The first quaternion. q1Quaternion The second quaternion. s0Quaternion The first inner quadrangle. s1Quaternion The second inner quadrangle. tNumber The time in [0,1] used to interpolate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new instance if none was provided.- Quaternion#squad
See:
Source: Core/Quaternion.js, line 1006 -
staticQuaternion.fromAxisAngle(axis, angle, result) → Quaternion
-
Computes a quaternion representing a rotation around an axis.
Name Type Description axisCartesian3 The axis of rotation. angleNumber The angle in radians to rotate around the axis. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 75 -
staticQuaternion.fromRotationMatrix(matrix, result) → Quaternion
-
Computes a Quaternion from the provided Matrix3 instance.
Name Type Description matrixMatrix3 The rotation matrix. resultQuaternion 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:
Source: Core/Quaternion.js, line 115 -
staticQuaternion.getAngle(quaternion) → Number
-
Computes the angle of rotation of the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to use. Returns:
The angle of rotation.Source: Core/Quaternion.js, line 674 -
staticQuaternion.getAxis(quaternion, result) → Cartesian3
-
Computes the axis of rotation of the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to use. resultCartesian3 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian3 instance if one was not provided.Source: Core/Quaternion.js, line 641 -
staticQuaternion.innerQuadrangle(q0, q1, q2, result) → Quaternion
-
Computes an inner quadrangle point.
This will compute quaternions that ensure a squad curve is C1.
Name Type Description q0Quaternion The first quaternion. q1Quaternion The second quaternion. q2Quaternion The third quaternion. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new instance if none was provided.- Quaternion#squad
See:
Source: Core/Quaternion.js, line 848 -
staticQuaternion.inverse(quaternion, result) → Quaternion
-
Computes the inverse of the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to normalize. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 421 -
staticQuaternion.lerp(start, end, t, result) → Quaternion
-
Computes the linear interpolation or extrapolation at t using the provided quaternions.
Name Type Description startQuaternion The value corresponding to t at 0.0. endQuaternion The value corresponding to t at 1.0. tNumber The point along t at which to interpolate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 698 -
staticQuaternion.log(quaternion, result) → Cartesian3
-
The logarithmic quaternion function.
Name Type Description quaternionQuaternion The unit quaternion. resultCartesian3 optional The object onto which to store the result. Returns:
The modified result parameter or a new instance if one was not provided.Source: Core/Quaternion.js, line 775 -
staticQuaternion.magnitude(quaternion) → Number
-
Computes magnitude for the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to conjugate. Returns:
The magnitude.Source: Core/Quaternion.js, line 384 -
staticQuaternion.magnitudeSquared(quaternion) → Number
-
Computes magnitude squared for the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to conjugate. Returns:
The magnitude squared.Source: Core/Quaternion.js, line 367 -
staticQuaternion.multiply(left, right, result) → Quaternion
-
Computes the product of two quaternions.
Name Type Description leftQuaternion The first quaternion. rightQuaternion The second quaternion. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 540 -
staticQuaternion.multiplyByScalar(quaternion, scalar, result) → Quaternion
-
Multiplies the provided quaternion componentwise by the provided scalar.
Name Type Description quaternionQuaternion The quaternion to be scaled. scalarNumber The scalar to multiply with. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 584 -
staticQuaternion.negate(quaternion, result) → Quaternion
-
Negates the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to be negated. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 493 -
staticQuaternion.normalize(quaternion, result) → Quaternion
-
Computes the normalized form of the provided quaternion.
Name Type Description quaternionQuaternion The quaternion to normalize. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 396 -
staticQuaternion.pack(value, array, startingIndex)
-
Stores the provided instance into the provided array.
Name Type Default Description valueQuaternion The value to pack. arrayNumber[] The array to pack into. startingIndexNumber 0optional The index into the array at which to start packing the elements. Source: Core/Quaternion.js, line 200 -
staticQuaternion.slerp(start, end, t, result) → Quaternion
-
Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
Name Type Description startQuaternion The value corresponding to t at 0.0. endQuaternion The value corresponding to t at 1.0. tNumber The point along t at which to interpolate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.- Quaternion#fastSlerp
See:
Source: Core/Quaternion.js, line 731 -
staticQuaternion.squad(q0, q1, s0, s1, t, result) → Quaternion
-
Computes the spherical quadrangle interpolation between quaternions.
Name Type Description q0Quaternion The first quaternion. q1Quaternion The second quaternion. s0Quaternion The first inner quadrangle. s1Quaternion The second inner quadrangle. tNumber The time in [0,1] used to interpolate. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new instance if none was provided.- Quaternion#innerQuadrangle
Example:
// 1. compute the squad interpolation between two quaternions on a curve var s0 = Cesium.Quaternion.innerQuadrangle(quaternions[i - 1], quaternions[i], quaternions[i + 1]); var s1 = Cesium.Quaternion.innerQuadrangle(quaternions[i], quaternions[i + 1], quaternions[i + 2]); var q = Cesium.Quaternion.squad(quaternions[i], quaternions[i + 1], s0, s1, t); // 2. compute the squad interpolation as above but where the first quaternion is a end point. var s1 = Cesium.Quaternion.innerQuadrangle(quaternions[0], quaternions[1], quaternions[2]); var q = Cesium.Quaternion.squad(quaternions[0], quaternions[1], quaternions[0], s1, t);See:
Source: Core/Quaternion.js, line 894 -
staticQuaternion.subtract(left, right, result) → Quaternion
-
Computes the componentwise difference of two quaternions.
Name Type Description leftQuaternion The first quaternion. rightQuaternion The second quaternion. resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 465 -
staticQuaternion.unpack(array, startingIndex, result)
-
Retrieves an instance from a packed array.
Name Type Default Description arrayNumber[] The packed array. startingIndexNumber 0optional The starting index of the element to be unpacked. resultQuaternion optional The object into which to store the result. Source: Core/Quaternion.js, line 227 -
staticQuaternion.unpackInterpolationResult(array, sourceArray, startingIndex, lastIndex, result)
-
Retrieves an instance from a packed array converted with
convertPackedArrayForInterpolation.Name Type Default Description arrayNumber[] The original packed array. sourceArrayNumber[] The converted array. startingIndexNumber 0optional The startingIndex used to convert the array. lastIndexNumber packedArray.lengthoptional The lastIndex used to convert the array. resultQuaternion optional The object into which to store the result. Source: Core/Quaternion.js, line 293 -
clone(result) → Quaternion
-
Duplicates this Quaternion instance.
Name Type Description resultQuaternion optional The object onto which to store the result. Returns:
The modified result parameter or a new Quaternion instance if one was not provided.Source: Core/Quaternion.js, line 1087 -
equals(right) → Boolean
-
Compares this and the provided quaternion componentwise and returns
trueif they are equal,falseotherwise.Name Type Description rightQuaternion optional The right hand side quaternion. Returns:
trueif left and right are equal,falseotherwise.Source: Core/Quaternion.js, line 1099 -
equalsEpsilon(right, epsilon) → Boolean
-
Compares this and the provided quaternion componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description rightQuaternion optional The right hand side quaternion. epsilonNumber The epsilon to use for equality testing. Returns:
trueif left and right are within the provided epsilon,falseotherwise.Source: Core/Quaternion.js, line 1113 -
toString() → String
-
Returns a string representing this quaternion in the format (x, y, z, w).
Returns:
A string representing this Quaternion.Source: Core/Quaternion.js, line 1123
