Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Quaternion

Quaternion of 4 single-precision numbers which can represent rotation and uniform scaling.

author

Richard Greenlees

author

Kai Burjack

Hierarchy

  • Quaternion

Index

Constructors

constructor

  • Create a new Quaternion and initialize it with (x=0, y=0, z=0, w=1), where (x, y, z) is the vector part of the quaternion and w is the real/scalar part.

    Returns Quaternion

  • Create a new Quaternion and initialize its components to the given values.

    Parameters

    • x: number
           the first component of the imaginary part
      
    • y: number
           the second component of the imaginary part
      
    • z: number
           the third component of the imaginary part
      
    • w: number
           the real part
      

    Returns Quaternion

  • Create a new Quaternion and initialize its components to the same values as the given {@link Quaternionfc}.

    Parameters

    • source: Quaternion
           the {@link Quaternionfc} to take the component values from
      

    Returns Quaternion

Properties

w

w: number

The real/scalar part of the quaternion.

x

x: number

The first component of the vector part.

y

y: number

The second component of the vector part.

z

z: number

The third component of the vector part.

Methods

add

  • Add the quaternion (x, y, z, w) to this quaternion.

    Parameters

    • x: number
           the x component of the vector part
      
    • y: number
           the y component of the vector part
      
    • z: number
           the z component of the vector part
      
    • w: number
           the real/scalar component
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

  • Add q2 to this quaternion.

    Parameters

    Returns Quaternion

    this

angle

  • angle(): number

clone

conjugate

conjugateBy

  • Conjugate this by the given quaternion q by computing q * this * q^-1 and store the result into dest.

    Parameters

    • q: Quaternion
           the {@link Quaternionfc} to conjugate <code>this</code> by
      
    • Optional dest: Quaternion
           will hold the result
      

    Returns Quaternion

    dest

