Skip to content

pygeo.clean_polygon_2d_ex

fabian-flassig edited this page May 18, 2026 · 3 revisions

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

This function is located in the pygeo module.

The function is intended for 2D polygon cleanup in the local u/v plane. The input format follows the loop structure of pytha.create_polygon_ex: each loop contains a point table and may optionally contain a segment table. Arc definitions are segmented internally before the cleanup step. The returned result contains only plain point loops.

pygeo.clean_polygon_2d_ex(
    {{loop_points_1, loop_segments_1} [,{loop_points_2, loop_segments_2} [,...]] }
)
Parameter Type Description
loop_points_i {{u,v}, ...} Coordinates of the loop points in 2D.
loop_segments_i {segment_1, segment_2, ...} Optional specification of the segments. Each segment may be a table with the following fields:
segment_i.angle number Angle of the arc, positive for counter-clockwise arcs.
segment_i.radius number Radius of the arc.
segment_i.orientation "cw" or "ccw" For radius specification: clockwise or counter-clockwise orientation.
segment_i.select_arc "small", "large" For radius specification: select the small or large arc.
segment_i.bulge number Maximum distance between the secant and the arc, positive for counter-clockwise arcs.
segment_i.segments integer Number of edge segments used for arc segmentation.

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 format is analogous to pytha.create_polygon_ex, but the function does not create geometry. It only cleans the loops and returns point coordinates.
  • Segment definitions are resolved internally into point sequences before cleanup.
  • The returned loops contain only point coordinates. Arc, radius, angle and bulge information is not preserved in the result.
  • The result may contain multiple loops even if the input contains only one loop.
  • The outer loop is returned in CCW orientation, inner loops in CW orientation.

Version Support:

Minimum PYTHA Version: V26

See also:

pygeo, pygeo.clean_polygon_2d, pytha.create_polygon_ex, pytha.create_polyline_ex

Clone this wiki locally