Skip to content

pygeo.clean_polygon_2d

fabian-flassig edited this page Jun 8, 2026 · 3 revisions

Cleans a 2D polygon loop and returns the cleaned result as one or more loops.

This function is located in the pygeo module.

The function is intended for 2D polygon cleanup in the local u/v plane. Self-intersections, overlaps and similar invalid loop configurations are resolved by the internal pseudo-face cleanup logic. The result is returned as plain point loops without arc descriptions.

pygeo.clean_polygon_2d(points [, options])
Parameter Type Description
points {{u,v}, ...} Coordinates of the input loop points in 2D. The loop is treated as closed.
options {...} Optional: a table that may contain the following options:
options.minimum_winding integer Minimum winding number a region must reach to be kept in the result. Default 1. With 2, only regions that are covered at least twice remain, which corresponds to a boolean intersection (e.g. of two self-overlapping loop parts, each contributing winding 1).

Return value

Type Description
loops {{{u,v}, ...}, ...}

Notes:

  • This is a purely 2D cleanup function. Input and output use u/v coordinates only.
  • The input is a single loop only. If multiple loops or holes are required, use pygeo.clean_polygon_2d_ex.
  • The returned loops contain only point coordinates. Arc, radius, angle and bulge information is not preserved in the result.
  • The result may contain more than one loop if cleanup splits the input into multiple valid loops.
  • The outer loop is returned in CCW orientation, inner loops in CW orientation.
  • options.minimum_winding controls how overlapping regions are resolved: 1 (default) keeps every region inside the polygon (union-like cleanup), while higher values keep only regions covered by at least that many windings. 2 therefore yields a boolean intersection.

Version Support:

Minimum PYTHA Version: V26

See also:

pygeo, pygeo.clean_polygon_2d_ex, pytha.create_polygon, pytha.create_polygon_ex

Clone this wiki locally