public final class MyQuaternion
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger
message logger for this class
|
| Modifier and Type | Method and Description |
|---|---|
static void |
accumulateScaled(Quaternion total,
Quaternion input,
float scale)
Accumulate a linear combination of quaternions.
|
static void |
cardinalizeLocal(Quaternion input)
Find the cardinal rotation most similar to the specified Quaternion.
|
static Quaternion |
conjugate(Quaternion q,
Quaternion storeResult)
Return the conjugate of a Quaternion.
|
static java.lang.String |
describe(Quaternion q)
Generate a textual description of a Quaternion value.
|
static double |
dot(Quaternion q1,
Quaternion q2)
Return the dot (scalar) product of 2 quaternions.
|
static Quaternion |
exp(Quaternion q,
Quaternion storeResult)
Return the exponential of a pure Quaternion.
|
static boolean |
isPure(Quaternion q)
Test for a pure Quaternion.
|
static boolean |
isRotationIdentity(Quaternion q)
Test whether the specified Quaternion represents an identity rotation.
|
static boolean |
isZero(Quaternion q)
Test for a zero Quaternion.
|
static double |
lengthSquared(Quaternion q)
Return the squared length of the argument.
|
static Quaternion |
log(Quaternion q,
Quaternion storeResult)
Return the natural logarithm of a normalized quaternion.
|
static boolean |
ne(Quaternion a,
Quaternion b)
Test whether 2 quaternions are distinct, without distinguishing 0 from
-0.
|
static void |
normalizeLocal(Quaternion input)
Normalize the specified Quaternion in place.
|
static Quaternion |
pow(Quaternion base,
float exponent,
Quaternion storeResult)
Raise a normalized quaternion to the specified real power.
|
static Vector3f |
rotate(Quaternion rotation,
Vector3f input,
Vector3f storeResult)
Rotate the input vector using the specified quaternion.
|
static Vector3f |
rotateInverse(Quaternion rotation,
Vector3f input,
Vector3f storeResult)
Rotate the input vector using the inverse of the specified quaternion.
|
static Quaternion |
slerp(float t,
Quaternion q0,
Quaternion q1,
Quaternion storeResult)
Interpolate between 2 normalized quaternions using spherical linear
(Slerp) interpolation.
|
static Quaternion |
squad(float t,
Quaternion p,
Quaternion a,
Quaternion b,
Quaternion q,
Quaternion storeResult)
Interpolate between 4 normalized quaternions using the Squad function.
|
static Quaternion |
squadA(Quaternion q0,
Quaternion q1,
Quaternion q2,
Quaternion storeResult)
Return Squad parameter "a" for a continuous first derivative at the
middle point of 3 specified control points.
|
static Quaternion |
standardize(Quaternion input,
Quaternion storeResult)
Standardize a Quaternion in preparation for hashing.
|
static boolean |
validateUnit(Quaternion q,
java.lang.String description,
float tolerance)
Validate a normalized quaternion as a method argument.
|
public static final java.util.logging.Logger logger
public static void accumulateScaled(Quaternion total, Quaternion input, float scale)
total - sum of the scaled inputs so far (not null, modified, may be
input)input - the Quaternion to scale and add (not null, unaffected unless
it's total)scale - scale factor to apply to the inputpublic static void cardinalizeLocal(Quaternion input)
input - the input value (not null, modified)public static Quaternion conjugate(Quaternion q, Quaternion storeResult)
For normalized quaternions, the conjugate is a fast way to calculate the inverse.
q - the input value (not null, unaffected unless it's
storeResult)storeResult - storage for the result (modified if not null, may be
q)storeResult or a new
instance)public static java.lang.String describe(Quaternion q)
q - the value to describe (may be null, unaffected)public static double dot(Quaternion q1, Quaternion q2)
This method returns a double-precision value for precise comparison of angles.
q1 - the first input value (not null, unaffected)q2 - the 2nd input value (not null, unaffected)public static Quaternion exp(Quaternion q, Quaternion storeResult)
q - the input value (not null, w=0, unaffected)storeResult - storage for the result (modified if not null)storeResult or a new
instance)public static boolean isPure(Quaternion q)
q - the value to test (not null, unaffected)public static boolean isRotationIdentity(Quaternion q)
Accepts any finite, non-zero value for w.
q - the value to test (not null, unaffected)public static boolean isZero(Quaternion q)
q - the value to test (not null, unaffected)public static double lengthSquared(Quaternion q)
Unlike Quaternion.norm(), this method returns a
double-precision value for precise comparison of lengths.
q - the input value (not null, unaffected)public static Quaternion log(Quaternion q, Quaternion storeResult)
In general, the result isn't itself normalized.
q - the input value (not null, norm approximately equal to 1,
unaffected unless it's storeResult)storeResult - storage for the result (modified if not null, may be
q)storeResult or a new instance)public static boolean ne(Quaternion a, Quaternion b)
a - the first input value (not null, unaffected)b - the 2nd input value (not null, unaffected)public static void normalizeLocal(Quaternion input)
input - the instance to normalize (not null, modified)public static Quaternion pow(Quaternion base, float exponent, Quaternion storeResult)
base - the input value (not null, norm approximately equal to 1,
unaffected unless it's storeResult)exponent - the exponentstoreResult - storage for the result (modified if not null, may be
base)storeResult or a new instance)public static Vector3f rotate(Quaternion rotation, Vector3f input, Vector3f storeResult)
This method doesn't assume the quaternion is normalized. Instead, rotation is performed using a normalized version of the quaternion.
rotation - the desired rotation (not null, not zero, unaffected)input - the vector to rotate (not null, finite, unaffected unless
it's storeResult)storeResult - storage for the result (modified if not null, may be
input)storeResult or a new instance)public static Vector3f rotateInverse(Quaternion rotation, Vector3f input, Vector3f storeResult)
rotation - the rotation (not null, not zero, unaffected)input - the vector to rotate (not null, finite, unaffected unless
it's storeResult)storeResult - storage for the result (modified if not null, may be
input)storeResult or a new instance)public static Quaternion slerp(float t, Quaternion q0, Quaternion q1, Quaternion storeResult)
The caller is responsible for flipping the sign of q0 or
q1 when it's appropriate to do so.
t - the weight given to q1 (≥0, ≤1)q0 - the function value at t=0 (not null, norm approximately equal
to 1, unaffected unless it's storeResult)q1 - the function value at t=1 (not null, norm approximately equal
to 1, unaffected unless it's storeResult)storeResult - storage for the result (modified if not null, may be
q0 or q1)storeResult or a new
instance)public static Quaternion squad(float t, Quaternion p, Quaternion a, Quaternion b, Quaternion q, Quaternion storeResult)
t - the weight given to q (≥0, ≤1)p - function value at t=0 (not null, norm approximately equal to 1,
unaffected unless it's storeResult)a - the first control point (not null, norm approximately equal to
1, unaffected unless it's storeResult)b - the 2nd control point (not null, norm approximately equal to 1,
unaffected unless it's storeResult)q - function value at t=1 (not null, norm approximately equal to 1,
unaffected unless it's storeResult)storeResult - storage for the result (modified if not null)storeResult or a new
instance)public static Quaternion squadA(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion storeResult)
q0 - the previous control point (not null, norm approximately equal
to 1, unaffected unless it's storeResult)q1 - the current control point (not null, norm approximately equal
to 1, unaffected unless it's storeResult)q2 - the following control point (not null, norm approximately equal
to 1, unaffected unless it's storeResult)storeResult - storage for the result (modified if not null)storeResult or a new
instance)public static Quaternion standardize(Quaternion input, Quaternion storeResult)
input - the input value (not null, unaffected unless it's
storeResult)storeResult - storage for the result (modified if not null, may be
input)public static boolean validateUnit(Quaternion q, java.lang.String description, float tolerance)
q - the Quaternion to validate (not null, unaffected)description - description of the Quaterniontolerance - for the norm (≥0)java.lang.IllegalArgumentException - if the norm is out of tolerancejava.lang.NullPointerException - if the Quaternion is null