Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a rotation quaternion in 3D space.

Hierarchy

  • ObservablePoint
    • Quaternion

Index

Constructors

constructor

  • new Quaternion(x?: number, y?: number, z?: number, w?: number, cb?: () => void, scope?: any): Quaternion
  • Creates a new observable quaternion.

    Parameters

    • x: number = 0

      The x component.

    • y: number = 0

      The y component.

    • z: number = 0

      The z component.

    • w: number = 1

      The w component.

    • cb: () => void = ...

      The callback when changed.

        • (): void
        • Returns void

    • scope: any = undefined

      The owner of callback.

    Returns Quaternion

Properties

_x

_x: number

_y

_y: number

cb

cb: () => any

Type declaration

    • (): any
    • The callback function triggered when x and/or y are changed

      Returns any

scope

scope: any

The owner of the callback

Accessors

array

  • get array(): Float32Array
  • set array(value: Float32Array): void

w

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

x

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

y

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

z

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

Methods

clone

  • Creates a clone of this quaternion.

    Parameters

    • cb: () => any = ...

      Callback when changed.

        • (): any
        • The callback function triggered when x and/or y are changed

          Returns any

    • scope: any = ...

      Owner of callback.

    Returns Quaternion

copyFrom

copyTo

  • copyTo<T>(p: T): T
  • Copies x, y, z and w into the given quaternion.

    Type parameters

    • T: IPoint<T>

    Parameters

    • p: T

      The quaternion to copy to.

    Returns T

equals

  • Returns true if the given quaternion is equal to this quaternion.

    Parameters

    Returns boolean

normalize

set

  • set(x: number, y?: number, z?: number, w?: number): Quaternion
  • Sets the quaternion to new x, y, z and w components.

    Parameters

    • x: number

      X component to set.

    • y: number = x

      Y component to set.

    • z: number = x

      Z component to set.

    • w: number = x

      W component to set.

    Returns Quaternion

setEulerAngles

  • setEulerAngles(x: number, y: number, z: number): void
  • Sets the euler angles in degrees.

    Parameters

    • x: number

      The x angle.

    • y: number

      The y angle.

    • z: number

      The z angle.

    Returns void

setFrom

  • Sets the quaternion to a new x, y, z and w components.

    Parameters

    • array: ArrayLike<number>

      The array containing x, y, z and w, expected length is 4.

    Returns Quaternion

toString

  • toString(): string
  • Returns string

Static conjugate

Static fromEuler

  • Creates a quaternion from the given euler angle x, y, z.

    Parameters

    • x: number

      X axis to rotate around in degrees.

    • y: number

      Y axis to rotate around in degrees.

    • z: number

      Z axis to rotate around in degrees.

    • out: Quaternion = ...

      The receiving quaternion. If not supplied, a new quaternion will be created.

    Returns Quaternion

Static rotateX

  • Rotates a quaternion by the given angle about the X axis.

    Parameters

    • a: Quaternion

      The quaternion to rotate.

    • rad: number

      The angle (in radians) to rotate.

    • out: Quaternion = ...

      The receiving quaternion. If not supplied, a new quaternion will be created.

    Returns Quaternion

Static rotateY

  • Rotates a quaternion by the given angle about the Y axis.

    Parameters

    • a: Quaternion

      The quaternion to rotate.

    • rad: number

      The angle (in radians) to rotate.

    • out: Quaternion = ...

      The receiving quaternion. If not supplied, a new quaternion will be created.

    Returns Quaternion

Static rotateZ

  • Rotates a quaternion by the given angle about the Z axis.

    Parameters

    • a: Quaternion

      The quaternion to rotate.

    • rad: number

      The angle (in radians) to rotate.

    • out: Quaternion = ...

      The receiving quaternion. If not supplied, a new quaternion will be created.

    Returns Quaternion

Static slerp

  • Performs a spherical linear interpolation between two quaternions.

    Parameters

    • a: Quaternion

      The first quaternion.

    • b: Quaternion

      The second quaternion.

    • t: number

      The interpolation amount, in the range [0-1], between the two inputs.

    • out: Quaternion = ...

      The receiving quaternion. If not supplied, a new quaternion will be created.

    Returns Quaternion

Generated using TypeDoc