PDA

View Full Version : Rotate an object on a plane



xorserq
04-25-2014, 06:12 AM
I need to rotate an object on a plane which is set by the points: (0,0,0), (0,0,height), (x,y,z).
I will receive height, x, y and z as input.

The function glRotate requires angle, x, y, z parameters. How can I rotate an object on the given plane?

Any help would be highly appreciated!

Aleksandar
04-25-2014, 06:40 AM
Calculate coefficients (A, B, and C) of the plane using that three points.
Equation of the plane: Ax + By +Cz + D = 0
Normal vector: (A, B, C)

A, B and C are actually parameters for the rotation axis you need.