Two commonly used algorithm :-
1> Odd - Even rule
2>The non - zero winding - number rule.
►1. Odd - Even rule :-
→Also called as odd parity rule or the even-odd rule.
→Draw a line from any position P to a distant point outside the coordinator extents of the closed polyline.
→Then we count the number of line- segments crossing along this line
→If the number of segments crossed by this line is odd, then P is considered to be an interior point, otherwise P is an exterior point.
→We can use this procedure , for example , to fill the interior region between 2 concentric circles or two concentric polygons with a specified colour.
►2. Non Zero Winding - Number rule :-
→This counts the number of times that boundary of an object "winds" around a particular point in the counter clockwise direction termed as winding number.
→Initialize the winding number to 0 and again imagining a line draw from any position P to a distant point beyond the co-ordinate extent of objects.
→The line we choose must not pass through any end point coordinates.
→As we Move along the line from positions P to the distant point, we count the number of object line segments that cross the reference line in each direction.
→We add 1 to the winding number Every time we interact a segment that crosses the line in the direction from right to left and we subtract 1 very time we interact segment that crosses from left to right.
→If the winding number is non - zero. P is considered to be an interior point, otherwise P is an exterior point.