goog.vec.Quaternion
Functions
add( quat0, quat1, resultQuat ) → void
void
cloneFloat32( q ) → Float32Array
Float32Array
Creates a clone of the given Float32 quaternion.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
cloneFloat64( q ) → Float64Array
Float64Array
Creates a clone of the given Float64 quaternion.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
Concatenates the two quaternions storing the result into resultQuat.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Computes the conjugate of the quaternion in quat, storing the result into resultQuat.
If the quaternion is normalized already, this function is faster than goog.Quaternion.inverse and produces the same result.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
createFloat32() → Float32Array
Float32Array
Creates a Float32 quaternion, initialized to zero.
Parameters | None. | ||
---|---|---|---|
Returns |
|
createFloat32FromArray( vec ) → Float32Array
Float32Array
createFloat32FromValues( v0, v1, v2, v3 ) → Float32Array
Float32Array
createFloat64() → Float64Array
Float64Array
Creates a Float64 quaternion, initialized to zero.
Parameters | None. | ||
---|---|---|---|
Returns |
|
createFloat64FromArray( vec ) → Float64Array
Float64Array
createFloat64FromValues( v0, v1, v2, v3 ) → Float64Array
Float64Array
createIdentityFloat32() → Float32Array
Float32Array
Creates a Float32 quaternion, initialized to the identity.
Parameters | None. | ||
---|---|---|---|
Returns |
|
createIdentityFloat64() → Float64Array
Float64Array
Creates a Float64 quaternion, initialized to the identity.
Parameters | None. | ||
---|---|---|---|
Returns |
|
dot( q0, q1 ) → number
number
Generates a unit quaternion from the given angle-axis rotation pair. The rotation axis is not required to be a unit vector, but should have non-zero length. The angle should be specified in radians.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Generates the quaternion from the given 3x3 rotation matrix.
Perf: http://jsperf.com/conversion-of-3x3-matrix-to-quaternion http://jsperf.com/goog-vec-fromrotationmatrix3-a
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Generates the quaternion from the given 4x4 rotation matrix.
Perf: http://jsperf.com/goog-vec-fromrotationmatrix4
Implementation is the same as fromRotationMatrix3 but using indices from the top left 3x3 in a 4x4 matrix.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Computes the inverse of the quaternion in quat, storing the result into resultQuat.
If the quaternion is already normalized, goog.vec.Quaternion.conjugate is faster than this function and produces the same result.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
magnitude( quat0 ) → number
number
magnitudeSquared( quat0 ) → number
number
negate( quat0, resultQuat ) → void
void
nlerp( q0, q1, t, resultQuat ) → void
void
Compute the simple linear interpolation of the two quaternions q0 and q1 according to the coefficient t. The resulting quaternion is stored in resultVec.
Parameters |
|
---|
normalize( quat0, resultQuat ) → void
void
Rotates a quaternion by the given angle about the X axis.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rotates a quaternion by the given angle about the Y axis.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rotates a quaternion by the given angle about the Z axis.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
scale( quat0, scalar, resultQuat ) → void
void
Multiplies each component of quat0 with scalar storing the product into resultVec.
Parameters |
|
---|
Initializes the quaternion with the given array of values.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Initializes the quaternion with the given values.
Parameters |
| ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Computes the spherical linear interpolated value from the given quaternions q0 and q1 according to the coefficient t. The resulting quaternion is stored in resultQuat.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
toAngleAxis( quat, axis ) → number
number
Generates an angle-axis rotation pair from a unit quaternion. The quaternion is assumed to be of unit length. The calculated values are returned via the passed 'axis' object and the 'angle' number returned by the function itself. The returned rotation axis is a non-zero length unit vector, and the returned angle is in radians in the range of [-PI, +PI].
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Generates the 3x3 rotation matrix from the given quaternion.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Generates the 4x4 rotation matrix from the given quaternion.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Transforms a vec with a quaternion. Works on both vec3s and vec4s.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Properties
No information.
Float32 → Float32Array
Float32Array
No information.
Float64 → Float64Array
Float64Array
No information.
No information.