Quaternion

clay. Quaternion

# new Quaternion(x, y, z, w)

Source:
Parameters:
Name Type Description
x number
y number
z number
w number

Members

# _dirty :boolean

Source:

Dirty flag is used by the Node to determine if the matrix is updated to latest

Type:
  • boolean

# array :Float32Array

Source:

Storage of Quaternion, read and write of x, y, z, w will change the values in array All methods also operate on the array instead of x, y, z, w components

Type:
  • Float32Array

# fromMat4

Source:

Set from the given 4x4 rotation matrix The 4th column and 4th row will be droped

# w :number

Source:
Type:
  • number

# x :number

Source:
Type:
  • number

# y :number

Source:
Type:
  • number

# z :number

Source:
Type:
  • number

Methods

# (static) add(out, a, b) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
b clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) calculateW(out, a) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) conjugate(out, a) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) copy(out, b) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
b clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) dot(a, b) → {number}

Source:
Parameters:
Name Type Description
a clay.Quaternion
b clay.Quaternion
Returns:
Type
number

# (static) fromEuler(out, v, order)

Source:

Set quaternion from euler

Parameters:
Name Type Description
out clay.Quaternion
v clay.Vector3
order String

# (static) fromMat3(out, m) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
m clay.Matrix3
Returns:
Type
clay.Quaternion

# (static) identity(out) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) invert(out, a) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) len(a) → {number}

Source:
Parameters:
Name Type Description
a clay.Quaternion
Returns:
Type
number

# (static) lerp(out, a, b, t) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
b clay.Quaternion
t number
Returns:
Type
clay.Quaternion

# (static) mul(out, a, b) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
b clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) multiply(out, a, b) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
b clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) normalize(out, a) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
Returns:
Type
clay.Quaternion

# (static) rotateX(out, a, rad) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
rad number
Returns:
Type
clay.Quaternion

# (static) rotateY(out, a, rad) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
rad number
Returns:
Type
clay.Quaternion

# (static) rotateZ(out, a, rad) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
rad number
Returns:
Type
clay.Quaternion

# (static) rotationTo(out, a, b) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Vector3
b clay.Vector3
Returns:
Type
clay.Quaternion

# (static) set(out, x, y, z, w) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
x number
y number
z number
w number
Returns:
Type
clay.Quaternion

# (static) setAxes(out, view, right, up) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
view clay.Vector3
right clay.Vector3
up clay.Vector3
Returns:
Type
clay.Quaternion

# (static) setAxisAngle(out, axis, rad) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
axis clay.Vector3
rad number
Returns:
Type
clay.Quaternion

# (static) slerp(out, a, b, t) → {clay.Quaternion}

Source:
Parameters:
Name Type Description
out clay.Quaternion
a clay.Quaternion
b clay.Quaternion
t number
Returns:
Type
clay.Quaternion

# (static) sqrLen(a) → {number}

Source:
Parameters:
Name Type Description
a clay.Quaternion
Returns:
Type
number

# (static) squaredLength(a) → {number}

Source:
Parameters:
Name Type Description
a clay.Quaternion
Returns:
Type
number

# add(b) → {clay.Quaternion}

Source:

Add b to self

Parameters:
Name Type Description
b clay.Quaternion
Returns:
Type
clay.Quaternion

# calculateW() → {clay.Quaternion}

Source:

Calculate the w component from x, y, z component

Returns:
Type
clay.Quaternion

# clone() → {clay.Quaternion}

Source:

Clone a new Quaternion

Returns:
Type
clay.Quaternion

# conjugate() → {clay.Quaternion}

Source:

Calculates the conjugate of self If the quaternion is normalized, this function is faster than invert and produces the same result.

Returns:
Type
clay.Quaternion

# copy(b) → {clay.Quaternion}

Source:

Copy from b

Parameters:
Name Type Description
b clay.Quaternion
Returns:
Type
clay.Quaternion

# dot(b) → {number}

Source:

Dot product of self and b

Parameters:
Name Type Description
b clay.Quaternion
Returns:
Type
number

