Constructors

  • Create one instance of this class

    Parameters

    • Optionalx: number

      Input x coordinate

    • Optionaly: number

      Input y coordinate

    • Optionalz: number

      Input z coordinate

    • Optionalw: number

      Input w coordinate

    Returns AcGeQuaternion

Accessors

  • get w(): number
  • W cooridinate

    Returns number

  • set w(value: number): void
  • Parameters

    • value: number

    Returns void

  • get x(): number
  • X cooridinate

    Returns number

  • set x(value: number): void
  • Parameters

    • value: number

    Returns void

  • get y(): number
  • Y cooridinate

    Returns number

  • set y(value: number): void
  • Parameters

    • value: number

    Returns void

  • get z(): number
  • Z cooridinate

    Returns number

  • set z(value: number): void
  • Parameters

    • value: number

    Returns void

Methods

  • Parameters

    • callback: () => void

    Returns this

  • Returns void

  • Returns Generator<number, void, unknown>

  • Return the angle between this quaternion and quaternion q in radians.

    Parameters

    Returns number

    Return the angle between this quaternion and quaternion q in radians.

  • Create a new quaternion with identical x, y, z and w properties to this one.

    Returns AcGeQuaternion

    Return cloned instance

  • Return the rotational conjugate of this quaternion. The conjugate of a quaternion represents the same rotation in the opposite direction about the rotational axis.

    Returns this

    Return this quaternion

  • Copy the x, y, z and w properties of q into this quaternion.

    Parameters

    Returns this

    Return this quaternion

  • Calculate the dot product of quaternions v and this one.

    Parameters

    Returns number

    Return the dot product of quaternions v and this one

  • Compare the x, y, z and w properties of v to the equivalent properties of this quaternion to determine if they represent the same rotation.

    Parameters

    • quaternion: AcGeQuaternion

      Input quaternion that this quaternion will be compared to.

    Returns boolean

    Return true if the specified quaternion and this quaternion represent the same rotation.

  • Set this quaternion's x, y, z and w properties from an array.

    Parameters

    • array: number[]

      Input an array of format (x, y, z, w) used to construct the quaternion.

    • Optionaloffset: number

      Input an optional offset into the array

    Returns this

    Return this quaternion

  • Set this quaternion to the identity quaternion; that is, to the quaternion that represents "no rotation".

    Returns this

    Return this quaternion.

  • Invert this quaternion - calculates the conjugate. The quaternion is assumed to have unit length.

    Returns this

    Return this quaternion.

  • Compute the Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector.

    Returns number

    Return the Euclidean length (straight-line length) of this quaternion.

  • Compute the squared Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector. This can be useful if you are comparing the lengths of two quaternions, as this is a slightly more efficient calculation than length().

    Returns number

    Return the squared Euclidean length (straight-line length) of this quaternion

  • Multiply this quaternion by q.

    Parameters

    Returns this

    Return this quaternion

  • Normalize this quaternion - that is, calculated the quaternion that performs the same rotation as this one, but has length equal to 1.

    Returns this

    Return this quaternion

  • Pre-multiply this quaternion by q.

    Parameters

    Returns this

    Return this quaternion

  • Set this quaternion to a uniformly random, normalized quaternion.

    Returns this

    Return this quaternion

  • Rotate this quaternion by a given angular step to the defined quaternion q. The method ensures that the final quaternion will not overshoot q.

    Parameters

    • q: AcGeQuaternion

      Input the target quaternion.

    • step: number

      Input the angular step in radians.

    Returns this

    Return this quaternion

  • Set x, y, z, w properties of this quaternion.

    Parameters

    • x: number

      Input x coordinate

    • y: number

      Input y coordinate

    • z: number

      Input z coordinate

    • w: number

      Input w coordinate

    Returns this

    Return this quaternion

  • Set this quaternion from rotation specified by axis and angle. Axis is assumed to be normalized, angle is in radians.

    Parameters

    • axis: AcGeVector3dLike

      Input one normalized axis

    • angle: number

      Input one angle in radians

    Returns this

    Return this quaternion

  • Sets this quaternion from the rotation specified by euler angle.

    Parameters

    • euler: AcGeEuler

      Input one euler angle

    • Optionalupdate: boolean

      Input one flag whether to trigger change callback function

    Returns this

    Return this quaternion

  • Set this quaternion from rotation component of the specified matrix.

    Parameters

    • m: AcGeMatrix3d

      Input a Matrix4 of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).

    Returns this

    Return this quaternion

  • Set this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo.

    Parameters

    Returns this

    Return this quaternion

  • Handles the spherical linear interpolation between quaternions. t represents the amount of rotation between this quaternion (where t is 0) and qb (where t is 1).

    Parameters

    • qb: AcGeQuaternion

      Input the other quaternion rotation

    • t: number

      Input interpolation factor in the closed interval [0, 1].

    Returns this

    Return this quaternion

  • Perform a spherical linear interpolation between the given quaternions and stores the result in this quaternion.

    Parameters

    • qa: AcGeQuaternion

      Input one quaternion rotation

    • qb: AcGeQuaternion

      Input the other quaternion rotation

    • t: number

      Input interpolation factor in the closed interval [0, 1].

    Returns this

    Return this quaternion

  • Return the numerical elements of this quaternion in an array of format [x, y, z, w].

    Parameters

    • Optionalarray: number[]

      Input an optional array to store the quaternion. If not specified, a new array will be created.

    • Optionaloffset: number

      (optional) if specified, the result will be copied into this Array.

    Returns number[]

    Return an array

  • Returns number[]

  • This multiplication implementation assumes the quaternion data are managed in flat arrays.

    Parameters

    • dst: number[]

      Input the output array.

    • dstOffset: number

      Input an offset into the output array.

    • src0: number[]

      Input the source array of the starting quaternion.

    • srcOffset0: number

      Input an offset into the array src0.

    • src1: number[]

      Input the source array of the target quaternion.

    • srcOffset1: number

      Input an offset into the array src1.

    Returns number[]

    Return an array

  • This SLERP implementation assumes the quaternion data are managed in flat arrays.

    Parameters

    • dst: number[]

      Input the output array

    • dstOffset: number

      Input an offset into the output array

    • src0: number[]

      Input the source array of the starting quaternion.

    • srcOffset0: number

      Input an offset into the array src0.

    • src1: number[]

      Input the source array of the target quaternion.

    • srcOffset1: number

      Input an offset into the array src1.

    • t: number

      Input normalized interpolation factor (between 0 and 1).

    Returns void