[ODE] matrix multiplication

Fig TaTam fig_tatam at hotmail.com
Wed Mar 12 21:01:02 2003


dMultiply0(R, R, dBodyGetRotation(getBodyID()), 3, 3, 3); doesn't work. I 
haven't tried dMultiply0(R, R, dBodyGetRotation(getBodyID()), 4, 4, 4); 
because it would overflow the dMatrix3 array.

The thing is, I'm trying to use ODE functions and ODE variables. After all, 
I am trying to rotate ODE bodies. I figure there's got to be an ODE way of 
doing this, instead of writing my own matrix multiplication algorithm.

And all I really want is to concatenate 1 rotation to another. I'm sure that 
such operation should be a standard part of ODE, I just can't find it. And 
matrix multiplication doesn't seem to work, I tried many variations of it



>From: "Henri Hakl" <henri@cs.sun.ac.za>
>To: <ode@q12.org>
>Subject: Re: [ODE] matrix multiplication
>Date: Wed, 12 Mar 2003 23:54:50 +0200
>
>That can't be quite right...
>
>that would imply that you are multiplying a 3x4 with a 4x3 to get a 3x3
>matrix.
>
>Try
>  dMultiply0(R, R, dBodyGetRotation(getBodyID()), 3, 3, 3);
>or
>  dMultiply0(R, R, dBodyGetRotation(getBodyID()), 4, 4, 4);
>instead.
>
>Though I can't guarantee what happens with those multiplication systems. If
>you work with small matrices/vectors (3x1, 4x1, 3x3 and 4x4) I suggest you
>download my geometry library at:
>
>http://www.cs.sun.ac.za/~henri/aistuff.html#thetop
>
>and look at the operations in there. The library contains highly optimized
>geometry routines (such as matrix multiplication) for small vectors and
>matrices. Admittedly the library is in Delphi, but the source is in
>assembler and you can copy it over to C(++) with little effort.
>
>----- Original Message -----
>From: "Fig TaTam" <fig_tatam@hotmail.com>
>To: <ode@q12.org>
>Sent: Wednesday, March 12, 2003 11:25 PM
>Subject: Re: [ODE] matrix multiplication
>
>
> > I think I understand how to concatinate rotations, but it's not working.
>Can
> > you check if this code is right:
> >
> > dMatrix3 R;
> > // then R is set to some rotation
> > dMultiply0(R, R, dBodyGetRotation(getBodyID()), 3, 4, 3);
> >
> > So now R should equal to rotation of some dBody plus the rotation
>originally
> > held by R, is it right?
> >
> >
> > >From: <jnilson_99@yahoo.com>
> > >To: ode@q12.org
> > >Subject: Re: [ODE] matrix multiplication
> > >Date: Wed, 12 Mar 2003 08:27:41 -0800 (PST)
> > >
> > >
> > >For what it's worth the following great book has a
> > >simplified explanation of this and other matrix
> > >tecniques. While not a "Game Math for Dummies" it does
> > >explain matrix math simply and from a game programmer
> > >point of view instead of the usual matrix explanations
> > >which are geared toward mathematicians.
> > >
> >
> >http://www.amazon.com/exec/obidos/tg/detail/-/1556229119/qid=1047486129/sr=
>1-1/ref=sr_1_1/103-4731875-8322238?v=glance&s=books
> > >
> > >  So if you stupidly majored in something like History
> > >realized Law School was a complete waste of time and
> > >switched careers into game programming this book is
> > >for you.
> > >
> > >john
> > >
> > >
> > >
> > >--- Henri Hakl <henri@cs.sun.ac.za> wrote:
> > > > It's quite simple, consider:
> > > >
> > > > A = B * C
> > > >
> > > > if B is a 5 x 3 matrix and C is a 3 x 4 matrix then
> > > > A will be a 5 x 4
> > > > matrix, (B's second and C's first parameter HAVE to
> > > > be the same, the
> > > > resultant matrix has dimensions according to B's
> > > > first and C's second
> > > > parameter), accordingly you'd use:
> > > >
> > > > dMultiply0(A, B, C, 5, 3, 4)
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Fig TaTam" <fig_tatam@hotmail.com>
> > > > To: <ODE@q12.org>
> > > > Sent: Wednesday, March 12, 2003 12:32 PM
> > > > Subject: [ODE] matrix multiplication
> > > >
> > > >
> > > > > ok, I figured out how to do that rotation I
> > > > wanted, so don't respond to
> > > > > topic "Re: [ODE] rotation matrix from normalized
> > > > vector?"
> > > > >
> > > > > But now I have a question about matrix
> > > > multiplication. Ode has a function
> > > > > for that described as:
> > > > >
> > > > > /* matrix multiplication. all matrices are stored
> > > > in standard row format.
> > > > > * the digit refers to the argument that is
> > > > transposed:
> > > > > *   0:   A = B  * C   (sizes: A:p*r B:p*q C:q*r)
> > > > > *   1:   A = B' * C   (sizes: A:p*r B:q*p C:q*r)
> > > > > *   2:   A = B  * C'  (sizes: A:p*r B:p*q C:r*q)
> > > > > * case 1,2 are equivalent to saying that the
> > > > operation is A=B*C but
> > > > > * B or C are stored in standard column format.
> > > > > */
> > > > >
> > > > > void dMultiply0 (dReal *A, const dReal *B, const
> > > > dReal *C, int p,int q,int
> > > > > r);
> > > > >
> > > > > What I don't understand is what I'm supposed to
> > > > pass as 'p', 'q', and 'r'.
> > > > > Anyone know?
> > > > >
> > > > >
> > > >
> > >_________________________________________________________________
> > > > > Protect your PC - get McAfee.com VirusScan Online
> > > > >
> > > >
> > >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > > >
> > > > > _______________________________________________
> > > > > ODE mailing list
> > > > > ODE@q12.org
> > > > > http://q12.org/mailman/listinfo/ode
> > > >
> > > > _______________________________________________
> > > > ODE mailing list
> > > > ODE@q12.org
> > > > http://q12.org/mailman/listinfo/ode
> > >
> > >
> > >__________________________________________________
> > >Do you Yahoo!?
> > >Yahoo! Web Hosting - establish your business online
> > >http://webhosting.yahoo.com
> > >_______________________________________________
> > >ODE mailing list
> > >ODE@q12.org
> > >http://q12.org/mailman/listinfo/ode
> >
> >
> > _________________________________________________________________
> > Protect your PC - get McAfee.com VirusScan Online
> > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> > _______________________________________________
> > ODE mailing list
> > ODE@q12.org
> > http://q12.org/mailman/listinfo/ode
>
>_______________________________________________
>ODE mailing list
>ODE@q12.org
>http://q12.org/mailman/listinfo/ode


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail