[Bf-python] rotation matrices

Yann Vernier yann at algonet.se
Sun Sep 26 13:33:54 CEST 2004


On Sat, Sep 25, 2004 at 12:01:50AM +0000, Tom Musgrove wrote:
> could we also have the optimized rotation matrices available?
> 
> This function is a 1000% faster than using the current method.
> 
> Ie instead of
> 
> rxmat=Blender.Mathutils.RotationMatrix(AngleX,4,'x')
> rymat=Blender.Mathutils.RotationMatrix(AngleY,4,'y')
> rzmat=Blender.Mathutils.RotationMatrix(AngleZ,4,'z')
> rotatedmat = rxmat*rymat*rzmat
> 
> we should be able to do
> 
> rotatedmat = Blender.Mathutils.XYZRotationMatrix(AngleX,AngleY,AngleZ,4)
> 
> http://skal.planet-d.net/demo/matrixfaq.htm#Q36
> 
> This is needed for things like doing BVH import and export efficiently.

This sounds an awful lot like Euler.toMatrix(). X/Y/Z rotation doesn't
tell you how the rotation is meant to be performed; Blender will do them
X-Y-Z, such that Z actually remains around the Z axis. IIRC there are 23
other ways to do it, but maybe that's including right vs left handed.

In short, try:
 eul=Blender.Mathutils.Euler([4,4,4])
 rotmat=eul.toMatrix()
and see if it does what you want. If not, there's nothing to imply your
XYZRotationMatrix would, either. The arbitrary angle form of
RotationMatrix is an alternative to the vector,angle initializer format
for a Quaternion object.

-- 
PGP fingerprint = 9242 DC15 2502 FEAB E15F  84C6 D538 EC09 5380 5746
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20040926/f1086586/attachment-0001.sig>


More information about the Bf-python mailing list