@JsType(isNative=true, namespace="Cesium", name="Quaternion") public class Quaternion extends Object
Modifier and Type | Field and Description |
---|---|
static int |
packedInterpolationLength
The number of elements used to store the object into an array in its interpolatable form.
|
static int |
packedLength
The number of elements used to pack the object into an array.
|
double |
w
The W component.
|
double |
x
The X component.
|
double |
y
The Y component.
|
double |
z
The Z component.
|
Constructor and Description |
---|
Quaternion()
A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
|
Quaternion(double x,
double y,
double z,
double w)
A set of 4-dimensional coordinates used to represent rotation in 3-dimensional space.
|
Modifier and Type | Method and Description |
---|---|
static Quaternion |
add(Quaternion left,
Quaternion right,
Quaternion result)
Computes the componentwise sum of two quaternions.
|
Quaternion |
clone()
Duplicates this Quaternion instance.
|
static Quaternion |
clone(Quaternion quaternion)
Duplicates a Quaternion instance.
|
static Quaternion |
clone(Quaternion quaternion,
Quaternion result)
Duplicates a Quaternion instance.
|
static double |
computeAngle(Quaternion quaternion)
Computes the angle of rotation of the provided quaternion.
|
static Cartesian3 |
computeAxis(Quaternion quaternion,
Cartesian3 result)
Computes the axis of rotation of the provided quaternion.
|
static Quaternion |
computeInnerQuadrangle(Quaternion q0,
Quaternion q1,
Quaternion q2,
Quaternion result)
Computes an inner quadrangle point.
|
static Quaternion |
conjugate(Quaternion quaternion,
Quaternion result)
Computes the conjugate of the provided quaternion.
|
static void |
convertPackedArrayForInterpolation(double[] packedArray)
Converts a packed array into a form suitable for interpolation.
|
static void |
convertPackedArrayForInterpolation(double[] packedArray,
int startingIndex,
int lastIndex,
double[] result)
Converts a packed array into a form suitable for interpolation.
|
static Quaternion |
divideByScalar(Quaternion quaternion,
double scalar,
Quaternion result)
Divides the provided quaternion componentwise by the provided scalar.
|
static double |
dot(Quaternion left,
Quaternion right)
Computes the dot (scalar) product of two quaternions.
|
boolean |
equals(Quaternion right)
Compares this and the provided quaternion componentwise and returns true if they are equal, false otherwise.
|
static boolean |
equals(Quaternion left,
Quaternion right)
Compares the provided quaternions componentwise and returns true if they are equal, false otherwise.
|
boolean |
equalsEpsilon(Quaternion right,
double epsilon)
Compares this and the provided quaternion componentwise and returns true if they are within the provided epsilon, false otherwise.
|
static boolean |
equalsEpsilon(Quaternion left,
Quaternion right,
double epsilon)
Compares the provided quaternions componentwise and returns true if they are within the provided epsilon, false otherwise.
|
static Quaternion |
exp(Cartesian3 cartesian,
Quaternion result)
The exponential quaternion function.
|
static Quaternion |
fastSlerp(Quaternion start,
Quaternion end,
double t,
Quaternion result)
Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
|
static Quaternion |
fastSquad(Quaternion q0,
Quaternion q1,
Quaternion s0,
Quaternion s1,
float t,
Quaternion result) |
static Quaternion |
fromAxisAngle(Cartesian3 axis,
double angle)
Computes a quaternion representing a rotation around an axis.
|
static Quaternion |
fromAxisAngle(Cartesian3 axis,
double angle,
Quaternion result)
Computes a quaternion representing a rotation around an axis.
|
static Quaternion |
fromHeadingPitchRoll(HeadingPitchRoll hpr,
Quaternion result)
Computes a rotation from the given heading, pitch and roll angles.
|
static Quaternion |
fromRotationMatrix(Matrix3 matrix)
Computes a Quaternion from the provided Matrix3 instance.
|
static Quaternion |
fromRotationMatrix(Matrix3 matrix,
Quaternion result)
Computes a Quaternion from the provided Matrix3 instance.
|
static Quaternion |
IDENTITY()
An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 1.0).
|
static Quaternion |
inverse(Quaternion quaternion,
Quaternion result)
Computes the inverse of the provided quaternion.
|
static Quaternion |
lerp(Quaternion start,
Quaternion end,
double t,
Quaternion result)
Computes the linear interpolation or extrapolation at t using the provided quaternions.
|
static Cartesian3 |
log(Quaternion quaternion,
Cartesian3 result)
The logarithmic quaternion function.
|
static double |
magnitude(Quaternion quaternion)
Computes magnitude for the provided quaternion.
|
static double |
magnitudeSquared(Quaternion quaternion)
Computes magnitude squared for the provided quaternion.
|
static Quaternion |
multiply(Quaternion left,
Quaternion right,
Quaternion result)
Computes the product of two quaternions.
|
static Quaternion |
multiplyByScalar(Quaternion quaternion,
double scalar,
Quaternion result)
Multiplies the provided quaternion componentwise by the provided scalar.
|
static Quaternion |
negate(Quaternion quaternion,
Quaternion result)
Negates the provided quaternion.
|
static Quaternion |
normalize(Quaternion quaternion,
Quaternion result)
Computes the normalized form of the provided quaternion.
|
static double[] |
pack(Quaternion value,
double[] array)
Stores the provided instance into the provided array.
|
static double[] |
pack(Quaternion value,
double[] array,
int startingIndex)
Stores the provided instance into the provided array.
|
static Quaternion |
slerp(Quaternion start,
Quaternion end,
float t,
Quaternion result)
Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.
|
static Quaternion |
squad(Quaternion q0,
Quaternion q1,
Quaternion s0,
Quaternion s1,
float t,
Quaternion result)
Computes the spherical quadrangle interpolation between quaternions.
|
static Quaternion |
subtract(Quaternion left,
Quaternion right,
Quaternion result)
Computes the componentwise difference of two quaternions.
|
String |
toString()
Returns a string representing this quaternion in the format (x, y, z, w).
|
static Quaternion |
unpack(double[] array)
Retrieves an instance from a packed array.
|
static Quaternion |
unpack(double[] array,
int startingIndex)
Retrieves an instance from a packed array.
|
static Quaternion |
unpack(double[] array,
int startingIndex,
Quaternion result)
Retrieves an instance from a packed array.
|
static Quaternion |
unpackInterpolationResult(double[] array,
double[] sourceArray)
Retrieves an instance from a packed array converted with convertPackedArrayForInterpolation.
|
static Quaternion |
unpackInterpolationResult(double[] array,
double[] sourceArray,
int startingIndex,
int lastIndex)
Retrieves an instance from a packed array converted with convertPackedArrayForInterpolation.
|
static Quaternion |
unpackInterpolationResult(double[] array,
double[] sourceArray,
int startingIndex,
int lastIndex,
Quaternion result)
Retrieves an instance from a packed array converted with convertPackedArrayForInterpolation.
|
static Quaternion |
ZERO()
An immutable Quaternion instance initialized to (0.0, 0.0, 0.0, 0.0).
|
@JsProperty public static int packedInterpolationLength
@JsProperty public static int packedLength
@JsProperty public double w
@JsProperty public double x
@JsProperty public double y
@JsProperty public double z
@JsConstructor public Quaternion()
@JsConstructor public Quaternion(double x, double y, double z, double w)
x
- The X component.y
- The Y component.z
- The Z component.w
- The W component.@JsProperty(name="IDENTITY") public static Quaternion IDENTITY()
@JsProperty(name="ZERO") public static Quaternion ZERO()
@JsMethod public static Quaternion add(Quaternion left, Quaternion right, Quaternion result)
left
- The first quaternion.right
- The second quaternion.result
- The object onto which to store the result.@JsMethod public static Quaternion clone(Quaternion quaternion)
quaternion
- The quaternion to duplicate.@JsMethod public static Quaternion clone(Quaternion quaternion, Quaternion result)
quaternion
- The quaternion to duplicate.result
- The object onto which to store the result.@JsMethod public static double computeAngle(Quaternion quaternion)
quaternion
- The quaternion to use.@JsMethod public static Cartesian3 computeAxis(Quaternion quaternion, Cartesian3 result)
quaternion
- The quaternion to use.result
- The object onto which to store the result.@JsMethod public static Quaternion computeInnerQuadrangle(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion result)
q0
- The first quaternion.q1
- The second quaternion.q2
- The third quaternion.result
- The object onto which to store the result.squad(Quaternion, Quaternion, Quaternion, Quaternion, float, Quaternion)
@JsMethod public static Quaternion conjugate(Quaternion quaternion, Quaternion result)
quaternion
- The quaternion to conjugate.result
- The object onto which to store the result.public static void convertPackedArrayForInterpolation(double[] packedArray)
packedArray
- The packed array.public static void convertPackedArrayForInterpolation(double[] packedArray, int startingIndex, int lastIndex, double[] result)
packedArray
- The packed array.startingIndex
- The index of the first element to be converted. Default: 0lastIndex
- The index of the last element to be converted. Default: packedArray.lengthresult
- The object into which to store the result.@JsMethod public static Quaternion divideByScalar(Quaternion quaternion, double scalar, Quaternion result)
quaternion
- The quaternion to be divided.scalar
- The scalar to divide by.result
- The object onto which to store the result.@JsMethod public static double dot(Quaternion left, Quaternion right)
left
- The first quaternion.right
- The second quaternion.@JsMethod public static boolean equals(Quaternion left, Quaternion right)
left
- The first quaternion.right
- The second quaternion.@JsMethod public static boolean equalsEpsilon(Quaternion left, Quaternion right, double epsilon)
left
- The first quaternion.right
- The second quaternion.epsilon
- The epsilon to use for equality testing.@JsMethod public static Quaternion exp(Cartesian3 cartesian, Quaternion result)
cartesian
- The cartesian.result
- The object onto which to store the result.@JsMethod public static Quaternion fastSlerp(Quaternion start, Quaternion end, double t, Quaternion result)
start
- The value corresponding to t at 0.0.end
- The value corresponding to t at 1.0.t
- The point along t at which to interpolate.result
- The object onto which to store the result.slerp(Quaternion, Quaternion, float, Quaternion)
@JsMethod public static Quaternion fastSquad(Quaternion q0, Quaternion q1, Quaternion s0, Quaternion s1, float t, Quaternion result)
q0
- The first quaternion.q1
- The second quaternion.s0
- The first inner quadrangle.s1
- The second inner quadrangle.t
- The time in [0,1] used to interpolate.result
- The object onto which to store the result.squad(Quaternion, Quaternion, Quaternion, Quaternion, float, Quaternion)
@JsMethod public static Quaternion fromAxisAngle(Cartesian3 axis, double angle)
axis
- The axis of rotation.angle
- The angle in radians to rotate around the axis.@JsMethod public static Quaternion fromAxisAngle(Cartesian3 axis, double angle, Quaternion result)
axis
- The axis of rotation.angle
- The angle in radians to rotate around the axis.result
- The object onto which to store the result.@JsMethod public static Quaternion fromHeadingPitchRoll(HeadingPitchRoll hpr, Quaternion result)
hpr
- heading pitch roll object.result
- The object onto which to store the result.@JsMethod public static Quaternion fromRotationMatrix(Matrix3 matrix)
matrix
- The rotation matrix.Matrix3.fromQuaternion(org.cesiumjs.cs.core.Quaternion)
,
Matrix3.fromQuaternion(org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Matrix3)
@JsMethod public static Quaternion fromRotationMatrix(Matrix3 matrix, Quaternion result)
matrix
- The rotation matrix.result
- The object onto which to store the result.Matrix3.fromQuaternion(org.cesiumjs.cs.core.Quaternion)
,
Matrix3.fromQuaternion(org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Matrix3)
@JsMethod public static Quaternion inverse(Quaternion quaternion, Quaternion result)
quaternion
- The quaternion to normalize.result
- The object onto which to store the result.@JsMethod public static Quaternion lerp(Quaternion start, Quaternion end, double t, Quaternion result)
start
- The value corresponding to t at 0.0.end
- The value corresponding to t at 1.0.t
- The point along t at which to interpolate.result
- The object onto which to store the result.@JsMethod public static Cartesian3 log(Quaternion quaternion, Cartesian3 result)
quaternion
- The unit quaternion.result
- The object onto which to store the result.@JsMethod public static double magnitude(Quaternion quaternion)
quaternion
- Quaternion The quaternion to conjugate.@JsMethod public static double magnitudeSquared(Quaternion quaternion)
quaternion
- The quaternion to conjugate.@JsMethod public static Quaternion multiply(Quaternion left, Quaternion right, Quaternion result)
left
- The first quaternion.right
- The second quaternion.result
- The object onto which to store the result.@JsMethod public static Quaternion multiplyByScalar(Quaternion quaternion, double scalar, Quaternion result)
quaternion
- The quaternion to be scaled.scalar
- The scalar to multiply with.result
- The object onto which to store the result.@JsMethod public static Quaternion negate(Quaternion quaternion, Quaternion result)
quaternion
- The quaternion to be negated.result
- The object onto which to store the result.@JsMethod public static Quaternion normalize(Quaternion quaternion, Quaternion result)
quaternion
- The quaternion to normalize.result
- The object onto which to store the result.public static double[] pack(Quaternion value, double[] array)
value
- The value to pack.array
- The array to pack into.public static double[] pack(Quaternion value, double[] array, int startingIndex)
value
- The value to pack.array
- The array to pack into.startingIndex
- The index into the array at which to start packing the elements. Default: 0@JsMethod public static Quaternion slerp(Quaternion start, Quaternion end, float t, Quaternion result)
start
- The value corresponding to t at 0.0.end
- The value corresponding to t at 1.0.t
- The point along t at which to interpolate.result
- The object onto which to store the result.fastSlerp(org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Quaternion, double, org.cesiumjs.cs.core.Quaternion)
@JsMethod public static Quaternion squad(Quaternion q0, Quaternion q1, Quaternion s0, Quaternion s1, float t, Quaternion result)
q0
- The first quaternion.q1
- The second quaternion.s0
- The first inner quadrangle.s1
- The second inner quadrangle.t
- The time in [0,1] used to interpolate.result
- The object onto which to store the result.computeInnerQuadrangle(org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Quaternion)
@JsMethod public static Quaternion subtract(Quaternion left, Quaternion right, Quaternion result)
left
- The first quaternion.right
- The second quaternion.result
- The object onto which to store the result.public static Quaternion unpack(double[] array)
array
- The packed array.public static Quaternion unpack(double[] array, int startingIndex)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked. Default: 0public static Quaternion unpack(double[] array, int startingIndex, Quaternion result)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked. Default: 0result
- The object into which to store the result.public static Quaternion unpackInterpolationResult(double[] array, double[] sourceArray)
array
- The array previously packed for interpolation.sourceArray
- The original packed array.public static Quaternion unpackInterpolationResult(double[] array, double[] sourceArray, int startingIndex, int lastIndex)
array
- The array previously packed for interpolation.sourceArray
- The original packed array.startingIndex
- The startingIndex used to convert the array. Default: 0lastIndex
- The lastIndex used to convert the array. Default: packedArray.lengthpublic static Quaternion unpackInterpolationResult(double[] array, double[] sourceArray, int startingIndex, int lastIndex, Quaternion result)
array
- The array previously packed for interpolation.sourceArray
- The original packed array.startingIndex
- The startingIndex used to convert the array. Default: 0lastIndex
- The lastIndex used to convert the array. Default: packedArray.lengthresult
- The object into which to store the result.@JsMethod public Quaternion clone()
@JsMethod public boolean equals(Quaternion right)
right
- @JsMethod public boolean equalsEpsilon(Quaternion right, double epsilon)
right
- The right hand side quaternion.epsilon
- The epsilon to use for equality testing.Copyright © 2019. All rights reserved.