[ODE] how to use the type dMatrix3

David Whittaker david at csworkbench.com
Sun Apr 27 08:10:02 2003


Heh, it seems I always get it backwards as well.  I'm almost positive ODE
is row-major (which would mean my example is backwards).  I also know it's
opposite of OpenGL.  Here's the relevant section of the docs:

13.1. Matrix storage conventions

Matrix operations like factorization are expensive, so we must store the
data in a way that is most useful to the matrix code. I want to do 4-way
SIMD optimizations later, so the format is this: store the matrix by rows,
and each row is rounded up to a multiple of 4 elements. The extra
"padding" elements at the end of each row/column must be set to 0. This is
called the "standard format". Hopefully this decision will remain good in
the future, as more and more processors have 4-way SIMD (especially for
fast 3D graphics).

The exception: matrices that have only one column or row (vectors), are
always stored as consecutive elements in standard row format, i.e. there
is no interior padding, only padding at the end.

Thus: all 3x1 floating point vectors are stored as 4x1 vectors: (x,x,x,0).

As far as little endian or big endian goes, this should help:
http://www.cs.umass.edu/~verts/cs32/endian.html .

David

> Just from the definition (dReal[12]) it is not clear whether it is in
> row-major or column-major format. I'm not actually sure which is which -
> but I'd guess that the example "[col*4+row] in general" indicates it is
> in column-major format. (Though I'd be happy if somebody cleared that up
> for me once and for all.)
>
> (I've got a similar problem with BigEndian and SmallEndian notation.
> Which is which, and what is the difference?)
>
>
> ----- Original Message -----
> From: "David Whittaker" <david@csworkbench.com>
> To: <ode@q12.org>
> Sent: Saturday, April 26, 2003 7:55 PM
> Subject: Re: [ODE] how to use the type dMatrix3
>
>
>> dMatrix3 is defined as dReal[12].  So to access column 3, row 1, you
>> would ask for [3*4+1], or [col*4+row] in general.  Why the
>> strangeness?  It's a 3x3 matrix with SIMD padding, so it needs to have
>> rows of length 4.
>>
>> Hope that helps,
>> David
>>
>> > Hi,
>> > Does somebody know hot to use the type: dMatrix3?
>> > Is it used as matrix or a vector?
>> > If I want for example to get to cel (3,1) how do I do it?
>> >
>> > Thank you
>> > Koby
>> >
>>
>>
>>
>> _______________________________________________
>> ODE mailing list
>> ODE@q12.org
>> http://q12.org/mailman/listinfo/ode
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode