Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Quaternion

Hierarchy

  • Quaternion

Index

Constructors

constructor

  • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion
  • Creates a new Quaternion from the given floats

    Parameters

    • Optional x: number

      defines the first component (0 by default)

    • Optional y: number

      defines the second component (0 by default)

    • Optional z: number

      defines the third component (0 by default)

    • Optional w: number

      defines the fourth component (1.0 by default)

    Returns Quaternion

Accessors

w

  • get w(): number
  • set w(value: number): any
  • Gets or sets the w coordinate

    Returns number

  • Gets or sets the w coordinate

    Parameters

    • value: number

    Returns any

x

  • get x(): number
  • set x(value: number): any
  • Gets or sets the x coordinate

    Returns number

  • Gets or sets the x coordinate

    Parameters

    • value: number

    Returns any

y

  • get y(): number
  • set y(value: number): any
  • Gets or sets the y coordinate

    Returns number

  • Gets or sets the y coordinate

    Parameters

    • value: number

    Returns any

z

  • get z(): number
  • set z(value: number): any
  • Gets or sets the z coordinate

    Returns number

  • Gets or sets the z coordinate

    Parameters

    • value: number

    Returns any

Methods

addSearch playground for add

  • Adds two quaternions

    Parameters

    Returns Quaternion

    a new quaternion as the addition result of the given one and the current quaternion

addInPlaceSearch playground for addInPlace

  • Add a quaternion to the current one

    Parameters

    Returns Quaternion

    the current quaternion

asArraySearch playground for asArray

  • asArray(): number[]
  • Copy the quaternion to an array

    Returns number[]

    a new array populated with 4 elements from the quaternion coordinates

cloneSearch playground for clone

  • Clone the current quaternion

    Returns Quaternion

    a new quaternion copied from the current one

conjugateSearch playground for conjugate

  • Conjugates in place (1-q) the current quaternion

    Returns Quaternion

    a new quaternion

conjugateInPlaceSearch playground for conjugateInPlace

  • Conjugates in place (1-q) the current quaternion

    Returns Quaternion

    the current updated quaternion

conjugateToRefSearch playground for conjugateToRef

  • Conjugates (1-q) the current quaternion and stores the result in the given quaternion

    Parameters

    Returns Quaternion

    the current quaternion

copyFromSearch playground for copyFrom

  • Copy a quaternion to the current one

    Parameters

    Returns Quaternion

    the updated current quaternion

