<p>First, it's important to realize what &quot;behind&quot; means here, which could be confusing. The way it's being used in this context, &quot;S1 is behind S2&quot; doesn't actually mean that S1 is totally obscured by S2 from the camera position. Rather, it means that S1 is behind the plane containing S2. This means it's impossible for any part of S1 to obscure any of S2, thus S1 should be drawn before S2 in the painter's algorithm.</p>
<blockquote>
<p>why all vertices of one polygon(S1) substitute in the plane of another(S2) and value is less than 0 then we say S1 is behind S2? I don't understand when value less than 0 by the vertices of one polygon then we say one is behind another?</p>
</blockquote>
<p>That's how plane equations work. The equation <span class="math-container">$Ax + By + Cz + D = 0$</span> defines the points on the plane, but in fact it goes further: if you evaluate the left-hand side for a given point, you get a number that tells you how far that point is from the plane, and the sign tells you which side of the plane it's on.</p>
<p>Given the right-hand rule, plane equations are set up so that the front of the polygon (the visible side) is the side that gets positive values in the plane equation. So, all points behind the polygon will get negative values. Thus, if you check all the points of polygon S1, you will know S1 is entirely behind the plane of S2 if all of its vertices get negative values when substituted into S2's plane equation.</p>

CC BY-SA 4.0
2021-11-27T05:59:01.207Z
2021-11-27T05:59:01.207Z
Nathan Reed
<p>TEST #2:
Surface S is completely behind the
overlapping  surface relative to the viewing
position.</p>
<p>S1 is completely behind/inside the overlapping surface S2 <a href="https://i.sstatic.net/5farG.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5farG.jpg" alt="enter image description here" /></a></p>
<p>How to check these conditions?</p>
<p>i) Set the plane equation of S2(Ax + By + Cz + D = 0), such that the surface S2 is towards the viewing position.</p>
<p>ii) Substitute the coordinates of all vertices of Substitute the coordinates of all vertices of S1(x', y',z') into the plane equation of S2 and check for the sign.</p>
<p>iii) If all vertices of S1 are inside S2  then S1 is behind S2. (Fig. 1).</p>
<p>i. e. Ax' + By' + Cz' + D &lt; 0 ,x', y', z' are S1 vertices.</p>
<p>iv) If all vertices of S1 are outside  S2  then S1 in front of S2.</p>
<p>My first question is why all vertices of one polygon(S1) substitute in the plane of another(S2) and value is less than 0 then we say S1 is behind S2? I don't understand when value less than 0 by the vertices of one polygon then we say one is behind another?</p>
<p>My second question  is when Test #2 is passed (i.e. S1 is completely behind/inside the overlapping surface S2) why we coloring S1 first before S2. There is no necessitates to S1 because S1 is totally obscured
by S2. So why we colored S2?</p>

<shader><color><polygon>
Painter's algorithm test 2 and test 3?
S. M.
# Painter's algorithm test 2 and test 3?

(Asked by: username_0 on 2021-11-22)

TEST #2:
Surface S is completely behind the
overlapping surface relative to the viewing
position.

S1 is completely behind/inside the overlapping surface S2 [![enter image description here](https://i.sstatic.net/5farG.jpg)](https://i.sstatic.net/5farG.jpg)

How to check these conditions?

i) Set the plane equation of S2(Ax + By + Cz + D = 0), such that the surface S2 is towards the viewing position.

ii) Substitute the coordinates of all vertices of Substitute the coordinates of all vertices of S1(x', y',z') into the plane equation of S2 and check for the sign.

iii) If all vertices of S1 are inside S2 then S1 is behind S2. (Fig. 1).

i. e. Ax' + By' + Cz' + D < 0 ,x', y', z' are S1 vertices.

iv) If all vertices of S1 are outside S2 then S1 in front of S2.

My first question is why all vertices of one polygon(S1) substitute in the plane of another(S2) and value is less than 0 then we say S1 is behind S2? I don't understand when value less than 0 by the vertices of one polygon then we say one is behind another?

My second question is when Test #2 is passed (i.e. S1 is completely behind/inside the overlapping surface S2) why we coloring S1 first before S2. There is no necessitates to S1 because S1 is totally obscured
by S2. So why we colored S2?

**Tags:** shader, color, polygon


---

## 1 answers

### Answer by username_1 on 2021-11-27. Score: 1 | Accepted answer

First, it's important to realize what "behind" means here, which could be confusing. The way it's being used in this context, "S1 is behind S2" doesn't actually mean that S1 is totally obscured by S2 from the camera position. Rather, it means that S1 is behind the plane containing S2. This means it's impossible for any part of S1 to obscure any of S2, thus S1 should be drawn before S2 in the painter's algorithm.

> why all vertices of one polygon(S1) substitute in the plane of another(S2) and value is less than 0 then we say S1 is behind S2? I don't understand when value less than 0 by the vertices of one polygon then we say one is behind another?

That's how plane equations work. The equation $Ax + By + Cz + D = 0$ defines the points on the plane, but in fact it goes further: if you evaluate the left-hand side for a given point, you get a number that tells you how far that point is from the plane, and the sign tells you which side of the plane it's on.

Given the right-hand rule, plane equations are set up so that the front of the polygon (the visible side) is the side that gets positive values in the plane equation. So, all points behind the polygon will get negative values. Thus, if you check all the points of polygon S1, you will know S1 is entirely behind the plane of S2 if all of its vertices get negative values when substituted into S2's plane equation.


---

