Repository

Quaternion

Extends:

three~THREE.Quaternion → Quaternion

Represents a Quaternion, a way to describe a spatial rotation that is less susceptible to gimbal lock.

This class extends the one from Three.js, API available here : https://threejs.org/docs/index.html#api/en/math/Quaternion

Method Summary

Public Methods
public
public

setFromGyro(compass: *)

Can be used in the transform of a perspective camera to produce a "blind camera" effect : move the screen around to frame a part of the current scene like if you were using a camera.

Private Methods
private

createGyroQuaternion(alpha: Number, beta: Number, gamma: Number, screenOrientation: Object)

Creates a Quaternion that matches the device's current orientation. Calculated in radians.

Public Methods

public getDirections(): Object source

Return:

Object

{upVector, forwardVector, leftVector}

public setFromGyro(compass: *) source

Can be used in the transform of a perspective camera to produce a "blind camera" effect : move the screen around to frame a part of the current scene like if you were using a camera.

Params:

NameTypeAttributeDescription
compass*

Private Methods

private createGyroQuaternion(alpha: Number, beta: Number, gamma: Number, screenOrientation: Object) source

Creates a Quaternion that matches the device's current orientation. Calculated in radians.

Params:

NameTypeAttributeDescription
alphaNumber

the angle to use for the quaternion creation

betaNumber

the angle to use for the quaternion creation

gammaNumber

the angle to use for the quaternion creation

screenOrientationObject

orientation of the screen in degree! Can be very different depending on the plateform...