@casual-simulation/aux-common
Version:
Common library for AUX projects
72 lines • 2.56 kB
TypeScript
export declare class Quaternion {
/**
* The X value of the quaternion.
*/
x: number;
/**
* The Y value of the quaternion.
*/
y: number;
/**
* The Z value of the quaternion.
*/
z: number;
/**
* The W value of the quaternion.
*/
w: number;
/**
* Creates a new Quaternion with the given values.
* @param x The X value.
* @param y The Y value.
* @param z The Z value.
* @param w The W value.
*/
constructor(x?: number, y?: number, z?: number, w?: number);
/**
* Multiplies this quaternion by the other quaternion and returns the result.
* In quaternion math, multiplication can be used to combine quaternions together,
* however unlike regular multiplication quaternion multiplication is order dependent.
*
* Which frame of reference you want to use depends on which order you use.
* For example, q2.multiply(q1) starts with the identity, applies q1 to it, and then applies q2 to that.
* Whereas, q1.multiply(q2) starts with the identity, applies q2 to it, and then applies q1 to that.
*
* @param other The other quaternion.
*/
multiply(other: Quaternion): Quaternion;
/**
* Calculates the conjugate of this quaternion and returns the result.
* The conjugate (or inverse) of a quaternion is similar to negating a number.
* When you multiply a quaternion by its conjugate, the result is the identity quaternion.
*/
invert(): Quaternion;
/**
* Gets the length of this vector. That is, the pathagorean theorem applied to X, Y, Z, and W.
*/
length(): number;
/**
* Calculates the square length of this quaternion and returns the result.
* This is equivalent to length^2, but it is faster to calculate than length because it doesn't require
* calculating a square root.
*/
squareLength(): number;
/**
* Calculates the normalized version of this quaternion and returns it.
* A normalized quaternion is a quaternion whose length equals 1.
*
* Normalizing a quaternion preserves its rotation/reflection while making the length (i.e. scale) of it 1.
*/
normalize(): Quaternion;
toString(): string;
/**
* Determines if this quaternion equals the other quaternion.
* @param other The other quaternion to apply.
*/
equals(other: Quaternion): boolean;
}
/**
* The identity quaternion.
*/
export declare const IDENTITY: Quaternion;
//# sourceMappingURL=Quaternion.d.ts.map