Selva Compute API Reference - v1.1.2
    Preparing search index...

    Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages.

    const quaternion = new THREE.Quaternion();
    quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
    const vector = new THREE.Vector3( 1, 0, 0 );
    vector.applyQuaternion( quaternion );
    Index

    Constructors

    • Parameters

      • Optionalx: number

        x coordinate

      • Optionaly: number

        y coordinate

      • Optionalz: number

        z coordinate

      • Optionalw: number

        w coordinate

      Returns Quaternion

    Properties

    _onChangeCallback: () => void
    isQuaternion: true
    w: number
    1
    
    x: number
    0
    
    y: number
    0
    
    z: number
    0
    

    Methods

    • Parameters

      • callback: () => void

      Returns this

    • Returns Generator<number, void>

    • Parameters

      Returns number

    • Clones this quaternion.

      Returns this

    • Returns this

    • Copies values of q to this quaternion.

      Parameters

      Returns this

    • Parameters

      Returns number

    • Parameters

      Returns boolean

    • Sets this quaternion's x, y, z and w value from the provided array or array-like.

      Parameters

      • array: number[] | ArrayLike<number>

        the source array or array-like.

      • Optionaloffset: number

        (optional) offset into the array. Default is 0.

      Returns this

    • Sets x, y, z, w properties of this quaternion from the attribute.

      Parameters

      Returns this

    • Returns this

    • Inverts this quaternion.

      Returns this

    • Computes length of this quaternion.

      Returns number

    • Returns number

    • Multiplies this quaternion by b.

      Parameters

      Returns this

    • Normalizes this quaternion.

      Returns this

    • Parameters

      Returns this

    • Returns this

    • Parameters

      Returns this

    • Sets values of this quaternion.

      Parameters

      • x: number
      • y: number
      • z: number
      • w: number

      Returns this

    • Sets this quaternion from rotation specified by Euler angles.

      Parameters

      • euler: Euler
      • Optionalupdate: boolean

      Returns this

    • Parameters

      Returns this

    • Parameters

      Returns this

    • Parameters

      Returns this

    • Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

      Parameters

      • Optionalarray: number[]

        (optional) array to store the quaternion to. If this is not provided, a new array will be created.

      • Optionaloffset: number

        (optional) optional offset into the array.

      Returns number[]

      The created or provided array.

    • Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

      Parameters

      • Optionalarray: QuaternionTuple

        (optional) array to store the quaternion to. If this is not provided, a new array will be created.

      • Optionaloffset: 0

        (optional) optional offset into the array.

      Returns QuaternionTuple

      The created or provided array.

    • Copies x, y, z and w into the provided array-like.

      Parameters

      • array: ArrayLike<number>

        array-like to store the quaternion to.

      • Optionaloffset: number

        (optional) optional offset into the array.

      Returns ArrayLike<number>

      The provided array-like.

    • This method defines the serialization result of Quaternion.

      Returns [number, number, number, number]

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

    • Parameters

      • dst: number[]
      • dstOffset: number
      • src0: number[]
      • srcOffset: number
      • src1: number[]
      • stcOffset1: number

      Returns number[]

    • Parameters

      • dst: number[]
      • dstOffset: number
      • src0: number[]
      • srcOffset: number
      • src1: number[]
      • stcOffset1: number
      • t: number

      Returns void