# Point respect to plane

How do I classify a point with respect to a plane, returning whether the point is inside, outside, or coplanar?

I know that if a point is on the plane the Dot product + the plane distance would equal to 0, but what does inside, outside, and coplanar mean. Also how it is computed.

• As you imply, a plane can be represented by its normal, N, and a scalar, d. A point X is on the plane if N.X+d = 0. As for inside and outside typically you define a rule, e.g., that the normal points "out" from the plane which just means that if N.X+d > 0, then X is outside the plane, while N.X+d<0, implies it's inside. Commented Jan 31, 2017 at 9:40
• Clearly my brain is not in gear this morning. Will delete. Commented Jan 31, 2017 at 10:24

Vec3 v = myPoint - pointOnPlane;
float vDotPlaneNormal = dot(v, planeNormal)
if (vDotPlaneNormal == 0)
printf("point on plane");
else if (vDotPlaneNormal > 0)
printf("point above somehow...");
else


If you wonder what is pointOnPlane. In fact it can be any point that lies on the plane. Imagine this as a sheet of paper; draw two lines on this sheet to define the center of the piece of paper, imagine that this point is aligned with the world coordinate system origin and that sheet is in xz plane of that coordinate system (in which y defines the up vector). So the paper is horizontal in a way. Now move the sheet around. The pointOnPlane can be the coordinates of the point you drew in the center of the sheet of paper with respect to the world origin.

All you have to do is rotate that sheet of paper. That rotation is given to you by the plane's normal.

The rest is basic trig. If the point P is one the plane, the dot product between the vector defined by (P - PointOnPlane) and the plane's normal will be equal to 0. The dot product tells you whether two vectors are orthogonal, on the same side of the plane or point in opposite directions.

# FASTER SOLUTION - EDIT

As mentioned by SimonF in a comment, you don't really need the pointOnPlane parameter and save the subtraction between this point and the tested point:

As you imply, a plane can be represented by its normal, $$N$$, and a scalar, $$d$$.

A point X is on the plane if $$N \cdot X+d = 0$$. As for inside and outside typically you define a rule, e.g., that the normal points "out" from the plane which just means that if $$N \cdot X + d > 0$$, then $$X$$ is above the plane, while $$N \cdot X + d < 0$$, implies it's below.

You can test/use both techniques.

• If you represent your plane by the Normal and a scalar you can avoid the unnecessary expensive of the vector subtract. Commented Jan 31, 2017 at 11:10
• @SimonF. Sure ... feel free to edit my answer and add that as a quicker solution... I just made an answer). Commented Jan 31, 2017 at 11:29
• Given the number of typos I'm making today ( "expensive of the", good grief!), I don't think I dare. :-) Commented Jan 31, 2017 at 13:52
• @SimonF - I'll do it for you... Commented Jan 31, 2017 at 19:59
• One thing we should point out that is, if using floating point, it is unlikely, in general, that you will ever get (vDotPlaneNormal == 0.0). You may need to add a "within epsilon" test Commented Feb 2, 2017 at 10:04