[Papervision3D] matrix multiplication order

grizu grizuuu at gmx.at
Fri May 8 22:22:51 PDT 2009


Thank you Andy, what you said is clear to me. But I only have one 
RotationMatrix...
Just thinking, why does
 do3d.transform.calculateMultiply (m1, m2)
take two parameters? I only have one rotationmatrix, and simply want to 
transform my object with it.

If I have
 do3d.transform.calculateMultiply (do3d.transform, rotationMatrix),
I multiply my object's matrix with the rotationmatrix (at least I 
thought so). Or is it object*matrix*object?

What happens if I flip the parameters? I multiply matrix*object, then 
with my object?.... *confused*

Thanks!
Chris
> 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 <mailto:Papervision3D at osflash.org>
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>   




More information about the Papervision3D mailing list