Weiler Atherton Polygon Clipping Algorithm is an algorithm that helps in clipping even concave algorithms to be possible. This algorithm clips the concave polygons without leaving any residue behind unlike Sutherland – Hodgman polygon clipping algorithm.
Algorithm:
Step 1: Select a list of all intersection points, for example, i1, i2, ……
Step 2: Make it as entering or exiting intersection points.
Step 3: From this, make two lists, for clipping and clipped polygon
Step 4: Make sure while filling both lists, the intersection points lie between the correct vertices of each polygon.
Step 5: Start the 'to be clipped' polygon's list.
Step 6: Select the first intersection point which is named as an entering point. Keep on pushing the points in the list into a vector and follow the list until an existing intersection point is found.
Step 7: Switch the list to the 'polygon that is clipping' list, and find the existing intersection which was encountered previously.
Step 8: Follow the points in this list until the entering intersection point is found.
Step 9: By pushing all the encountered points in the two lists, the vector now becomes the clipped polygon
Step 10: From step 5 Repeat this clipping procedure until all the entering intersection points are visited once.
Weiler atherton polygon clipping algorithm:
https://www.geeksforgeeks.org/weiler-atherton-polygon-clipping-algorithm/