keyframes-to-dual-quats
v1.0.0
Published
Convert a set of keyframe matrices into dual quaternions
Downloads
11
Maintainers
Readme
keyframes-to-dual-quats
Convert a set of keyframed joint matrix arrays into joint dual quaternion arrays
Background / Initial Motivation
This module was made to help with dual quaternion linear blending when using collada-dae-parser
To Install
$ npm install --save keyframes-to-dual-quats
Usage
var keyframesToDualQuats = require('keyframes-to-dual-quats')
var keyframeMatrices = {
1: [
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
],
"3.66": [
// ... some matrices
]
}
console.log(keyframesToDualQuats(keyframeMatrices))
// {
// 1: [
// [0, 0, 0, 1, 0, 0, 0, 0]
// ],
// "3.66": [
// // ... some dual quaternions
// ]
// }
// With collada-dae-parser
var my3dModel = require('collada-dae-parser')(fs.readFileSync('./some-model.dae'))
// Now your keyframes are dual quaternions which you can use for dual quaternion linear blending
my3dModel.keyframes = keyframesToDualQuats(my3dModel.keyframes)
See Also
References
- http://cs.gmu.edu/~jmlien/teaching/cs451/uploads/Main/dual-quaternion.pdf
- 4x4 matrix to dual quaternion formula is in Section 7.1.6
License
MIT