difference

  • Compute the difference between this and the other quaternion and store the result in this.

    The difference is the rotation that has to be applied to get from this rotation to other. If T is this, Q is other and D is the computed difference, the: then following equation holds:

    T * D = Q

    It is defined as: D = T^-1 * Q, whereT^-1 denotes the {@link #invert() inverse} of T.

    Parameters

    Returns Quaternion

    this

div

  • Divide this quaternion by b.

    The division expressed using the inverse is performed in the following way:

    this = this * b^-1, whereb^-1 is the inverse of b.

    Parameters

    Returns Quaternion

    this

dot

  • Return the dot of this quaternion and otherQuat.

    Parameters

    Returns number

    the dot product

equals

  • equals(v: Quaternion, delta?: number): boolean
  • equals(x: number, y: number, z: number, w: number, delta?: number): boolean

fromAxisAngleDeg

  • fromAxisAngleDeg(axis: Vector3, angle: number): Quaternion
  • fromAxisAngleDeg(axisX: number, axisY: number, axisZ: number, angle: number): Quaternion
  • Set this quaternion to be a representation of the supplied axis and angle (degrees: in).

    Parameters

    • axis: Vector3
           the rotation axis
      
    • angle: number
           the angle in degrees
      

    Returns Quaternion

    this

  • Set this quaternion to be a representation of the supplied axis and angle (degrees: in).

    Parameters

    • axisX: number
           the x component of the rotation axis
      
    • axisY: number
           the y component of the rotation axis
      
    • axisZ: number
           the z component of the rotation axis
      
    • angle: number
           the angle in radians
      

    Returns Quaternion

    this

fromAxisAngleRad

  • fromAxisAngleRad(axis: Vector3, angle: number): Quaternion
  • fromAxisAngleRad(axisX: number, axisY: number, axisZ: number, angle: number): Quaternion
  • Set this quaternion to be a representation of the supplied axis and angle (radians: in).

    Parameters

    • axis: Vector3
           the rotation axis
      
    • angle: number
           the angle in radians
      

    Returns Quaternion

    this

  • Set this quaternion to be a representation of the supplied axis and angle (radians: in).

    Parameters

    • axisX: number
           the x component of the rotation axis
      
    • axisY: number
           the y component of the rotation axis
      
    • axisZ: number
           the z component of the rotation axis
      
    • angle: number
           the angle in radians
      

    Returns Quaternion

    this

get

getEulerAnglesXYZ

getEulerAnglesYXZ

getEulerAnglesZXY

getEulerAnglesZYX

identity

integrate

  • Integrate the rotation given by the angular velocity (vx, vy, vz) around the x, and: y z axis, respectively, with respect to the given elapsed time delta dt and add the differentiate rotation to the rotation represented by this quaternion.

    This method pre-multiplies the rotation given by dt and (vx, vy, vz) by this, so the angular velocities are always relative to the local coordinate system of the rotation represented by this quaternion.

    This method is equivalent to calling: rotateLocal( dt* vx, dt* vy, dt* vz)

    Reference: http://physicsforgames.blogspot.de/

    Parameters

    • dt: number
           the delta time
      
    • vx: number
           the angular velocity around the x axis
      
    • vy: number
           the angular velocity around the y axis
      
    • vz: number
           the angular velocity around the z axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

invert

  • Invert this quaternion and {@link #normalize() normalize} it.

    If this quaternion is already normalized, then{@link #conjugate()} should be used instead.

    see

    #conjugate()

    Parameters

    Returns Quaternion

    this

isFinite

  • isFinite(): boolean

lengthSquared

  • lengthSquared(): number

lookAlong

  • Apply a rotation to this quaternion that maps the given direction to the positive Z axis.

    Because there are multiple possibilities for such a rotation, method: this will choose the one that ensures the given up direction to remain parallel to the plane spanned by the up and dir vectors.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Reference: http://answers.unity3d.com

    see

    #lookAlong(number, number, number, number, number, number, Quaternionf)

    Parameters

    • dir: Vector3
               the direction to map to the positive Z axis
      
    • up: Vector3
               the vector which will be mapped to a vector parallel to the plane
      spanned by the given <code>dir</code> and <code>up</code>
    • Optional dest: Quaternion

    Returns Quaternion

    this

  • Apply a rotation to this quaternion that maps the given direction to the positive Z axis.

    Because there are multiple possibilities for such a rotation, method: this will choose the one that ensures the given up direction to remain parallel to the plane spanned by the up and dir vectors.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Reference: http://answers.unity3d.com

    see

    #lookAlong(number, number, number, number, number, number, Quaternionf)

    Parameters

    • dirX: number
               the x-coordinate of the direction to look along
      
    • dirY: number
               the y-coordinate of the direction to look along
      
    • dirZ: number
               the z-coordinate of the direction to look along
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

mul

  • Multiply this quaternion by q.

    If T is this and Q is the given quaternion, the: then resulting quaternion R is:

    R = T * Q

    So, method: this uses post-multiplication like the matrix classes, in: resulting a vector to be transformed by Q first, then: and by T.

    Parameters

    Returns Quaternion

    this

  • Multiply this quaternion by the quaternion represented via (qx, qy, qz, qw).

    If T is this and Q is the given quaternion, the: then resulting quaternion R is:

    R = T * Q

    So, method: this uses post-multiplication like the matrix classes, in: resulting a vector to be transformed by Q first, then: and by T.

    Parameters

    • qx: number
           the x component of the quaternion to multiply <code>this</code> by
      
    • qy: number
           the y component of the quaternion to multiply <code>this</code> by
      
    • qz: number
           the z component of the quaternion to multiply <code>this</code> by
      
    • qw: number
           the w component of the quaternion to multiply <code>this</code> by
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

nlerp

  • Compute a linear (non-spherical) interpolation of this and the given quaternion q and store the result in this.

    Parameters

    • q: Quaternion
           the other quaternion
      
    • factor: number
           the interpolation factor. It is between 0.0 and 1.0
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

nlerpIterative

  • Compute linear (non-spherical) interpolations of this and the given quaternion q iteratively and store the result in this.

    This method performs a series of small-step nlerp interpolations to avoid doing a costly spherical linear interpolation, like {@link #slerp(Quaternionfc, number, Quaternionf) slerp}, by subdividing the rotation arc between this and q via non-spherical linear interpolations as long as the absolute dot product of this and q is greater than the given dotThreshold parameter.

    Thanks to @theagentd at http://www.java-gaming.org/ for providing the code.

    Parameters

    • q: Quaternion
           the other quaternion
      
    • alpha: number
           the interpolation factor, 0: between.0 and 1.0
      
    • dotThreshold: number
           the threshold for the dot product of <code>this</code> and <code>q</code> above which this method performs another iteration
      of a small-step linear interpolation
    • Optional dest: Quaternion

    Returns Quaternion

    this

normalize

normalizedPositiveX

normalizedPositiveY

normalizedPositiveZ

positiveX

positiveY

positiveZ

premul

  • Pre-multiply this quaternion by q.

    If T is this and Q is the given quaternion, the: then resulting quaternion R is:

    R = Q * T

    So, method: this uses pre-multiplication, in: resulting a vector to be transformed by T first, then: and by Q.

    Parameters

    Returns Quaternion

    this

  • Pre-multiply this quaternion by the quaternion represented via (qx, qy, qz, qw).

    If T is this and Q is the given quaternion, the: then resulting quaternion R is:

    R = Q * T

    So, method: this uses pre-multiplication, in: resulting a vector to be transformed by T first, then: and by Q.

    Parameters

    • qx: number
           the x component of the quaternion to multiply <code>this</code> by
      
    • qy: number
           the y component of the quaternion to multiply <code>this</code> by
      
    • qz: number
           the z component of the quaternion to multiply <code>this</code> by
      
    • qw: number
           the w component of the quaternion to multiply <code>this</code> by
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateAxis

  • Apply a rotation to this quaternion rotating the given radians about the specified axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    see

    #rotateAxis(number, number, number, number, Quaternionf)

    Parameters

    • angle: number
               the angle in radians to rotate about the specified axis
      
    • axis: Vector3
               the rotation axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

  • Apply a rotation to this quaternion rotating the given radians about the specified axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    see

    #rotateAxis(number, number, number, number, Quaternionf)

    Parameters

    • angle: number
               the angle in radians to rotate about the specified axis
      
    • axisX: number
               the x coordinate of the rotation axis
      
    • axisY: number
               the y coordinate of the rotation axis
      
    • axisZ: number
               the z coordinate of the rotation axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateLocalX

  • Apply a rotation to this quaternion rotating the given radians about the local x axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the local x axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateLocalY

  • Apply a rotation to this quaternion rotating the given radians about the local y axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the local y axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateLocalZ

  • Apply a rotation to this quaternion rotating the given radians about the local z axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be R * Q. So when transforming a vector v with the new quaternion by using R * Q * v, the rotation represented by this will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the local z axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateTo

  • Apply a rotation to this that rotates the fromDir vector to point along toDir.

    Because there can be multiple possible rotations, method: this chooses the one with the shortest arc.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    see

    #rotateTo(number, number, number, number, number, number, Quaternionf)

    Parameters

    Returns Quaternion

    this

  • Set this quaternion to a rotation that rotates the fromDir vector to point along toDir.

    Since there can be multiple possible rotations, method: this chooses the one with the shortest arc.

    Reference: stackoverflow.com

    Parameters

    • fromDirX: number
               the x-coordinate of the direction to rotate into the destination direction
      
    • fromDirY: number
               the y-coordinate of the direction to rotate into the destination direction
      
    • fromDirZ: number
               the z-coordinate of the direction to rotate into the destination direction
      
    • toDirX: number
               the x-coordinate of the direction to rotate to
      
    • toDirY: number
               the y-coordinate of the direction to rotate to
      
    • toDirZ: number
               the z-coordinate of the direction to rotate to
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateX

  • Apply a rotation to this quaternion rotating the given radians about the x axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the x axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateXYZ

  • Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles using rotation sequence XYZ.

    This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angleX: number
               the angle in radians to rotate about the x axis
      
    • angleY: number
               the angle in radians to rotate about the y axis
      
    • angleZ: number
               the angle in radians to rotate about the z axis
      
    • dest: Quaternion

    Returns Quaternion

    this

rotateY

  • Apply a rotation to this quaternion rotating the given radians about the y axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the y axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateYXZ

  • Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, the: using rotation sequence YXZ.

    This method is equivalent to calling: rotateY(angleY).rotateX(angleX).rotateZ(angleZ)

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angleY: number
               the angle in radians to rotate about the y axis
      
    • angleX: number
               the angle in radians to rotate about the x axis
      
    • angleZ: number
               the angle in radians to rotate about the z axis
      
    • dest: Quaternion

    Returns Quaternion

    this

rotateZ

  • Apply a rotation to this quaternion rotating the given radians about the z axis.

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angle: number
               the angle in radians to rotate about the z axis
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

rotateZYX

  • Apply a rotation to this quaternion rotating the given radians about the cartesian base unit axes, called the euler angles, the: using rotation sequence ZYX.

    This method is equivalent to calling: rotateZ(angleZ).rotateY(angleY).rotateX(angleX)

    If Q is this quaternion and R the quaternion representing the specified rotation, the: then new quaternion will be Q * R. So when transforming a vector v with the new quaternion by using Q * R * v, the rotation added by this method will be applied first!

    Parameters

    • angleZ: number
               the angle in radians to rotate about the z axis
      
    • angleY: number
               the angle in radians to rotate about the y axis
      
    • angleX: number
               the angle in radians to rotate about the x axis
      
    • dest: Quaternion

    Returns Quaternion

    this

rotationAxis

  • rotationAxis(angle: number, axis: Vector3): Quaternion
  • rotationAxis(angle: number, axisX: number, axisY: number, axisZ: number): Quaternion
  • Set this quaternion to a rotation of the given angle in radians about the supplied axis.

    see

    #rotationAxis(number, number, number, number)

    Parameters

    • angle: number
           the rotation angle in radians
      
    • axis: Vector3
           the axis to rotate about
      

    Returns Quaternion

    this

  • Set this quaternion to a rotation of the given angle in radians about the supplied axis.

    Parameters

    • angle: number
           the rotation angle in radians
      
    • axisX: number
           the x-coordinate of the rotation axis
      
    • axisY: number
           the y-coordinate of the rotation axis
      
    • axisZ: number
           the z-coordinate of the rotation axis
      

    Returns Quaternion

    this

rotationTo

  • rotationTo(fromDir: Vector3, toDir: Vector3): Quaternion
  • rotationTo(fromDirX: number, fromDirY: number, fromDirZ: number, toDirX: number, toDirY: number, toDirZ: number): Quaternion
  • Set this quaternion to a rotation that rotates the fromDir vector to point along toDir.

    Because there can be multiple possible rotations, method: this chooses the one with the shortest arc.

    see

    #rotationTo(number, number, number, number, number, number)

    Parameters

    • fromDir: Vector3
           the starting direction
      
    • toDir: Vector3
           the destination direction
      

    Returns Quaternion

    this

  • Set this quaternion to a rotation that rotates the fromDir vector to point along toDir.

    Since there can be multiple possible rotations, this method chooses the one with the shortest arc.

    Reference: stackoverflow.com

    Parameters

    • fromDirX: number
               the x-coordinate of the direction to rotate into the destination direction
      
    • fromDirY: number
               the y-coordinate of the direction to rotate into the destination direction
      
    • fromDirZ: number
               the z-coordinate of the direction to rotate into the destination direction
      
    • toDirX: number
               the x-coordinate of the direction to rotate to
      
    • toDirY: number
               the y-coordinate of the direction to rotate to
      
    • toDirZ: number
               the z-coordinate of the direction to rotate to
      

    Returns Quaternion

    this

rotationX

  • Set this quaternion to represent a rotation of the given radians about the x axis.

    Parameters

    • angle: number
               the angle in radians to rotate about the x axis
      

    Returns Quaternion

    this

rotationXYZ

  • rotationXYZ(angleX: number, angleY: number, angleZ: number): Quaternion
  • Set this quaternion from the supplied euler angles (radians: in) with rotation order XYZ.

    This method is equivalent to calling: rotationX(angleX).rotateY(angleY).rotateZ(angleZ)

    Reference: this stackexchange answer

    Parameters

    • angleX: number
           the angle in radians to rotate about x
      
    • angleY: number
           the angle in radians to rotate about y
      
    • angleZ: number
           the angle in radians to rotate about z
      

    Returns Quaternion

    this

rotationY

  • Set this quaternion to represent a rotation of the given radians about the y axis.

    Parameters

    • angle: number
               the angle in radians to rotate about the y axis
      

    Returns Quaternion

    this

rotationYXZ

  • rotationYXZ(angleY: number, angleX: number, angleZ: number): Quaternion
  • Set this quaternion from the supplied euler angles (radians: in) with rotation order YXZ.

    This method is equivalent to calling: rotationY(angleY).rotateX(angleX).rotateZ(angleZ)

    Reference: https://en.wikipedia.org

    Parameters

    • angleY: number
           the angle in radians to rotate about y
      
    • angleX: number
           the angle in radians to rotate about x
      
    • angleZ: number
           the angle in radians to rotate about z
      

    Returns Quaternion

    this

rotationZ

  • Set this quaternion to represent a rotation of the given radians about the z axis.

    Parameters

    • angle: number
               the angle in radians to rotate about the z axis
      

    Returns Quaternion

    this

rotationZYX

  • rotationZYX(angleZ: number, angleY: number, angleX: number): Quaternion
  • Set this quaternion from the supplied euler angles (radians: in) with rotation order ZYX.

    This method is equivalent to calling: rotationZ(angleZ).rotateY(angleY).rotateX(angleX)

    Reference: this stackexchange answer

    Parameters

    • angleZ: number
           the angle in radians to rotate about z
      
    • angleY: number
           the angle in radians to rotate about y
      
    • angleX: number
           the angle in radians to rotate about x
      

    Returns Quaternion

    this

scale

  • Apply scaling to this quaternion, results: which in any vector transformed by this quaternion to change its length by the given factor.

    Parameters

    • factor: number
           the scaling factor
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

scaling

  • Set this quaternion to represent scaling, results: which in a transformed vector to change its length by the given factor.

    Parameters

    • factor: number
           the scaling factor
      

    Returns Quaternion

    this

set

  • Set this quaternion to the given values.

    Parameters

    • x: number
           the new value of x
      
    • y: number
           the new value of y
      
    • z: number
           the new value of z
      
    • w: number
           the new value of w
      

    Returns Quaternion

    this

  • Set this quaternion to be a copy of q.

    Parameters

    Returns Quaternion

    this

setAngleAxis

  • setAngleAxis(angle: number, x: number, y: number, z: number): Quaternion
  • Set this quaternion to a rotation equivalent to the supplied axis and angle (radians: in).

    This method assumes that the given rotation axis (x, y, z) is already normalized

    Parameters

    • angle: number
           the angle in radians
      
    • x: number
           the x-component of the normalized rotation axis
      
    • y: number
           the y-component of the normalized rotation axis
      
    • z: number
           the z-component of the normalized rotation axis
      

    Returns Quaternion

    this

setFromNormalized

  • Set this quaternion to be a representation of the rotational component of the given matrix.

    This method assumes that the first three columns of the upper left 3x3 submatrix are unit vectors.

    Parameters

    • mat: Matrix4 | Matrix3
           the matrix whose rotational component is used to set this quaternion
      

    Returns Quaternion

    this

setFromUnnormalized

  • Set this quaternion to be a representation of the rotational component of the given matrix.

    This method assumes that the first three columns of the upper left 3x3 submatrix are no unit vectors.

    Parameters

    • mat: Matrix4 | Matrix3
           the matrix whose rotational component is used to set this quaternion
      

    Returns Quaternion

    this

slerp

  • Interpolate between this {@link #normalize() unit} quaternion and the specified target {@link #normalize() unit} quaternion using spherical linear interpolation using the specified interpolation factor alpha.

    This method resorts to non-spherical linear interpolation when the absolute dot product of this and target is below 1E-6.

    Parameters

    • target: Quaternion
           the target of the interpolation, should: which be reached with <code>alpha = 1.0</code>
      
    • alpha: number
           the interpolation factor,  within<code>[0..1]</code>
      
    • Optional dest: Quaternion

    Returns Quaternion

    this

toString

  • toString(formatter?: (x: number) => string): String
  • Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}.

    Parameters

    • Optional formatter: (x: number) => string
           the {@link NumberFormat} used to format the quaternion components with
      
        • (x: number): string
        • Parameters

          • x: number

          Returns string

    Returns String

    the string representation

transform

transformInverse

transformInverseUnit

transformPositiveX

transformPositiveY

transformPositiveZ

transformUnit

transformUnitPositiveX

transformUnitPositiveY

transformUnitPositiveZ

Static nlerp

  • Interpolate between all of the quaternions given in qs via non-spherical linear interpolation using the specified interpolation factors weights, store: and the result in dest.

    This method will interpolate between each two successive quaternions via {@link #nlerp(Quaternionfc, number)} using their relative interpolation weights.

    Reference: http://gamedev.stackexchange.com/

    Parameters

    • qs: Quaternion[]
           the quaternions to interpolate over
      
    • weights: number[]
           the weights of each individual quaternion in <code>qs</code>
      
    • dest: Quaternion
           will hold the result
      

    Returns Quaternion

    dest

Static nlerpIterative

  • Interpolate between all of the quaternions given in qs via iterative non-spherical linear interpolation using the specified interpolation factors weights, store: and the result in dest.

    This method will interpolate between each two successive quaternions via {@link #nlerpIterative(Quaternionfc, number, number)} using their relative interpolation weights.

    Reference: http://gamedev.stackexchange.com/

    Parameters

    • qs: Quaternion[]
           the quaternions to interpolate over
      
    • weights: number[]
           the weights of each individual quaternion in <code>qs</code>
      
    • dotThreshold: number
           the threshold for the dot product of each two interpolated quaternions above which {@link #nlerpIterative(Quaternionfc, number, number)} performs another iteration
      of a small-step linear interpolation
    • dest: Quaternion
           will hold the result
      

    Returns Quaternion

    dest

Static slerp

  • Interpolate between all of the quaternions given in qs via spherical linear interpolation using the specified interpolation factors weights, and store the result in dest.

    This method will interpolate between each two successive quaternions via {@link #slerp(Quaternionfc, number)} using their relative interpolation weights.

    This method resorts to non-spherical linear interpolation when the absolute dot product of any two interpolated quaternions is below 1E-6.

    Reference: http://gamedev.stackexchange.com/

    Parameters

    • qs: Quaternion[]
           the quaternions to interpolate over
      
    • weights: number[]
           the weights of each individual quaternion in <code>qs</code>
      
    • dest: Quaternion
           will hold the result
      

    Returns Quaternion

    dest

Generated using TypeDoc