View Full Version : Getting normal after rotation?
how do I determine the normal of a plane/rectangle after glRotatef?
Lets say I have a rectangle with a normal-vector of (0,0,1). Now I perform a glRotatef(55,0,1,0). How do I get the "new" normal? Are there any Ogl functions or do I have some mathematics??
07-11-2002, 02:18 AM
Hmmm, OpenGL doesn;t have functions that return those results if thats what your asking. But it does sort out all the normal stuff for you (or can rather). Do ytou explicityly need the normal for some othjer calculations? Well anyway I can think of a way of doing it, its simple, but a little long winded, I am sure that there are simpler ways by converting the rot into a matrix
Well, yes I need it for other things... *g I have a rectangle displaying a person and I want that person to move into its "looking-direction"... and because that person always looks (just imagine a photograph pasted as a texture) into the direction of the normalvector i need to calculate this...
07-11-2002, 04:38 AM
to find the normal you need 3 points on the plane (p0, p1, p2). use these points to make 2 vectors: v0 = (p1 - p0); v1 = (p2 - p0); and your normal is defined as: v0 X v1 (cross product). as for after the rotation, try multiplying the normal by the modelview matrix.
[This message has been edited by coredump (edited 07-11-2002).]
glTranslated(Center of Rotation);
glTranslated(-Center of Rotation);
DrawYourScene (You keep your usual coordinates of everything)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.