Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObservableQuaternion<T>

Represents a rotation quaternion in 3D space.

Type parameters

  • T

Hierarchy

  • ObservablePoint
    • ObservableQuaternion

Implements

  • IPoint

Index

Constructors

constructor

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

    Parameters

    • cb: () => void

      The callback when changed.

        • (): void
        • Returns void

    • scope: any

      The owner of callback.

    • Default value x: number = 0

      The x component.

    • Default value y: number = 0

      The y component.

    • Default value z: number = 0

      The z component.

    • Default value w: number = 1

      The w component.

    Returns ObservableQuaternion

Properties

Private _array

_array: Float32Array = new Float32Array(4)

_x

_x: number

_y

_y: number

cb

cb: (this: T) => any

Type declaration

    • (this: T): any
    • Parameters

      • this: T

      Returns any

scope

scope: any

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

    • Default value cb: (this: T) => any = this.cb

      Callback when changed.

        • (this: T): any
        • Parameters

          • this: T

          Returns any

    • Default value scope: any = this.scope

      Owner of callback.

    Returns ObservableQuaternion

copyFrom

copyTo

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

    Type parameters

    • T: IPoint

    Parameters

    • p: T

      The quaternion to copy to.

    Returns T

equals

set

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

    Parameters

    • x: number

      X component to set.

    • Default value y: number = x

      Y component to set.

    • Default value z: number = x

      Z component to set.

    • Default value w: number = x

      W component to set.

    Returns this

setEulerAngles

  • setEulerAngles(x: number, y: number, z: number): void

setFrom

  • setFrom(array: ArrayLike<number>): this
  • 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 this

toString

  • toString(): string

Generated using TypeDoc