# Rotating a plane

## Recommended Posts

TigerSam    122
Hi All, Im have a floor in my game which can be rotated about. Seperately i have also defined a plane object which represents the plane the floor is sitting on. I draw and rotate my floor like such:
void SomeDrawMethod()
{
...
glPushMatrix();
glRotate(someValue, 0, 0, 1) // rotate by somevalue around z axis
drawFloor();
glPopMatrix();

}

What i would like to know is how i can rotate the plane to lie on the new position of the floor? My Plane is just a basic objet containing a point and normal
class Plane
{
public:
Plane();
~Plane();

// Some Accessors here

private:
vector4f point;
vector4f normal;
}

If any1 could help me out it would be much apprechiated. Cheers.

##### Share on other sites
furby100    102
Rotate the normal.

##### Share on other sites
TigerSam    122
Quote:
 Original post by furby100Rotate the normal.

Thanks for the reply, That wouldnt work as the floor is being rotated around a centre point, not its own centre. ie imagine the floor at point (0,-2,0) and rotating around the point (0,0,0). This should be a really simple problem but has lost me toatlly, if i can find the new plane point then the normal can be got from that.

Cheers

##### Share on other sites
Sandman    2210
transform both the point and the normal.

If you set the w coordinates correctly (1 for a point, 0 for a vector/normal) then you can apply transformations to your plane in exactly the same way as you would for anything else.