View Full Version : Normals and planes
blender
04162002, 03:28 AM
I have programmed with 3d a little while, but I havent found any good articles about normals and planes. They are talked about in every place, but I really dont know what they are or what they are used for.
I know that normal is defined with x, y, z and distace, but what do I do with this information. Are the coordinates from the polygon surface or from where?
What about planes then. I know they are infinite surfaces, but then what, what use is with them? And why most of the geometry information saved by some 3d editors is saved in planes, not in vertices and triangles? To make it harder for me to read it?
AndersO
04162002, 03:47 AM
Hi.
Normals are simply just vectors, usually with the length of one. You calculate a normal for a polygon/triangle by doing a crossproduct between two of the edges/vectors making up the triangle. From that you get a vector, if you want it to be the length of one, you normalize it.
Normals can be used for allot of things; calculating how much light hits a triangle, used when doing collision stuff, hidden surface removal and so on..
Dont know why some 3d editors saves planes. Are you talking about quake .map files here?. Maybe because its easier to build a bsptree or something.
Some tutorials: http://www.flipcode.com/geometry/ http://www.gamedev.net/reference/articles/article435.asp http://www.gamedev.net/reference/articles/article415.asp
Well.. Just a few, I could list more.
[This message has been edited by AndersO (edited 04162002).]
coredump
04162002, 05:44 AM
AndersO is right, planes are used when calculating bsp trees. more specifically used as portals when calculating PVS (potentially visibility set) because planes are infinite, they don't usually have vertices associated with them, per se. however, using the vertices of a polygon, one could generate the equation of a plane. planes are also heavily used with collision detection, as pointplane and planeplane intersection calculations are fast and accurate. whew! i could go on all day!
b
SnowKrash
04162002, 06:20 AM
Taken from the third link above:
A plane is a flat, infinite surface, oriented in a specific direction. You
can define a plane with the famous equation:
Ax + By + Cz + D = 0
where A, B, C are what we called the normals of the plane, and D is the
distance from the plane to the origin.
To be clear on the distance, it's really from the origin to the plane in the direction of the plane's normal.
Furrage
04162002, 08:21 AM
I could never understand that definition of a plane. What are A, B, C and D? Scalars or vectors. And how do you get the normal to the plane and a point on the plane. Then again, maybe that's more maths than OpenGL
blender
04162002, 08:39 AM
I have to admit I don't understand much.
I read some PSD about worldcraft's map files and there are so much things I can't understand.
Something about turning brushes into polygons by the instersection of 3 planes.
Is this a correct definition of a plane or is it just a stupid thought from my twisted mind:


nd


n=normal of the plane
d=distance from the origin
Is the origin the origin of the plane (normal's position)?
Then something out of topic:
I use simple vectors like 3 dimensonal vector
[0, 0, 0] and velocity vector for that and so on...
But are there some other kinds of vectors too, something that points to somewhere?
o [0, 0, 0]
&
o>
Sorry about these stupid questions. http://www.opengl.org/discussion_boards/ubb/smile.gif
Gavin
04162002, 09:14 AM
ABC is the normalised normal to the plane, i.e. the normal vector's x, y, z components. D is the distance from the orogin to the plane along that normal vector, remeber the plane is infinate. To get a normal you need (say on a polygon) the x, y, z of 3 corners from this you can subtract to get 2 vectors, these describe 2 sides of the polygon, cross product these two vectors and this will be the normal, as they say, normalise it or you could screw up majorly with other calcs. Somthing I bodged when doing some stuff if you take the 'famous' Ax + By + Cz + D = 0 and put in all your bits and bobs i.e normals and your point x, y, z what it equals is the distance of the point (x, y, z) from the plane, or if it is 0 as above it is on the plane..... geek on! :)
SnowKrash
04162002, 10:28 AM
Is the origin the origin of the plane (normal's position)?
No, it's (0, 0, 0).
I should have noticed that the quote I posted earlier gave a pretty bad description of A B C as well. Sorry about that.
The diagrams on this page may help, if not the text:
http://www.cfxweb.net/~cfxamir/dp3.html
Furrage
04172002, 07:10 AM
Greek... But the scary part is I actually understood it.
Basically for any infinite plane there is a point on it where it's normal runs through the origin. D is the distance from that point to the origin. Vector (A, B, C) is the normalised normal of the plane, and Vector (x, y, z) represents any point on the plane. Cool, I feel much better now.
Gavin
04172002, 07:28 AM
Yep, easy. Well if you put in x, y, z and the equation equals 0 then it is on the plane, if it were to equal 6.2 the then point x, y, z is 6.2 units form the plane along the normal.
blender
04182002, 08:29 AM
Hmmm, for this moment I have treated vectors as points http://www.opengl.org/discussion_boards/ubb/smile.gif . I read a tutorial which told that a vector is actually pointing towards somewhere. Or what?
zeckensack
04182002, 09:05 AM
Originally posted by blender:
Hmmm, for this moment I have treated vectors as points http://www.opengl.org/discussion_boards/ubb/smile.gif . I read a tutorial which told that a vector is actually pointing towards somewhere. Or what?
Both are somewhat correct. A 3d vector represents an orientation and a distance, period. You can use it to represent a position by saying "If I let my vector start at this location, it'll point to that location". If your starting point is (0;0;0), it's really easy, you get a direct correspondance between vectors and 'target' points. Otherwise remember that it's nothing more than offsets in space, one for each axis.
The biggest source of ambiguity is probably that for a programmer it's really convenient to use the exact same data type to represent both 'proper' vectors and locations in space.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.