encyclopegia.org

Sutherland–Hodgman algorithm

The Sutherland–Hodgman algorithm is an algorithm used for clipping polygons.[src] It works by extending each line of the convex clip polygon in turn and selecting only vertices from the subject polygon that are on the visible side.[src]

The Sutherland&ndash;Hodgman algorithm is an algorithm used for clipping polygons.[src] It works by extending each line of the convex clip polygon in turn and selecting only vertices from the subject polygon that are on the visible side.[src] ==Description== The algorithm begins with an input list of all vertices in the subject polygon.[src] Next, one side of the clip polygon is extended infinitely in both directions, and the path of the subject polygon is traversed.[src] Vertices from the input list are inserted into an output list if they lie on the visible side of the extended clip polygon line, and new vertices are added to the output list where the subject polygon path crosses the extended clip polygon line.[src] This process is repeated iteratively for each clip polygon side, using the output list from one stage as the input list for the next.[src] Once all sides of the clip polygon have been processed, the final generated list of vertices defines a new single polygon that is entirely visible.[src] Note that if the subject polygon was concave at vertices outside the clipping polygon, the new polygon may have coincident (i.e., overlapping) edges &ndash; this is acceptable for rendering, but not for other applications such as computing shadows.[src] The Weiler&ndash;Atherton algorithm overcomes this by returning a set of divided polygons, but is more complex and computationally more expensive, so Sutherland&ndash;Hodgman is used for many rendering applications.[src] Sutherland&ndash;Hodgman can also be extended into 3D space by clipping the polygon paths based on the boundaries of planes defined by the viewing space.[src] ==Pseudocode== 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.[src] List outputList = subjectPolygon; for (Edge clipEdge in clipPolygon) do List inputList = outputList; outputList.clear(); for (int i = 0; i < inputList.count; i += 1) do Point current_point = inputList[i]; Point prev_point = inputList[(i − 1) % inputList.count]; Point Intersecting_point = ComputeIntersection(prev_point, current_point, clipEdge) if (current_point inside clipEdge) then if (prev_point not inside clipEdge) then outputList.add(Intersecting_point); end if outputList.add(current_point); else if (prev_point inside clipEdge) then outputList.add(Intersecting_point); end if done done The vertices of the clipped polygon are to be found in outputList when the algorithm terminates.[src] 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.[src] 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.[src] ComputeIntersection is a function, omitted here for clarity, which returns the intersection of a line segment and an infinite edge.[src] Note that the intersecting point is only added to the output list when the intersection is known to exist, therefore both lines can always be treated as being infinitely long.[src] ==Implementations== A Python implementation of the Sutherland-Hodgman can be found here.[src] ==See also== Other polygon clipping algorithms: Weiler&ndash;Atherton clipping algorithm Vatti clipping algorithm On the subject of clipping: Clipping (computer graphics) Clipping (in rasterisation) Line clipping algorithms == References== Mel Slater, Anthony Steed, Yiorgos Chrysanthou: Computer Graphics and Virtual Environments: From Realism to Real-Time.[src] Addison Wesley, 2002.[src] .[src] Ivan Sutherland, Gary W.[src] Hodgman: Reentrant Polygon Clipping.[src] Communications of the ACM, vol.[src] 17, pp.&nbsp;32–42, 1974 ==External links== Polygon clipping and filling Describes the algorithm using images that are easy to understand.[src] Rosetta Code example[src]

27 sentences · 27 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Sutherland–Hodgman algorithm." encyclopegia.org, 2025, https://encyclopegia.org/wiki/sutherland-hodgman-algorithm. Accessed 28 November 2026.

Chicago

"Sutherland–Hodgman algorithm." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/sutherland-hodgman-algorithm.

APA

encyclopegia.org. (2025). Sutherland–Hodgman algorithm. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/sutherland-hodgman-algorithm

Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

μ-law algorithm

stub · references available

bitap algorithm

stub · references available

QR algorithm

stub · references available

Prim's algorithm

stub · references available

greedy algorithm

stub · references available

Apriori algorithm

stub · references available

Baum–Welch algorithm

stub · references available

Glushkov's construction algorithm

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1321323896 · 0.5 · snapshot enwiki-001321323896

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.