Sutherland–Hodgman algorithm: Difference between revisions

Content deleted Content added
Pseudo code: Rename hjeader
Line 10:
The [[Weiler–Atherton]] algorithm overcomes this by returning a set of divided polygons, but is more complex and computationally more expensive, so Sutherland–Hodgman is used for many rendering applications. Sutherland–Hodgman can also be extended into 3D space by clipping the polygon paths based on the boundaries of planes defined by the viewing space.
 
==Pseudo codePseudocode==
 
Given a list of edges in a clip polygon, and a list of vertices in a subject polygon, the following procedure clips the subject polygon against the clip polygon.
Line 22:
'''for''' (int i = 0; i < inputList.count; i += 1) '''do'''
Point current_point = inputList[i];
Point prev_point = inputList[(i + inputList.count - 1) % inputList.count];
Point Intersecting_point = ComputeIntersection(prev_point, current_point, clipEdge)