Matrix Math Examples
BlitzMax Forums/BlitzMax Programming/Matrix Math Examples
| ||
Hi All - I think I have matrix math pretty much figured out but it'd be great to see someone elses input and interpretation. How would you represent the following b3d commands using the classes in the following link: http://www.blitzbasic.com/Community/posts.php?topic=42657 MoveEntity,TurnEntity,TranslateEntity,RotateEntity,ScaleEntity Thanks! |
| ||
Show us what you got so far and we can critique. Don't mind pitching in but I'm too lazy to write it all from scratch. What are your outputs? List of points, an overall transform matrix to feed to an API like OpenGL or what? |
| ||
Ok! I'll clean up my code and post it when I get home tonight. I have an array of points that I'm feeding into OpenGL, then using the classes in the link to perform the maths required on each point to manipulate each vertex. I have a simple pass-through vertex and fragment shader. Trying to learn 3D :) |
| ||
Okay, so you probably want to apply the transformations given in Mark's code by post multiplying your points matrix by the given transformation matrix, e.g. rotatedPointsMatrix=pointsMatrix*rotationMatrix(p,y,r) where from the looks of it, your points matrix needs to look like: [x1,y1,z1] [x2,y2,z2] [x3,y3,z3] etc. where 1,2,3 etc are the vertices. |