copyFromFloatsSearch playground for copyFromFloats

  • copyFromFloats(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion with the given float coordinates

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

equalsSearch playground for equals

  • Check if two quaternions are equals

    Parameters

    Returns boolean

    true if the current quaternion and the given one coordinates are strictly equals

equalsWithEpsilonSearch playground for equalsWithEpsilon

  • Gets a boolean if two quaternions are equals (using an epsilon value)

    Parameters

    • otherQuaternion: DeepImmutable<Quaternion>

      defines the other quaternion

    • Optional epsilon: number

      defines the minimal distance to consider equality

    Returns boolean

    true if the given quaternion coordinates are close to the current ones by a distance of epsilon.

fromRotationMatrixSearch playground for fromRotationMatrix

  • Updates the current quaternion from the given rotation matrix values

    Parameters

    Returns Quaternion

    the current updated quaternion

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the class name of the quaternion

    Returns string

    the string "Quaternion"

getHashCodeSearch playground for getHashCode

  • getHashCode(): number
  • Gets a hash code for this quaternion

    Returns number

    the quaternion hash code

lengthSearch playground for length

  • length(): number
  • Gets length of current quaternion

    Returns number

    the quaternion length (float)

multiplySearch playground for multiply

  • Multiplies two quaternions

    Parameters

    Returns Quaternion

    a new quaternion set as the multiplication result of the current one with the given one "q1"

multiplyInPlaceSearch playground for multiplyInPlace

  • Updates the current quaternion with the multiplication of itself with the given one "q1"

    Parameters

    Returns Quaternion

    the currentupdated quaternion

multiplyToRefSearch playground for multiplyToRef

  • Sets the given "result" as the the multiplication result of the current one with the given one "q1"

    Parameters

    Returns Quaternion

    the current quaternion

normalizeSearch playground for normalize

  • Normalize in place the current quaternion

    Returns Quaternion

    the current updated quaternion

scaleSearch playground for scale

  • Multiplies the current quaternion by a scale factor

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    a new quaternion set by multiplying the current quaternion coordinates by the float "scale"

scaleAndAddToRefSearch playground for scaleAndAddToRef

  • Scale the current quaternion values by a factor and add the result to a given quaternion

    Parameters

    • scale: number

      defines the scale factor

    • result: Quaternion

      defines the Quaternion object where to store the result

    Returns Quaternion

    the unmodified current quaternion

scaleInPlaceSearch playground for scaleInPlace

  • Multiplies in place the current quaternion by a scale factor

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    the current modified quaternion

scaleToRefSearch playground for scaleToRef

  • Scale the current quaternion values by a factor and stores the result to a given quaternion

    Parameters

    • scale: number

      defines the scale factor

    • result: Quaternion

      defines the Quaternion object where to store the result

    Returns Quaternion

    the unmodified current quaternion

setSearch playground for set

  • set(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion from the given float coordinates

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

subtractSearch playground for subtract

  • Subtract two quaternions

    Parameters

    Returns Quaternion

    a new quaternion as the subtraction result of the given one from the current one

toEulerAnglesSearch playground for toEulerAngles

  • toEulerAngles(order?: string): Vector3
  • Returns a new Vector3 set with the Euler angles translated from the current quaternion

    Parameters

    • Optional order: string

      is a reserved parameter and is ignored for now

    Returns Vector3

    a new Vector3 containing the Euler angles

toEulerAnglesToRefSearch playground for toEulerAnglesToRef

  • Sets the given vector3 "result" with the Euler angles translated from the current quaternion

    Parameters

    • result: Vector3

      defines the vector which will be filled with the Euler angles

    Returns Quaternion

    the current unchanged quaternion

toRotationMatrixSearch playground for toRotationMatrix

  • Updates the given rotation matrix with the current quaternion values

    Parameters

    • result: Matrix

      defines the target matrix

    Returns Quaternion

    the current unchanged quaternion

toStringSearch playground for toString

  • toString(): string
  • Gets a string representation for the current quaternion

    Returns string

    a string with the Quaternion coordinates

Static AreCloseSearch playground for AreClose

  • Checks if the two quaternions are close to each other

    Parameters

    Returns boolean

    true if the two quaternions are close to each other

Static DotSearch playground for Dot

  • Returns the dot product (float) between the quaternions "left" and "right"

    Parameters

    Returns number

    the dot product

Static FromArraySearch playground for FromArray

  • Creates a new quaternion from data stored into an array

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      defines the data source

    • Optional offset: number

      defines the offset in the source array where the data starts

    Returns Quaternion

    a new quaternion

Static FromArrayToRefSearch playground for FromArrayToRef

  • Updates the given quaternion "result" from the starting index of the given array.

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      the array to pull values from

    • offset: number

      the offset into the array to start at

    • result: Quaternion

      the quaternion to store the result in

    Returns void

Static FromEulerAnglesSearch playground for FromEulerAngles

  • FromEulerAngles(x: number, y: number, z: number): Quaternion
  • Create a quaternion from Euler rotation angles

    Parameters

    • x: number

      Pitch

    • y: number

      Yaw

    • z: number

      Roll

    Returns Quaternion

    the new Quaternion

Static FromEulerAnglesToRefSearch playground for FromEulerAnglesToRef

  • Updates a quaternion from Euler rotation angles

    Parameters

    • x: number

      Pitch

    • y: number

      Yaw

    • z: number

      Roll

    • result: Quaternion

      the quaternion to store the result

    Returns Quaternion

    the updated quaternion

Static FromEulerVectorSearch playground for FromEulerVector

  • Create a quaternion from Euler rotation vector

    Parameters

    Returns Quaternion

    the new Quaternion

Static FromEulerVectorToRefSearch playground for FromEulerVectorToRef

  • Updates a quaternion from Euler rotation vector

    Parameters

    Returns Quaternion

    the updated quaternion

Static FromRotationMatrixSearch playground for FromRotationMatrix

  • Creates a new quaternion from a rotation matrix

    Parameters

    Returns Quaternion

    a new quaternion created from the given rotation matrix values

Static FromRotationMatrixToRefSearch playground for FromRotationMatrixToRef

  • Updates the given quaternion with the given rotation matrix values

    Parameters

    Returns void

Static HermiteSearch playground for Hermite

Static IdentitySearch playground for Identity

  • Creates an identity quaternion

    Returns Quaternion

    the identity quaternion

Static InverseSearch playground for Inverse

  • Inverse a given quaternion

    Parameters

    Returns Quaternion

    a new quaternion as the inverted current quaternion

Static InverseToRefSearch playground for InverseToRef

  • Inverse a given quaternion

    Parameters

    • q: Quaternion

      defines the source quaternion

    • result: Quaternion

      the quaternion the result will be stored in

    Returns Quaternion

    the result quaternion

Static IsIdentitySearch playground for IsIdentity

  • Gets a boolean indicating if the given quaternion is identity

    Parameters

    Returns boolean

    true if the quaternion is identity

Static RotationAlphaBetaGammaSearch playground for RotationAlphaBetaGamma

  • RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    Returns Quaternion

    the new quaternion

Static RotationAlphaBetaGammaToRefSearch playground for RotationAlphaBetaGammaToRef

  • RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    • result: Quaternion

      defines the target quaternion

    Returns void

Static RotationAxisSearch playground for RotationAxis

  • Creates a quaternion from a rotation around an axis

    Parameters

    Returns Quaternion

    a new quaternion created from the given axis (Vector3) and angle in radians (float)

Static RotationAxisToRefSearch playground for RotationAxisToRef

  • Creates a rotation around an axis and stores it into the given quaternion

    Parameters

    Returns Quaternion

    the target quaternion

Static RotationQuaternionFromAxisSearch playground for RotationQuaternionFromAxis

  • Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)

    Parameters

    Returns Quaternion

    the new quaternion

Static RotationQuaternionFromAxisToRefSearch playground for RotationQuaternionFromAxisToRef

  • Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion

    Parameters

    Returns void

Static RotationYawPitchRollSearch playground for RotationYawPitchRoll

  • RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion
  • Creates a new quaternion from the given Euler float angles (y, x, z)

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    Returns Quaternion

    the new quaternion

Static RotationYawPitchRollToRefSearch playground for RotationYawPitchRollToRef

  • RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void
  • Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    • result: Quaternion

      defines the target quaternion

    Returns void

Static SlerpSearch playground for Slerp

  • Interpolates between two quaternions

    Parameters

    Returns Quaternion

    the new interpolated quaternion

Static SlerpToRefSearch playground for SlerpToRef

  • Interpolates between two quaternions and stores it into a target quaternion

    Parameters

    Returns void

Static ZeroSearch playground for Zero

  • Creates an empty quaternion

    Returns Quaternion

    a new quaternion set to (0.0, 0.0, 0.0)

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method