Author Topic: why 2 matrices ?  (Read 2193 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
why 2 matrices ?
« on: January 01, 2010, 09:16:32 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: why 2 matrices ?
« Reply #1 on: January 01, 2010, 11:40:32 pm »
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.