PDA

View Full Version : Defining rotations parallell to a plane

Clayton
12-16-2003, 11:46 AM
If I have a plane equation, is there an easy way to have GL rotate parrallell to this plane, or must I do it mathematically? For instance, x+2z=30 is the plane, and I've got rotation in terms of Rotation around the XY axis and around the Z axis.

12-17-2003, 12:58 AM
Solution anyway is mathematical
and i think, quaternion could be the answer.
(a bit hard to understand at the beginning, but quite elegant and CPU-ticks-saving)

Mazy
12-17-2003, 01:37 AM
i dont know why you need quaternions for this ( maybe i misunderstand the question)

If you have a plane, you have a normal on that plane. If you use that normal as the 3 last parameters of glRotatef(angle, x,y,z), the angle will rotate around that axel, and therefor parallell to the plane

Clayton
12-18-2003, 02:34 PM
Sorry, poor wording on my part, yeah you're right that would be a really simple ay to do it. Unfortunately what I need to be able to do is rotate not parrallell to the plane, but rotate my camera to be parralell to the plane from being in an aribtrary position.

[This message has been edited by Clayton (edited 12-18-2003).]