Local Axies?


I’m trying to load data from trueSpace into OpenGL, and it’s going well apart from one thing, ‘local axies’. Every trueSpace object defines it’s own axies, which in effect behaves as rotation and translation. I can get the translation from this, it’s just the centre of the axies, but I cannot find any way to get the rotation about each OpenGL axis that i’d need to have the same effect as local axies.
Any ideas anyone?

this is just a transformation from coordinate system

suppose you have a coordinate system C1 with an orthonormal base X, Y and Z and a point P with coordinates relative to C1. When you want the coordinates relative to a new coordinate system C2 with basis vectors U, V and W you need to know the coordinates of U, V and W relative to C1. Then you can transform the point P’s coordinates relative to C1 to the new frame C2 like this:

P(C2).x = P(C1) dot U(C1)
P(C2).y = P(C1) dot V(C1)
P(C2).z = P(C1) dot W(C1)

clearly this can be written as a single matrix transform where the columns/rows (depends if using normal notation or GL transposed notation) are coordinates of the new basis vectors (U, V, W) relative to C1. In most cases these vectors are normalized (a tranformation from a orthonormal frame to another orthonormal frame) so only rotation is accounted for.By allowing the vectors to be non-normalized, a scaling is taken into account 0but a standard frame change does not take translation into account, although it can easilly be added (last dx, dy, dz in last row/column of the matrix).

I dont know about the truespace stuff, but if a matrix is specified for each object, just mul with that matrix, and rot, scale and trans will be taken into account. You should not try to extract the rotations and perform them separate. Just get/make the matrix, and multiply with it.

Hope this clears things up.

Thanks very much, that’s explained the system to me really well!