# Polygon self-intersection, 1

- Author:
- Ryan Hirst

- Topic:
- Intersection, Polygons, Vectors

(Tool-- intersect ray and polygon: http://www.geogebratube.org/material/show/id/96426)

As I have shown before (http://www.geogebratube.org/material/show/id/93239), GGB is in perfect agreement with my Centroid.
But my Centroid is sick.
I want to make it better, but I am in a dilemma:
If k is even, P is outside Jerome
If k is odd, P is inside Jerome
So, in the given figure, the pentagon containing P is

**Cases of self-intersection are ambiguous.**Consider the figure above. The region containing P might be filled, doubly or triply overlapped, or empty. Say, for example, this is a projection onto a plane. Are A5-A7 the points of a closed star? Then where do the lines come from? Perhaps several overlapped triangles. Or perhaps the pentagon containing P is actually empty. The information which determines how the figures relate in space is lost. I might agree to draw the shadow: the smallest wholly enclosed polygonal region whose edges are taken from the given edges. Or I might agree that at any given point on an edge, only one side is shaded. Given only the list of vertices, there is no rule: my choice may be*arbitrary*(I can make up whatever I want). At the same time, different answers will give different results. So I need a working definition of a polygon. Frown. And let us agree right now that point C (the green diamond) is not the Centroid of Jerome,*irrespective of how we choose to resolve the pentagon surrounding P.*For simplicity, I adopt a conventional approach for plane figures: 1. Ignore overlap: a point P in the plane is either inside or outside Jerome. 2. Draw any ray originating from P. Let*k*be the number of times the ray intersects Jerome.*outside*the polygon. And the IsInRegion[] command agrees with Slumberland! .....but the Polygon tool disagrees (the area is shaded). .....as does Centroid[] But neither are Centroid[] and Polygon[] in agreement. So let us fix the problem by defining Polygons for ourselves in a consistent way....