<pre><code>Vec3 v = myPoint - pointOnPlane;
float vDotPlaneNormal = dot(v, planeNormal)
if (vDotPlaneNormal == 0) 
    printf(&quot;point on plane&quot;);
else if (vDotPlaneNormal &gt; 0)
    printf(&quot;point above somehow...&quot;);
else
    printf(&quot;point under sadly...&quot;);
</code></pre>
<p>If you wonder what is <code>pointOnPlane</code>. 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 <code>pointOnPlane</code> can be the coordinates of the point you drew in the center of the sheet of paper with respect to the world origin.</p>
<p>All you have to do is rotate that sheet of paper. That rotation is given to you by the plane's normal.</p>
<p>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.</p>
<h1>FASTER SOLUTION - EDIT</h1>
<p>As mentioned by SimonF in a comment, you don't really need the <code>pointOnPlane</code> parameter and save the subtraction between this point and the tested point:</p>
<blockquote>
<p>As you imply, a plane can be represented by its normal, <span class="math-container">$N$</span>, and a scalar, <span class="math-container">$d$</span>.</p>
<p>A point X is on the plane if <span class="math-container">$N \cdot X+d = 0$</span>. As for inside and
outside typically you define a rule, e.g., that the normal points
&quot;out&quot; from the plane which just means that if <span class="math-container">$N \cdot X + d &gt; 0$</span>, then
<span class="math-container">$X$</span> is above the plane, while <span class="math-container">$N \cdot X + d &lt; 0$</span>, implies it's below.</p>
</blockquote>
<p>You can test/use both techniques.</p>

CC BY-SA 3.0
2017-01-31T11:10:05.117Z
If you represent your plane by the Normal and a scalar you can avoid the unnecessary expensive of the vector subtract.
Simon F
CC BY-SA 3.0
2017-01-31T11:29:02.997Z
@SimonF. Sure ... feel free to edit my answer and add that as a quicker solution... I just made an answer).
user18490
CC BY-SA 3.0
2017-01-31T13:52:44.580Z
Given the number of typos I'm making today ( "expensive of the", good grief!), I don't think I dare.  :-)
Simon F
CC BY-SA 3.0
2017-01-31T19:59:13.457Z
@SimonF - I'll do it for you...
user18490
CC BY-SA 3.0
2017-02-01T15:58:49.493Z
@user18490 yes, that answers my question. Thank you
MOJOMO
CC BY-SA 3.0
2017-02-02T10:04:08.660Z
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
Simon F
CC BY-SA 4.0
2017-01-31T10:34:49.637Z
2019-08-05T05:45:12.480Z
2020-06-18T08:32:12.800Z
user18490
<p>How do I classify a point with respect to a plane, returning whether the point is inside, outside, or coplanar?</p>

<p>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.</p>

CC BY-SA 3.0
2017-01-31T09:40:37.783Z
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.
Simon F
CC BY-SA 3.0
2017-01-31T10:24:39.147Z
Clearly my brain is not in gear this morning. Will delete.
Simon F
<c++>
Point respect to plane
MOJOMO
# Point respect to plane

(Asked by: username_0 on 2017-01-31)

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.

**Tags:** c++

> **Comments:**
> **username_1**: 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.  
> **username_1**: Clearly my brain is not in gear this morning. Will delete.  

---

## 1 answers

### Answer by username_2 on 2017-01-31. Score: 2

```
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
    printf("point under sadly...");

```

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 username_1 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.

> **Comments:**
> **username_1**: If you represent your plane by the Normal and a scalar you can avoid the unnecessary expensive of the vector subtract.  
> **username_2**: @username_1. Sure ... feel free to edit my answer and add that as a quicker solution... I just made an answer).  
> **username_1**: Given the number of typos I'm making today ( "expensive of the", good grief!), I don't think I dare.  :-)  
> **username_2**: @username_1 - I'll do it for you...  
> **username_0**: @username_2 yes, that answers my question. Thank you  
> **username_1**: 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  

---

