@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
101 lines (100 loc) • 3.88 kB
TypeScript
import { Vector3 } from '.';
import { Matrix4 } from './Matrix4';
export declare class Quaternion {
x: number;
y: number;
z: number;
w: number;
isIdentity: boolean;
static Identity: Quaternion;
constructor(x?: number, y?: number, z?: number, w?: number);
/**
* Compares the x, y, z and w properties of q to the equivalent properties of this quaternion to determine if they represent the same rotation.
*/
equals(q: Quaternion): boolean;
/**
* Returns a new Quaternion with identical x, y, z and w properties to this one.
*/
clone(): Quaternion;
/**
* Returns the angle between this quaternion and quaternion q in radians.
*/
angleTo(q: Quaternion): number;
/**
* Computes the Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector.
*/
length(): number;
/**
* Computes the squared Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector.
*/
lengthSqr(): number;
/**
* Returns dot product of 2 quaternions.
*/
static dot(q1: Quaternion, q2: Quaternion): number;
/**
* Adds each element in one quaternion with its corresponding element in a second quaternion.
*/
static add(q1: Quaternion, q2: Quaternion): Quaternion;
/**
* Subtracts each element in a second quaternion from its corresponding element in a first quaternion.
*/
static sub(v1: Quaternion, v2: Quaternion): Quaternion;
/**
* Returns the conjugate of a specified quaternion.
*/
static conjugate(q: Quaternion): Quaternion;
/**
* Returns the inverse of a quaternion.
*/
static invert(q: Quaternion): Quaternion;
/**
* Divides each component of a specified Quaternion by its length.
*/
static normalize(q: Quaternion): Quaternion;
/**
* Returns the quaternion that results from multiplying two quaternions together.
*/
static multiply(q1: Quaternion, q2: Quaternion): Quaternion;
/**
* Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor.
*/
static multiplyScalar(q: Quaternion, s: number): Quaternion;
/**
* Divides one quaternion by a second quaternion.
*/
static divide(q1: Quaternion, q2: Quaternion): Quaternion;
/**
* Interpolates between two quaternions, using spherical linear interpolation.
*/
static slerp(q1: Quaternion, q2: Quaternion, t: number): Quaternion;
/**
* Linearly interpolate between 2 quaternions,
* where alpha is the percent distance along the line - alpha = 0 will be this vector,
* and alpha = 1 will be v.
*/
static lerp(q1: Quaternion, q2: Quaternion, t: number): Quaternion;
/**
* Concatenates two quaternions.
*/
static concat(q1: Quaternion, q2: Quaternion): Quaternion;
/**
* Reverses the sign of each component of the quaternion.
*/
static negate(q: Quaternion): Quaternion;
/**
* Creates a quaternion from a unit vector and an angle to rotate around the vector.
*/
static createFromAxisAngle(axis: Vector3, angle: number): Quaternion;
/**
* Creates a quaternion from the specified rotation matrix.
*/
static createFromRotationMatrix(m: Matrix4): Quaternion;
/**
* Creates a new quaternion from the given yaw, pitch, and roll.
* @param yaw Angle of rotation, in radians, around the Y-axis.
* @param pitch Angle of rotation, in radians, around the X-axis.
* @param roll Angle of rotation, in radians, around the Z-axis.
*/
static createFromYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
}