[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6.837] MatrixStack Info



Hi,
Someone wanted a bit more info on Matrix Stack.  I will explain more on
it

MatrixStack keeps track of transformations.

The push procedure pushes onto the stack the current transformations.
Like duplicating the last entry of the stack.
If sthe stack is: A B C, the stack will become A B C C after the push.

Pop does what you expect, removes the entry on top of the stack.
If sthe stack is: A B C, the stack will become A B after the pop.


The idea is that you do some transformations, push them to keep a backup
copy, add more transformations, transform things that you want, and then
pop the last transformations to go back to a previous state.

The matrixstack in addition to doing transformations can also do
projections.  The fustrum is used for projections.

Finally transformations are applied in the reverse order that they were
put it.

let foo be a MatrixStack, so you can say:
foo.fustrum(f);  // only used for projections
foo.transform(t1);
foo.lookat(l); // used mostly for viewing transformations
foo.transform(t2);

so this will transform your coordinates by t2,
change their view to be l,
then do transformations t1,
and finally if you are doing projections adjust the fustrum to f.

I hope this helps,
	Hector