2d Matrix

BlitzMax Forums/BlitzMax Beginners Area/2d Matrix

Eric(Posted 2006) [#1]
Could someone tell me about matrices... In 3d I know they are invaluable, but what about in 2d.. can they help me? or is it a waste of time to bother in 2d.

I'm really interested in Learing about them.
Can anyone point me in the right direction. or maybe have some sample code.


Dreamora(Posted 2006) [#2]
They are a must have if you are doing something with hierarchical transformations ... but otherwise: naw max2d has everything that is needed.


Eric(Posted 2006) [#3]
I'm not sure what you mean ... " hierarchical transformations "

I was thinking of doing Vector style graphics.


ImaginaryHuman(Posted 2006) [#4]
If you want your whole object to rotate 50 degrees clockwise and you then want all the child objects within that to rotate 20 degrees more, you have a nested situation, for which you need the matrix.


Dreamora(Posted 2006) [#5]
Hierarchy: Parent - Child relation of objects where changing parent transformations are processed/executed on the childs as well.

For vector style graphics it depends on how you do it. If you use mathematical vectors, you most likely will need to use matrices.
But you could use the cairo module as well and use true vector graphics instead (check the user mods board)


Eric(Posted 2006) [#6]
Could someone multiply these two matricies together and give me the result so I can compare it to my function.

4.5 , 6.7 , 8.9               7.2 , 9.5 , 7.1

3.2 , 7.5 , 5.2        X      4.2 , 6.5 , 7.9

1.2 , 8.5 , 9.4               8.3 , 3.7 , 6.2


Any help would be appreciated.

Regards,
Eric


mindstorms(Posted 2006) [#7]
Here is code to do it, a matrix class from the code archives...(in 3d math)



edit:

Here is the two matrixs multiplied together with the above code:
134.409988 119.229996 140.059998
97.6999969 98.3899994 114.209999
122.360001 101.430000 133.949997

Here is the link to the full matrix/vector/quaternion classes:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1550