@temporary-escape/mod-sdk / Quaternion
Class: Quaternion
Defined in: math/quaternion.ts:7
Constructors
Constructor
ts
new Quaternion(
w?: number,
x?: number,
y?: number,
z?: number
): Quaternion;Defined in: math/quaternion.ts:13
Parameters
| Parameter | Type | Default value |
|---|---|---|
w | number | 1 |
x | number | 0 |
y | number | 0 |
z | number | 0 |
Returns
Quaternion
Properties
| Property | Type | Defined in |
|---|---|---|
w | number | math/quaternion.ts:11 |
x | number | math/quaternion.ts:8 |
y | number | math/quaternion.ts:9 |
z | number | math/quaternion.ts:10 |
Methods
toString()
ts
toString(): string;Defined in: math/quaternion.ts:20
Returns
string
add()
ts
static add(a: Quaternion, b: Quaternion): Quaternion;Defined in: math/quaternion.ts:63
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
Quaternion
angle()
ts
static angle(q: Quaternion): number;Defined in: math/quaternion.ts:111
Returns the quaternion rotation angle.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
angleAxis()
ts
static angleAxis(angle: number, v: Vector3f): Quaternion;Defined in: math/quaternion.ts:50
Build a quaternion from an angle and a normalized axis.
Parameters
| Parameter | Type |
|---|---|
angle | number |
v | Vector3f |
Returns
Quaternion
axis()
ts
static axis(q: Quaternion): Vector3f;Defined in: math/quaternion.ts:125
Returns the q rotation axis.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
cmpEqual()
ts
static cmpEqual(a: Quaternion, b: Quaternion): Vector4b;Defined in: math/quaternion.ts:97
Component wise comparison of two quaternions.
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
cmpNotEqual()
ts
static cmpNotEqual(a: Quaternion, b: Quaternion): Vector4b;Defined in: math/quaternion.ts:104
Component wise comparison of two quaternions.
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
conjugate()
ts
static conjugate(q: Quaternion): Quaternion;Defined in: math/quaternion.ts:134
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
Quaternion
dot()
ts
static dot(x: Quaternion, y: Quaternion): number;Defined in: math/quaternion.ts:24
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
Returns
number
eq()
ts
static eq(a: Quaternion, b: Quaternion): boolean;Defined in: math/quaternion.ts:83
Returns true if two quaternions are equal.
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
boolean
eulerAngles()
ts
static eulerAngles(q: Quaternion): Vector3f;Defined in: math/quaternion.ts:274
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
greaterThan()
ts
static greaterThan(x: Quaternion, y: Quaternion): Vector4b;Defined in: math/quaternion.ts:278
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
Returns
greaterThanEqual()
ts
static greaterThanEqual(x: Quaternion, y: Quaternion): Vector4b;Defined in: math/quaternion.ts:282
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
Returns
identity()
ts
static identity(): Quaternion;Defined in: math/quaternion.ts:43
Creates an identity quaternion.
Returns
Quaternion
inverse()
ts
static inverse(q: Quaternion): Quaternion;Defined in: math/quaternion.ts:141
Returns the q inverse.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
Quaternion
length()
ts
static length(q: Quaternion): number;Defined in: math/quaternion.ts:223
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
length2()
ts
static length2(q: Quaternion): number;Defined in: math/quaternion.ts:227
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
lerp()
ts
static lerp(
x: Quaternion,
y: Quaternion,
a: number
): Quaternion;Defined in: math/quaternion.ts:150
Linear interpolation between two quaternions.
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
a | number |
Returns
Quaternion
lessThan()
ts
static lessThan(x: Quaternion, y: Quaternion): Vector4b;Defined in: math/quaternion.ts:286
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
Returns
lessThanEqual()
ts
static lessThanEqual(x: Quaternion, y: Quaternion): Vector4b;Defined in: math/quaternion.ts:290
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
Returns
lookAt()
ts
static lookAt(direction: Vector3f, up: Vector3f): Quaternion;Defined in: math/quaternion.ts:299
Build a quaternion looking at a direction, based on the default handedness. The engine compiles GLM with GLM_FORCE_LEFT_HANDED, so this matches glm::quatLookAtLH (which is what glm::quatLookAt resolves to in the engine).
Parameters
| Parameter | Type |
|---|---|
direction | Vector3f |
up | Vector3f |
Returns
Quaternion
mat3Cast()
ts
static mat3Cast(q: Quaternion): Matrix3f;Defined in: math/quaternion.ts:366
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
mat4Cast()
ts
static mat4Cast(q: Quaternion): Matrix4f;Defined in: math/quaternion.ts:356
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
mix()
ts
static mix(
x: Quaternion,
y: Quaternion,
a: number
): Quaternion;Defined in: math/quaternion.ts:166
Spherical linear interpolation of two quaternions. The interpolation is oriented and the rotation is performed at constant speed. For short path spherical linear interpolation, use the slerp function.
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
a | number |
Returns
Quaternion
mul()
ts
static mul(a: Quaternion, b: Quaternion): Quaternion;Defined in: math/quaternion.ts:71
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
Quaternion
ne()
ts
static ne(a: Quaternion, b: Quaternion): boolean;Defined in: math/quaternion.ts:90
Returns true if two quaternions are not equal.
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
boolean
normalize()
ts
static normalize(q: Quaternion): Quaternion;Defined in: math/quaternion.ts:234
Returns a normalized quaternion.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
Quaternion
pitch()
ts
static pitch(q: Quaternion): number;Defined in: math/quaternion.ts:246
Extract the pitch angle from a quaternion.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
roll()
ts
static roll(q: Quaternion): number;Defined in: math/quaternion.ts:265
Extract the roll angle from a quaternion.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
rotate()
ts
static rotate(
q: Quaternion,
angle: number,
v: Vector3f
): Quaternion;Defined in: math/quaternion.ts:314
Rotate a quaternion by an angle around an axis.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
angle | number |
v | Vector3f |
Returns
Quaternion
rotation()
ts
static rotation(orig: Vector3f, dest: Vector3f): Quaternion;Defined in: math/quaternion.ts:330
Compute the rotation between two vectors. Vectors need to be normalized.
Parameters
| Parameter | Type |
|---|---|
orig | Vector3f |
dest | Vector3f |
Returns
Quaternion
slerp()
ts
static slerp(
x: Quaternion,
y: Quaternion,
a: number
): Quaternion;Defined in: math/quaternion.ts:195
Spherical linear interpolation of two quaternions.
The interpolation always take the short path and the rotation is performed at constant speed.
Parameters
| Parameter | Type |
|---|---|
x | Quaternion |
y | Quaternion |
a | number |
Returns
Quaternion
sub()
ts
static sub(a: Quaternion, b: Quaternion): Quaternion;Defined in: math/quaternion.ts:67
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
b | Quaternion |
Returns
Quaternion
toVector()
ts
static toVector(q: Quaternion): Vector4f;Defined in: math/quaternion.ts:352
Convert a quaternion to a vector.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
unm()
ts
static unm(a: Quaternion): Quaternion;Defined in: math/quaternion.ts:59
Unary minus.
Parameters
| Parameter | Type |
|---|---|
a | Quaternion |
Returns
Quaternion
yaw()
ts
static yaw(q: Quaternion): number;Defined in: math/quaternion.ts:258
Extract the yaw angle from a quaternion.
Parameters
| Parameter | Type |
|---|---|
q | Quaternion |
Returns
number
