OpenGL has a function that deals with planes and halfspaces - glClipPlane(...). Description of this function says:

If the dot product of the eye coordinates of a vertex with the stored plane equation components is positive or zero, the vertex is in with respect to that clipping plane. Otherwise, it is out.

Here is a description from

http://wwwcsif.cs.ucdavis.edu/~jankunm/175/WOGL_clipping_functions.html:

**Clipping Planes**

A clipping plane divides space into two, half on one side of the plane, half on the other. The plane has a front and a back side, the front side is the one with the plane's normal vector. So space gets divided into a front halfspace and a back halfspace. Let's define "inside" to mean something is in the front halfspace. In 3D space, the one we're used to, a plane is defined by this plane equation.

Ax + By + Cz + D = 0

We can store the plane coefficients in a vector (A,B,C,D). To determine whether or not a point is inside the front halfspace of a plane, we find the distance from the point (xo, yo, zo) to the plane (A,B,C,D).

distance = Axo + Byo + Czo + D

If the distance is positive, the point is in the front halfspace, inside. If the distance is zero, the point lies on the plane. If the distance is negative, the points lies in the back halfspace, outside.

In 4D homogeneous space, planes are specified by equations of this form.

Px + Qy + Rz + Sw = 0

Again, we can store the plane coefficients as vectors (P,Q,R,S). To see if a point (xo, yo, zo, wo) is in the front halfspace, on the plane, or in the back halfspace, we take the dot product of the point and the plane's coefficient vector. This number isn't really a distance, but at times it might help to think of it as such.

dot product = Pxo + Qyo + Rzo + Swo

Again, inside is > 0, on the plane = 0, outside is < 0.

I think we should choose definition of In/Out from OpenGL specs just to aboid one more difference and be able to point peolpe to OpenGL docs.

Yuri