Skip to content

Class: Quaternion

Functions

NameDescription
.new()
.new(w,x,y,z)
.newAngleAxis(angle,axis)
.newIdentity()
.newRandom()

Methods

NameDescription
:__add(other)
:__div(other)
:__eq(other)
:__le(other)
:__lt(other)
:__mul(other)
:__sub(other)
:__unm()
:angle()
:axis()
:conjugate()
:dot(other)
:eulerAngles()Returns euler angles, pitch as x, yaw as y, roll as z.
:inverse()
:isinf()Returns true if x holds a positive infinity or negative infinity
:isnan()Returns true if x holds a NaN (not a number)
:length()
:lerp(other,a)
:mat3Cast()
:mat4Cast()
:normalized()
:pitch()
:roll()
:rotate(angle,axis)Returns a new rotated quaternion
:slerp(other,a)
:yaw()

Fields

NameTypeDescription
wnumber
xnumber
ynumber
znumber

Function declarations

Function: new

lua
function Quaternion.new() end

Returns:

Function: new

lua
function Quaternion.new(
    w,
    x,
    y,
    z
) end

Parameters:

  • w (number)
  • x (number)
  • y (number)
  • z (number)

Returns:

Function: newAngleAxis

lua
function Quaternion.newAngleAxis(
    angle,
    axis
) end

Parameters:

  • angle (number) - Angle in radians
  • axis (Vector3f)

Returns:

Function: newIdentity

lua
function Quaternion.newIdentity() end

Returns:

Function: newRandom

lua
function Quaternion.newRandom() end

Returns:

Method declarations

Method: __add

lua
function Quaternion:__add(
    other
) end

Parameters:

Returns:

Method: __div

lua
function Quaternion:__div(
    other
) end

Parameters:

Returns:

  • number|Quaternion

Method: __eq

lua
function Quaternion:__eq(
    other
) end

Parameters:

Returns:

Method: __le

lua
function Quaternion:__le(
    other
) end

Parameters:

Returns:

  • boolean

Method: __lt

lua
function Quaternion:__lt(
    other
) end

Parameters:

Returns:

  • boolean

Method: __mul

lua
function Quaternion:__mul(
    other
) end

Parameters:

Returns:

  • number|Quaternion

Method: __sub

lua
function Quaternion:__sub(
    other
) end

Parameters:

Returns:

Method: __unm

lua
function Quaternion:__unm() end

Returns:

Method: angle

lua
function Quaternion:angle() end

Returns:

  • number

Method: axis

lua
function Quaternion:axis() end

Returns:

Method: conjugate

lua
function Quaternion:conjugate() end

Returns:

Method: dot

lua
function Quaternion:dot(
    other
) end

Parameters:

Returns:

  • number

Method: eulerAngles

Returns euler angles, pitch as x, yaw as y, roll as z. The result is expressed in radians.

lua
function Quaternion:eulerAngles() end

Returns:

Method: inverse

lua
function Quaternion:inverse() end

Returns:

Method: isinf

Returns true if x holds a positive infinity or negative infinity representation in the underlying implementation's set of floating point representations. Returns false otherwise, including for implementations with no infinity

lua
function Quaternion:isinf() end

Returns:

Method: isnan

Returns true if x holds a NaN (not a number) representation in the underlying implementation's set of floating point representations. Returns false otherwise, including for implementations with no NaN representations.

lua
function Quaternion:isnan() end

Returns:

Method: length

lua
function Quaternion:length() end

Returns:

  • number

Method: lerp

lua
function Quaternion:lerp(
    other,
    a
) end

Parameters:

  • other (Quaternion)
  • a (number) - Interpolation factor

Returns:

Method: mat3Cast

lua
function Quaternion:mat3Cast() end

Returns:

Method: mat4Cast

lua
function Quaternion:mat4Cast() end

Returns:

Method: normalized

lua
function Quaternion:normalized() end

Returns:

Method: pitch

lua
function Quaternion:pitch() end

Returns:

  • number

Method: roll

lua
function Quaternion:roll() end

Returns:

  • number

Method: rotate

Returns a new rotated quaternion

lua
function Quaternion:rotate(
    angle,
    axis
) end

Parameters:

  • angle (number) - Angle in radians
  • axis (Vector3f) - Axis of rotation

Returns:

Method: slerp

lua
function Quaternion:slerp(
    other,
    a
) end

Parameters:

  • other (Quaternion)
  • a (number) - Interpolation factor

Returns:

Method: yaw

lua
function Quaternion:yaw() end

Returns:

  • number

Field declarations

Field: w

Type: number

Field: x

Type: number

Field: y

Type: number

Field: z

Type: number