Skinned animation calculations not quite right

Hi,

I am trying to figure out the steps needed to calculate the final position of a skinned vertex. To achieve this, I have a simple scene in Blender. The scene contains two meshes, mesh A and mesh B. Three vertices within mesh A are skinned with a simple two-bone armature, and the armature has a simple 5 frame animation associated with it. Mesh B is just a static mesh, and its geometry is identical to that of mesh A. I also have a Python script that updates the positions of the vertices of mesh B to match the positions of the vertices in mesh A, for the current frame of animation.

The script isn’t quite there yet, and I think it’s because I’m missing a matrix in my calculation somewhere. I think the rotation is almost there, but I’m missing an offset of some sort. Lines 67-69 are where I calculate the new vertex positions, and the calculations are based of the answer on this SO post:

Could someone please take a look at the attached blend to see if they can find what it is I’m missing out?

Thanks

weighted.blend (493 KB)