[Papervision3D] matrix multiplication order

Andy Zupko azupko at zupko.info
Fri May 8 08:01:10 PDT 2009


The order is important since matrix multiplication isn't commutative.   
(Consider the differences of multiply row->colum and how its different  
depending on which matrix is first).  Essentially, the matrix in the  
first position is applied "first".  Think if you want to apply a  
rotation and translation on an object.  If you do translate*rotation,  
your object will be "moved", then rotated, meaning your object will  
rotate around the translated center rather than its original origin.   
If you do rotate*translate, you would rotate around its center, then  
move out from there.

consider code (not sure if this is correct, but you can fix the syntax  
if not:)

sphere.transform.calculateMultiply4x4(Matrix3D.rotationMatrix(0, 1, 0,  
Math.PI/2), Matrix3D.translationMatrix(300, 0, 0));

This code will rotate the sphere (around origin of scene) 90 degrees  
and move it down its new X axis (which is now the Z axis in world space)

If you flip those two params, it will move out to the right, and then  
rotate around its new center.

hopefully that will help somewhat - a more thorough explanation might  
be needed.

-andy




On May 8, 2009, at 9:24 AM, grizu wrote:

>
> Hello!
>
> Could someone tell me, what is the difference between:
>
>    do3d.transform.calculateMultiply3x3 (do3d.transform,  
> rotationMatrix);
>
> and
>
>    do3d.transform.calculateMultiply3x3 (rotationMatrix,  
> do3d.transform);
>
> I know that order is important, when multiplying matrices (rotX,  
> rotY, rotZ,
> then translation, is this right?). But I can't understand, what is  
> going on
> here. I tried the first thing, which seems logic to me: I simply  
> multiply an
> object's transform with a rotation matrix. But my simple scene only  
> works
> with the second way.
> It would be very nice, if someone could explain this to me. I try to  
> get
> into this matrix-thing, but it is not easy sometimes...
>
> Thanks in advance!
> Chris
> -- 
> View this message in context: http://www.nabble.com/matrix-multiplication-order-tp23446997p23446997.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090508/febf522c/attachment.html>


More information about the Papervision3D mailing list