Options
All
• Public
• Public/Protected
• All

Class Quaternion

Serializable THREE.js Quaternion

• Quaternion
• Quaternion

Constructors

constructor

• new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion
• Parameters

• Optional x: number

x coordinate

• Optional y: number

y coordinate

• Optional z: number

z coordinate

• Optional w: number

w coordinate

Properties

_onChangeCallback

_onChangeCallback: () => void

• (): void
• Returns void

isQuaternion: true

w: number

x: number

y: number

z: number

Methods

_onChange

• _onChange(callback: () => void): Quaternion
• Parameters

• callback: () => void
• (): void

angleTo

• angleTo(q: Quaternion): number

conjugate

• conjugate(): Quaternion

copy

• Copies values of q to this quaternion.

dot

• dot(v: Quaternion): number

equals

• equals(v: Quaternion): boolean

fromArray

• fromArray(array: number[] | ArrayLike<number>, offset?: number): Quaternion
• Sets this quaternion's x, y, z and w value from the provided array or array-like.

Parameters

• array: number[] | ArrayLike<number>

the source array or array-like.

• Optional offset: number

(optional) offset into the array. Default is 0.

identity

• identity(): Quaternion

inverse

• inverse(): Quaternion
• deprecated

invert

• invert(): Quaternion
• Inverts this quaternion.

length

• length(): number
• Computes length of this quaternion.

lengthSq

• lengthSq(): number

multiply

• multiply(q: Quaternion): Quaternion
• Multiplies this quaternion by b.

multiplyQuaternions

• multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion

multiplyVector3

• multiplyVector3(v: any): any
• deprecated

normalize

• normalize(): Quaternion
• Normalizes this quaternion.

premultiply

• premultiply(q: Quaternion): Quaternion

rotateTowards

• rotateTowards(q: Quaternion, step: number): Quaternion

set

• set(x: number, y: number, z: number, w: number): Quaternion
• Sets values of this quaternion.

setFromAxisAngle

• setFromAxisAngle(axis: Vector3, angle: number): Quaternion

setFromEuler

• setFromEuler(euler: Euler): Quaternion
• Sets this quaternion from rotation specified by Euler angles.

setFromRotationMatrix

• setFromRotationMatrix(m: Matrix4): Quaternion

setFromUnitVectors

• setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion

slerp

• slerp(qb: Quaternion, t: number): Quaternion

toArray

• toArray(array?: number[], offset?: number): number[]
• toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>
• Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

Parameters

• Optional array: number[]

(optional) array to store the quaternion to. If this is not provided, a new array will be created.

• Optional offset: number

(optional) optional offset into the array.

Returns number[]

The created or provided array.

• Copies x, y, z and w into the provided array-like.

Parameters

• array: ArrayLike<number>

array-like to store the quaternion to.

• Optional offset: number

(optional) optional offset into the array.

Returns ArrayLike<number>

The provided array-like.

toEuler

• Convert the quaternion to euler angles

Parameters

• Optional order: EulerOrder

Euler order

Returns Euler

Converted euler

Static fromAxisAngle

• Convert axis angle rotation to quaternion

Parameters

• axis: { angle?: number; unit?: AngleUnit; x: number; y: number; z: number }

Axis-angle rotation

Returns Quaternion

Serializable quaternion

Static fromEuler

• Convert euler angles to quaternion

Parameters

• euler: Vector3

Euler vector

Returns Quaternion

Serializable quaternion

Static fromRotationMatrix

• Convert rotation matrix to quaternion

Parameters

• matrix: Matrix4

Rotation matrix

Returns Quaternion

Serializable quaternion

Static fromThreeJS

• fromThreeJS(threeQuaternion: Quaternion): Quaternion
• Convert a threejs quaternion to serializable quaternion

Parameters

• threeQuaternion: Quaternion

ThreeJS created quaternion

Returns Quaternion

Serializable quaternion

Static multiplyQuaternionsFlat

• multiplyQuaternionsFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number): number[]

Static slerp

• slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion

Static slerpFlat

• slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion