[ODE] dBodyGetRotation returns what?

James Gjerde jgjerde at contrarymotion.com
Sat Mar 5 22:13:03 MST 2005


without the zeros or the 4th float in each row, ( elems 3,7 and 11 ) it is a 
standard 3 X 3 row-major rotation matrix.

i have not seen the docs in a while, but i know they used to say the reason 
for the extra fourth element was for possible simd support or something like 
it in the future, but for the time being they are basically meaningless and 
not used(  in fact in rotation.cpp they are never used , or were not in the 
version i have used. )

u can easily convert this to the 4x4 format by adding the necessary zeros 
and 1 in the appropriate spots, or add your translation vector.

 dvTransMatrix[0]=  _dvR[0];
 dvTransMatrix[1]=  _dvR[4];
 dvTransMatrix[2]=  _dvR[8];
 dvTransMatrix[3]=  0;
 dvTransMatrix[4]=  _dvR[1];
  dvTransMatrix[5]=  _dvR[5];
  dvTransMatrix[6]=  _dvR[9];
  dvTransMatrix[7]=  0;
  dvTransMatrix[8]=  _dvR[2];
  dvTransMatrix[9]=  _dvR[6];
  dvTransMatrix[10]= _dvR[10];
  dvTransMatrix[11]= 0;
  dvTransMatrix[12]= _dvPos[0];
  dvTransMatrix[13]= _dvPos[1];
  dvTransMatrix[14]= _dvPos[2];
  dvTransMatrix[15]= 1;

that code is straight from drawstuff if i remeber correctly, although i may 
have changed the names. _dvR is an ode rotation matrix, _dvPos is a simple 
translation vector, and dvTransMatrix is a colum-major openGL matrix. zero 
out the _dvPos elems and u have a standar 4x4 column-major rotation matrix.

jamie


----- Original Message ----- 
From: "Megan Fox" <shalinor at gmail.com>
To: "Bram Stolk" <bram at sara.nl>
Cc: <ode at q12.org>
Sent: Saturday, March 05, 2005 9:25 PM
Subject: Re: [ODE] dBodyGetRotation returns what?


> The last time this came up, I thought it was decided that what ODE is
> putting out is a row-major matrix of 3 vectors, each 4 floats long,
> with the trailing floats just existing as 0's - but I could very well
> be misremembering.  You might want to take a peak in the archives in
> any case, I'm sure this was brought up somewhat recently.
>
> -Megan Fox
>
> On Sun, 06 Mar 2005 00:03:44 +0100, Bram Stolk <bram at sara.nl> wrote:
>> Aaron Cameron wrote:
>> > On Sat, 2005-03-05 at 04:26 +0530, Kuldip wrote:
>> >
>> >>HI all,
>> >>
>> >>It is written in the documentation of ODE that dBodyGetRotation
>> >>returns a 4x3 martix. but what does each value in this array
>> >>signifies? what is this matrix actually?
>> >>
>> >
>> >
>> > It is a standard rotation matrix.  You might find it helpful to brush 
>> > up
>> > on your matrix transforms.  A good place to start is this page:
>>
>> this 4x3 ode matrix is not so 'standard' as you make it out to be.
>> In computer graphics, almost all matrices are 4x4.
>>
>> The ode documentation is unclear about the 4x3 values.
>> Are these 3 vectors of length 4 (simply a 4x4 matrix with the 4th
>> translational vector removed?) or 4 vectors of length 3?
>>
>> Orientations can be expressed as 4 floats of a quaternion, or
>> with 9 floats from the full 4x4 mat. Why use 12 floats?
>> I agree with the original poster that the docs are not clear.
>>
>>    bram
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode 



More information about the ODE mailing list