Math.Quaternion

(in ./Carbon/Math/Quaternion.lua)

Provides a quaternion object for representing rotations.

The loose form of a Quaternion, loose<Quaternion> is of the form (x, y, z, w)

Inherits Math.Vector<4>


Methods

class public Quaternion:NewFromAngles(Vector3 angles)

Returns Quaternion

object public Quaternion:InitFromAngles(Vector3 angles)

Returns void

  • required angles: A Vector3 containing the angles to convert.

Converts a Vector3 containing Euler angles into a Quaternion.


class public Quaternion:NewFromLooseAngles(number x, number y, number z)

Returns Quaternion

object public Quaternion:InitFromLooseAngles(number x, number y, number z)

Returns void

  • required x: The x component of the angles.
  • required y: The y component of the angles.
  • required z: The z component of the angles.

Converts a loose<Vector3> containing Euler angles into a Quaternion.


class public Quaternion:NewLooseFromAngles(Vector3 angles)

Returns loose<Quaternion>

  • required angles: A Vector3 containing the angles to convert.

Converts a Vector3 containing Euler angles into a loose Quaternion.


class public Quaternion:NewLooseFromLooseAngles(number x, number y, number z)

Returns loose<Quaternion>

  • required x: The x component of the angles.
  • required y: The y component of the angles.
  • required z: The z component of the angles.

Converts a loose<Vector3> containing Euler angles into a loose Quaternion.


class public Quaternion:LooseMultiplyLooseLoose(loose<Quaternion> a, loose<Quaternion> b)

Returns loose<Quaternion>

  • required a: The left operand on the multiply.
  • required b: The right operand on the multiply.

Multiplies two loose quaternions together and returns the result in loose form.


object public Quaternion:LooseMultiplyLoose(loose<Quaternion> quaternion)

Returns loose<Quaternion>

  • required quaternion: The quaternion to multiply with.

Multiplies the quaternion with a loose Quaternion, yielding a loose<Quaternion>.


object public Quaternion:Slerp(Quaternion other, number t, [Quaternion out])

Returns self

  • required other: The Quaternion to slerp with.
  • required t: A number, normally on [0, 1], that determines the mixing ratio of the quaternions.
  • optional out: Where to put the resulting slerped Quaternion.

Performs a Quaternion slerp (spherical interpolation).


object public Quaternion:Conjugate([Quaternion out])

Returns Quaternion

  • optional out: Where to put the resulting data.

Returns the conjugate of the Quaternion, (-i, -j, -k, w).


object public Quaternion:Conjugate!()

Returns Quaternion

object public Quaternion:ConjugateInPlace()

Returns Quaternion

Conjugates the Quaternion in-place.


object public Quaternion:LooseConjugate()

Returns loose<Quaternion>

Returns the conjugate of the quaternion in loose form.


object public Quaternion:Multiply(Quaternion other, [Quaternion out])

Returns Quaternion

  • required other: The quaternion to multiply with.
  • optional out: Where to put the resulting data.

Multiplies the quaternion with another Quaternion.


object public Quaternion:Multiply!(Quaternion other)

Returns self

object public Quaternion:MultiplyInPlace(Quaternion other)

Returns self

  • required other: The quaternion to multiply with.

Multiplies the quaternion with another Quaternion and puts the result in the first Quaternion.


object public Quaternion:MultiplyLoose(loose<Quaternion> quaternion, [Quaternion out])

Returns Quaternion

  • required quaternion: The loose quaternion to multiply with.
  • optional out: Where to put the resulting data.

Multiplies the quaternion with a loose Quaternion.


object public Quaternion:MultiplyLoose!(loose<Quaternion> quaternion)

Returns Quaternion

  • required quaternion: The loose quaternion to multiply with.

Multiplies this quaternion with another loose Quaternion in-place.


object public Quaternion:Slerp!(Quaternion other, number t)

Returns self

object public Quaternion:SlerpInPlace(Quaternion other, number t)

Returns self

  • required other: The Quaternion to slerp with.
  • required t: A number, normally on [0, 1], that determines the mixing ratio of the quaternions.

Performs a Quaternion slerp (spherical interpolation) in place.


object public Quaternion:TransformVector(Vector3 vec, [Vector3 out])

Returns self

  • required vec: The vector to rotate.
  • optional out: Where to put the resulting data.

Transforms a vector by rotating it.


Properties

[none]