PDA

View Full Version : drawing normals



coredump
03-20-2001, 03:24 PM
i'm making a polygon class that contains a variable number of coplanar vertices. i'd like to draw the normal to the plane that the polygon lies in. i have a plane class, consisting of A, B, C and D in the plane equation: Ax + By + Cz + D = 0. i know the normal to the plane is the directional vector (A, B, C). all need is two points on a line parallel to the normal to be able to draw it. any help?

b

j
03-20-2001, 03:44 PM
Pick a point on the plane as one point and save it. Add the normal's directional vector to that point and save that point as well. Draw a line between those points. That's your normal vector

j

KurtCob
03-21-2001, 01:47 AM
Hi J,
I didn't understand what you said, in the last post, so can you be more clear ?

Tnks
Best regards
Kurt

coredump
03-21-2001, 06:24 AM
thanks, j. that worked. as it turns out i was doing the right thing in the first place, but my plane class was generating faulty normals due to an error in my matrix class (whew!). i wanted to draw the normals so i could test my bsp class. thanks again.

b

Tim Stirling
03-21-2001, 10:32 AM
I recently thought I would need this for my level editor and I decided I would calculate the center of the plane (each x,y and z component of every vertex averaged) then add on the normal. You can also multiply the noraml by a scalar say 2 and add it to make it look bigger if the planes are large (well I mean the polygons are large, the planes are infinite) I also thought that I could multiply the normal by a fraction of the polygons surface area so big important faces (an enviroment cube etc.) would have a big normal visible from a long way away but a tiny face would have an apropriately small normal.