1.0.0 • Published 9 years ago

quat-from-unit-vec3 v1.0.0

Weekly downloads
115
License
MIT
Repository
github
Last release
9 years ago

quat-from-unit-vec3

stable

Creates a quaternion from two (normalized) unit vectors. Adapted from this blog post.

Install

npm install quat-from-unit-vec3 --save

Example

var fromUnitVec3 = require('quat-from-unit-vec3')

var vecA = [0, 0, 0]
var vecB = [0, 0, 1]
var quat = fromUnitVec3([], vecA, vecB)
//=> [ 0, 0, 0, 1 ]

Usage

NPM

quat = fromUnitVec3(quat, a, b)

Forms a quaternion from two normalized unit vectors, a and b (3-component arrays). The value is stored in quat (a 4-component array) and returned.

License

MIT, see LICENSE.md for details.