Computer Science Related Others Courses AvailableThe Best Codder.blogspot.com

Nonzero Winding Number Rule

 

Nonzero Winding Number Rule

This method is also used with the simple polygons to test the given point is interior or not. It can be simply understood with the help of a pin and a rubber band. Fix up the pin on one of the edge of the polygon and tie-up the rubber band in it and then stretch the rubber band along the edges of the polygon.

When all the edges of the polygon are covered by the rubber band, check out the pin which has been fixed up at the point to be test. If we find at least one wind at the point consider it within the polygon, else we can say that the point is not inside the polygon.

Nonzero Winding

In another alternative method, give directions to all the edges of the polygon. Draw a scan line from the point to be test towards the left most of X direction.

  • Give the value 1 to all the edges which are going to upward direction and all other -1 as direction values.

  • Check the edge direction values from which the scan line is passing and sum up them.

  • If the total sum of this direction value is non-zero, then this point to be tested is an interior point, otherwise it is an exterior point.

  • In the above figure, we sum up the direction values from which the scan line is passing then the total is 1 – 1 + 1 = 1; which is non-zero. So the point is said to be an interior point.

Post a Comment

© Computer Graphics. The Best Codder All rights reserved. Distributed by