Advertisement

All about the math...

Started by March 11, 2002 02:57 AM
1 comment, last by Shadow_0f_Light 22 years, 11 months ago
I have 2 problems I need some help with. They shouldn''t be giving me trouble but oddly enough they are. First... I need to be able to start with a 3d point (x, y, and z coord) then rotate it around the x, y, and then z axis (in that order) and know what the result x, y, and z coords would be (I have gotten it close but I can''t quite figure it out). Second... I have a triangle, and I need to find the equation (0=x+y+z) for the plane that the triangle lays on. The only information I have is the 3d coords for the 3 vertices. If any one can help thanks ahead of time... Zech
I'm don't know much but I can try to help... just email me at... Shadow_0f_Light@Yahoo.com(the '0' in 'Of' is a zero :P)
a(x-x0) + by(y - y0) + c(z - z0) = 0

where n is the normal vector for the triangle and n = (a, b, c),
r0 is a vector and r0 = (x0, y0, z0) (ie. a vertex in the plane ; one of your triangle vertices).

If memory serves.


Edited by - MelvinElvin on March 11, 2002 4:26:28 AM
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Advertisement
And you can get the normal as a cross product of two vectors, which you get from your vertices (v1-v0 and v2-v0).

As for the rotations, that makes 3 matrix multiply. Write down you original XYZ vector, the rotation matrix around X, multiply, write the Y-rotation matrix, multiply, write the Z-rotation matrix, multiply.

If you can''t write a rotation matrix... you are doomed.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement