PDA

View Full Version : rotate to normal



12-17-2003, 09:22 AM
I need to rotate the current coord system so it has on axis aligned with a normal. What is the simplest way to do it in GL? The way I am thinking is two rotations one to snap to the z plane and one to rotate to the xy plane. This requires two inverse tans to figure out the angles. Also the current matrix is not at 0,0,0 so I need to make translate to make it pass through a coordinate axis first right? For some reason this was giving me problems. I'm sure this has been done a million times, anyone have the code in GL they can post or link me to to save me trouble?