# fromEuler(v, order)

Source:

Set from euler

Parameters:
Name Type Description
v clay.Vector3
order String

# fromMat3(m) → {clay.Quaternion}

Source:

Set from the given 3x3 rotation matrix

Parameters:
Name Type Description
m clay.Matrix3
Returns:
Type
clay.Quaternion

# identity() → {clay.Quaternion}

Source:

Set to identity quaternion

Returns:
Type
clay.Quaternion

# invert() → {clay.Quaternion}

Source:

Invert self

Returns:
Type
clay.Quaternion

# len() → {number}

Source:

Alias of length

Returns:
Type
number

# length() → {number}

Source:

Calculate the length

Returns:
Type
number

# lerp(a, b, t) → {clay.Quaternion}

Source:

Linear interpolation between a and b

Parameters:
Name Type Description
a clay.Quaternion
b clay.Quaternion
t number
Returns:
Type
clay.Quaternion

# mul(b) → {clay.Quaternion}

Source:

Alias for multiply

Parameters:
Name Type Description
b clay.Quaternion
Returns:
Type
clay.Quaternion

# mulLeft(a) → {clay.Quaternion}

Source:

Alias for multiplyLeft

Parameters:
Name Type Description
a clay.Quaternion
Returns:
Type
clay.Quaternion

# multiply(b) → {clay.Quaternion}

Source:

Mutiply self and b

Parameters:
Name Type Description
b clay.Quaternion
Returns:
Type
clay.Quaternion

# multiplyLeft(a) → {clay.Quaternion}

Source:

Mutiply a and self Quaternion mutiply is not commutative, so the result of mutiplyLeft is different with multiply.

Parameters:
Name Type Description
a clay.Quaternion
Returns:
Type
clay.Quaternion

# normalize() → {clay.Quaternion}

Source:

Normalize self

Returns:
Type
clay.Quaternion

# rotateX(rad) → {clay.Quaternion}

Source:

Rotate self by a given radian about X axis

Parameters:
Name Type Description
rad number
Returns:
Type
clay.Quaternion

# rotateY(rad) → {clay.Quaternion}

Source:

Rotate self by a given radian about Y axis

Parameters:
Name Type Description
rad number
Returns:
Type
clay.Quaternion

# rotateZ(rad) → {clay.Quaternion}

Source:

Rotate self by a given radian about Z axis

Parameters:
Name Type Description
rad number
Returns:
Type
clay.Quaternion

# rotationTo(a, b) → {clay.Quaternion}

Source:

Sets self to represent the shortest rotation from Vector3 a to Vector3 b. a and b needs to be normalized

Parameters:
Name Type Description
a clay.Vector3
b clay.Vector3
Returns:
Type
clay.Quaternion

# set(x, y, z, w) → {clay.Quaternion}

Source:

Set x, y and z components

Parameters:
Name Type Description
x number
y number
z number
w number
Returns:
Type
clay.Quaternion

# setArray(arr) → {clay.Quaternion}

Source:

Set x, y, z and w components from array

Parameters:
Name Type Description
arr Float32Array | Array.<number>
Returns:
Type
clay.Quaternion

# setAxes(view, right, up) → {clay.Quaternion}

Source:

Sets self with values corresponding to the given axes

Parameters:
Name Type Description
view clay.Vector3
right clay.Vector3
up clay.Vector3
Returns:
Type
clay.Quaternion

# setAxisAngle(axis, rad) → {clay.Quaternion}

Source:

Sets self with a rotation axis and rotation angle

Parameters:
Name Type Description
axis clay.Vector3
rad number
Returns:
Type
clay.Quaternion

# slerp(a, b, t) → {clay.Quaternion}

Source:

Perform spherical linear interpolation between a and b

Parameters:
Name Type Description
a clay.Quaternion
b clay.Quaternion
t number
Returns:
Type
clay.Quaternion

# sqrLen() → {number}

Source:

Alias for squaredLength

Returns:
Type
number

# squaredLength() → {number}

Source:

Squared length of self

Returns:
Type
number