written 7.7 years ago by | • modified 7.7 years ago |
Mumbai University > Computer Engineering > Sem 4 > Computer Graphics
Marks: 5 Marks
Year: Dec 2016
written 7.7 years ago by | • modified 7.7 years ago |
Mumbai University > Computer Engineering > Sem 4 > Computer Graphics
Marks: 5 Marks
Year: Dec 2016
written 7.7 years ago by | • modified 7.7 years ago |
Inside-outside Test:
This method is also known as counting number method. While filling an object, we often need to identify whether particular point is inside the object or outside it. There are two methods by which we can identify whether particular point is inside an object or outside.
Odd-Even Rule
Nonzero winding number rule
Odd-Even Rule:
In this technique, we will count the edge crossing along the line from any point (x,y) to infinity. If the number of interactions is odd, then the point (x,y) is an interior point; and if the number of interactions is even, then the point (x,y) is an exterior point. The following example depicts this concept.
From the above figure, we can see that from the point (x,y), the number of interactions point on the left side is 5 and on the right side is 3. From both ends, the number of interaction points is odd, so the point is considered within the object.
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.
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.