Sutherland–Hodgman algorithm: Difference between revisions

Content deleted Content added
WP is not a source code repository; that is too long, improperly sourced/attributed, and redundant given the pseudocode
The inside is only on the left side if we proceed counter-clockwise, as stated in the referenced lecture on slide 3
Line 32:
done
 
The vertices of the clipped polygon are to be found in ''outputList'' when the algorithm terminates. Note that a point is defined as being ''inside'' an edge if it lies on the same side of the edge as the remainder of the polygon. If the vertices of the clip polygon are consistently listed in a counter-clockwise direction, then this is equivalent to testing whether the point lies to the left of the line (left means ''inside'', while right means ''outside''), and can be implemented simply by using a [[cross product]].
 
''ComputeIntersection'' is a trivial function, omitted here for clarity, which returns the intersection of a line segment and an infinite edge. Note that it is only called if such an intersection is known to exist, and hence can simply treat both lines as being infinitely long.