quat-from-unit-vec3

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i quat-from-unit-vec3

Weekly Downloads

607

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mattdesl