which side of a plane is a vertex located?


given a rectangular plane and a vertex in 3D space, is there any way to determine whether the vetex is in front or behind the plane?
If mathematics are involved, can the formulae (or the actual ogl codes) be shown as well?


Given a plane equation defined like this :

void Plane(const Vector3& _n, float _d)
a = _n.x;
b = _n.y;
c = _n.z;
d = _d;

U can check signed distance with this :

a * point.x + b * point.y + c * point.z + d

rIO.sK http://www.spinningkids.org/umine

hi rIO!

isnt a plane defined by 2 vectors?

A plane can be defined by two vectors on the plane or one vector perpendicular to the plane plus an offset from the origin (d).

Using the latter representation makes your problem easier.


A plane can be defined by the eq:



u is the vector normal to the plane and D is the position along this vector. What you can do is compute the plane (A,B,C and D) values and then test the vertex.

For the plane: Ax+By+Cz=Dp
For the vertex: Dv=Ax+By+Cz (x,y,z vertex coordinates)
if Dv > Dp then then vertex is on the positive side of the plane.
if Dv < Dp then then vertex is on the negative side of the plane.
if Dv = Dp then then vertex is on the plane.

Good luck.

Originally posted by tango:
isnt a plane defined by 2 vectors?

The others already said, but to be a little more precise:

A plane is typically defined by a vector (the plane normal) and a distance(distance from the plane to the origin along the normal vector). This is the standard form from which you can create the plane equation Ax + By + Cz = D

You can also derive this equation from the normal vector and a point on the plane. Since you have the normal, you just need the distance, which is actually the dot product of the normal with the point on the plane.

You can also derive the equation from 2 different vectors parallell to the plane and a point on the plane. The normalized cross product of the 2 vectors gives you the plane normal, now its the same situcation as before.

You can also derive th equation from 3 counter-clockwise points (V1, V2, V3) on the plane. (V2-V1) gives you one vector, (V3-V1) gives you another vector, use any of the 3 points, and you are back at the “2 vectors and a point” situation. If your points are not counterclockwise, you will still get the plane, but its normal will be facing the opposite direction.

[This message has been edited by LordKronos (edited 01-30-2001).]

thanks every1!!
i will start trying all your suggestions.

  • is dot product, x is cross product:

pi: nx + d = 0 (plane equation)
n = (v1-v0) x (v2-v0) (normal)
d = -n*v0

than you put any point x in the plane equation, and get the distance from the plane.