why 2 matrices ?

Started by raft, January 01, 2010, 09:16:32 PM

Previous topic - Next topic

raft

hi,

what's the purpose of having 2 matrices (rotation and translation) per Object3D ? AFAIK rotation matrix uses the upper left 3x3 part and translation matrix only uses the 3 entries in last row. seems as these can be merged into one, or not ?

why is it so ? for historical reasons or to maintain backwards compatibility or ?

thanks,
r a f t

EgonOlsen

Because it's more flexible that way. You can treat both matrices as single matrices and all matrix operations are valid on them without having to split them each time (think of interpolation as an example...or if you want to reset one of them, you can just do it without having to distinguish which type it is (either in the engine or in your own code)). Having them merged into one would make the engine's code far less generic.

In a generic 3d pipeline, this approach is taken much further than jPCT actually does it. You would also have a projection matrix, a scaling matrix, a shear matrix,...
jPCT has that translation matrix, but it doesn't really execute a complete matrix multiplication with the rotation matrix for performance reasons.