$ npm install gl-quat
Part of a fork of @toji's
gl-matrix split into smaller pieces: this
package contains glMatrix.quat
.
quat = require('gl-quat')
Will load all of the module's functionality and expose it on a single object. Note that any of the methods may also be required directly from their files.
For example, the following are equivalent:
var slerp = require('gl-quat').slerp
var slerp = require('gl-quat/slerp')
Calculates the W component of a quat from the X, Y, and Z components. Assumes that quaternion is 1 unit in length. Any existing W component will be ignored.
Adds two quat's
Calculates the conjugate of a quat If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
Copy the values from one quat to another
Creates a new identity quat
Calculates the dot product of two quat's
Creates a quaternion from the given 3x3 rotation matrix.
NOTE: The resultant quaternion is not normalized, so you should be sure to renormalize the quaternion yourself where necessary.
Set a quat to the identity quaternion
Calculates the inverse of a quat
Calculates the length of a quat
Performs a linear interpolation between two quat's
Multiplies two quat's
Normalize a quat
Rotates a quaternion by the given angle about the X axis
Rotates a quaternion by the given angle about the Y axis
Rotates a quaternion by the given angle about the Z axis
Sets a quaternion to represent the shortest rotation from one vector to another.
Both vectors are assumed to be unit length.
Scales a quat by a scalar number
Set the components of a quat to the given values
Sets the specified quaternion with values corresponding to the given axes. Each axis is a vec3 and is expected to be unit length and perpendicular to all other specified axes.
Sets a quat from the given angle and rotation axis, then returns it.
Performs a spherical linear interpolation between two quat
Performs a spherical linear interpolation with two control points
Calculates the squared length of a quat
MIT. See LICENSE.md for details.
© 2010 - cnpmjs.org x YWFE | Home | YWFE