Convert a 4x4 matrix into a dual quaternion. Useful for skeletal animation
Background / Initial Motivation
dual-quat-to-mat4's initial motivation was to be used to convert a bone's dual quaternion into a matrix in order to use it to position a model relative to your bone.
For example, let's say you have an armature that you blended between two keyframes using skeletal-animation-system. You now want to render a baseball in your armature's hand
- Start with some dual quaternion bone data from your character's armature
- Grab the dual quaternion for the right hand bone
- Convert the right hand bone's dual quaternion into a 4x4 matrix using
- Use this 4x4 matrix to transform a baseball model view matrix.
- Your baseball will now be rendered with it's origin at your right hand bone
- (Or at some offset from that bone if you factor that into your model view matrix)
$ npm install --save dual-quat-to-mat4
var dualQuatToMat4 =var matrix =var dualQuat =console// [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
dualQuatToMat4(out, dualQuat) ->
An allocated array that will get elements  through  set as your output matrix
The dual quaternion that you want to convert into a 4x4 matrix