<p>I solved it myself. Here is a result:</p>

<p><a href="https://i.sstatic.net/18HYq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/18HYq.png" alt="enter image description here"></a></p>

<p>The example is out of this post: <a href="https://computergraphics.stackexchange.com/questions/4507/finding-the-nearest-neighbor-of-polygons">here</a></p>

CC BY-SA 3.0
2017-03-19T15:13:27.723Z
It would be great to have a summary of what made the difference and how it helped.
trichoplax is on Codidact now
CC BY-SA 3.0
2017-03-16T15:09:31.147Z
2017-03-16T15:09:31.147Z
2017-04-13T13:00:43.660Z
rr84
<p><a href="https://i.sstatic.net/pp9Ug.png" rel="noreferrer"><img src="https://i.sstatic.net/pp9Ug.png" alt="enter image description here"></a></p>

<p>For a visibility algorithm I want to remove verts of polygon that are guaranteed not visible from a vert S. The idea is to remove pockets that points are on the backside of a plane formed by the vector n, the perpendicular vector between S and 0, and a point S.</p>

<p>The prerequisites are:</p>

<ul>
<li>the points of a polygon are in ccw order</li>
<li>the labeled points are the cutting-points between g(t) and the edges of the polygon

<ul>
<li>sorted by occurrence with respect to S</li>
<li>only the points with a positive t are retained</li>
<li>the points are part of a new created polygon, we are working with</li>
</ul></li>
</ul>

<p>The difficult task is to identify a pocket respectively the pair of indices a pocket starts and ends.</p>

<p>Here are my approaches:</p>

<ol>
<li>Use the natural order of cutting-points and remove items with a smaller t to their previous ones (works on I, III and IV).</li>
<li>Sort the cutting-points by t. If the second point has the highest index in the original order, then all other cutting-points are part of the pocket and can be ignored (works on II).</li>
</ol>

<p>Now the questions are:</p>

<ol>
<li>When should I use the first and when the second approach (I can't see it)?</li>
<li>Is there an easier way?</li>
</ol>

<2d><polygon>
Remove clearly not visible vertices from a polygon
rr84
# Remove clearly not visible vertices from a polygon

(Asked by: username_0 on 2017-03-03)

[![enter image description here](https://i.sstatic.net/pp9Ug.png)](https://i.sstatic.net/pp9Ug.png)

For a visibility algorithm I want to remove verts of polygon that are guaranteed not visible from a vert S. The idea is to remove pockets that points are on the backside of a plane formed by the vector n, the perpendicular vector between S and 0, and a point S.

The prerequisites are:

* the points of a polygon are in ccw order
* the labeled points are the cutting-points between g(t) and the edges of the polygon
  + sorted by occurrence with respect to S
  + only the points with a positive t are retained
  + the points are part of a new created polygon, we are working with

The difficult task is to identify a pocket respectively the pair of indices a pocket starts and ends.

Here are my approaches:

1. Use the natural order of cutting-points and remove items with a smaller t to their previous ones (works on I, III and IV).
2. Sort the cutting-points by t. If the second point has the highest index in the original order, then all other cutting-points are part of the pocket and can be ignored (works on II).

Now the questions are:

1. When should I use the first and when the second approach (I can't see it)?
2. Is there an easier way?

**Tags:** 2d, polygon


---

## 1 answers

### Answer by username_0 on 2017-03-16. Score: 0 | Accepted answer

I solved it myself. Here is a result:

[![enter image description here](https://i.sstatic.net/18HYq.png)](https://i.sstatic.net/18HYq.png)

The example is out of this post: [here](https://computergraphics.stackexchange.com/questions/4507/finding-the-nearest-neighbor-of-polygons)

> **Comments:**
> **username_1**: It would be great to have a summary of what made the difference and how it helped.  

---

