[Bf-committers] Armatures for beyond Release 2.4
Gilbert, Joseph T.
jgilbert at tigr.ORG
Fri Dec 23 19:25:18 CET 2005
Thx Brecht :) This is useful info and I think we can apply it.
It would be nice to have a mat3_to_vec_roll in there somewhere that way
I wouldn't have to figure it out :)
From: bf-committers-bounces at projects.blender.org
[mailto:bf-committers-bounces at projects.blender.org] On Behalf Of Brecht
Sent: Friday, December 23, 2005 12:00 PM
To: thomas.hendrick at vistagy.com; bf-blender developers
Subject: Re: [Bf-committers] Armatures for beyond Release 2.4
Thomas H. Hendrick wrote:
> Gilbert, Joseph T. wrote:
>> I think that what the python api could create some 'fudges' to
>> transformation matrix and/or a quat/loc into the vector_head,
>> vector_tail, roll This way you could add methods like setMatrix(),
>> setQuat(), setLoc(), setLength() to the armature bone.
> I think I understand the Blender Source well enough to write and
> a patch for something like this, but I don't think I fully understand
> the Mathematics behind it. If someone could give me a general
> of the equations that would be needed, I could probably make the code
This sort of conversion happens in a few places in the blender source,
although never exactly the same as needed here it seems.
in blenkernel/intern/armature.c :
vec_roll_to_mat3 does the opposite of what you need
in b_bone_spline_setup around line 476-481 the roll is computed
So assuming you have a quaternion, a bone length and a bone head,
you can do this:
- convert quaternion to 3x3 matrix
- the 'direction' vector of this rotation is the second column of the
(in blender's code this is simply mat)
- the bone tail then is bone head + direction * bone length.
- the roll you can compute exactly the same as in in
- make a rotation matrix with vec_roll_to_mat3 using only the
- compute the difference of this new matrix with the original
- roll = atan2(diff, diff);
Bf-committers mailing list
Bf-committers at projects.blender.org
More information about the Bf-committers