written 2.6 years ago by | • modified 2.6 years ago |
How inside test are performed using odd-parity rules or winding number methods ?
written 2.6 years ago by | • modified 2.6 years ago |
How inside test are performed using odd-parity rules or winding number methods ?
written 2.6 years ago by |
Inside-outside test states, “How can we determine whether or not a point is inside of a polygon”.
Following are the two methods to identify this :
Odd-parity methods :
Following is a simple idea to check whether a point is inside or outside.
Draw a horizontal line to the right of each point and extend it to infinity.
Count the number of times the line intersects with polygon edges.
A point is inside the polygon if either count of intersections is odd or point lies on an edge of polygon. If none of the conditions is true, then point lies outside.
If the point of intersection is also the vertex where two sides met then to handle this case we must look at the other endpoints of the two segments which meet at this vertex.
If these points lie on the same side of the constructed line, then the point in question counts as an even number of intersection.
If they lie opposite side of the constructed line, then the point is counted as a single intersection.
Winding number method :