# Python API: Transformation from Bone bind pose to PoseBone using SQT

I am trying to understand the Blender Python API, more specifically Bone and PoseBone types and how they fit in with skeletal animation.

This is how I understand it so far:

The Bone type holds the transformation matrix from the bone's local space to its' parent object's space in its' matrix_local property.

There is one PoseBone for each Bone in a scene for each frame of an animation. Another way to put it is: There is a pose for each frame of the animation and this pose's skeleton (for the current frame) is made up of PoseBone objects.

Each PoseBone holds the transformation matrix to transform the position of the bone in its' bind pose to it's position in the current frame. This transformation can be accessed through the scale, rotation_quaternion and location properties. If I apply these to the position of the bone in its' bind pose, then the bone will be moved to its' correct position for the current frame.

Each Bone has a head and a tail. As I understand it, the head is the origin of the bone's local coordinate space. So the "position" of the bone I mentioned earlier is also the position of the bone's head.

Am I correct in my understanding so far?

I am trying to create an animation system where the bone is initially in its' bind pose. There is a 4x4 transformation matrix to transform from object space to bone space. We use this to compute the origin/position of the bone in its' bind pose.

For each frame of the animation, the scale, rotation_quaternion, and location are used to transform the position of the bone from its' inverse bind pose to the pose in the current frame.

One thing that is not clear to me is what the rotation_quaternion represents here. How do I use it to compute the position of the bone in the current frame?

There is something else unclear to me. I understand that for skeletal animation in Blender, each vertex of a mesh has a list of bones that its' bound to, with an associated weight for each bone.

How is the final position of the vertex computed for each frame? Can I make a transformation matrix from the scale, rotation_quaternion and location properties, compute a weighted average of the matrices for each group, and use that to transform the vertex's position from its' bind pose? Again, I am not sure how to fit in the rotation_quaternion here.

As well, does the tail of the bone matter at all for the vertex skinning? As I understand it so far, all I need to know to compute the final position of the vertex for the frame are the SQT transforms of the relevant bones.

I am stuck on this and would appreciate someone helping me straighten this out. The documentation is appreciated but I think I am missing some essential details for what I need to do that I can't find in the documentation.

Partial answers and hints will still be appreciated.

Thanks,

YUNG PROGRAMMER