Skip to main content

Module buffer

Module buffer 

Source
Expand description

Buffer / offset (Minkowski sum with a disk) of polygons, polylines, and points via i_overlay.

  • Polygons: positive distance inflates, negative erodes. A heavy negative buffer may erase or split a polygon — output is therefore a Vec<Polygon>.
  • Polylines: stroked into a buffered polygon strip of width 2 * distance. Open paths.
  • Points: emitted as round polygons of radius distance (approx via i_overlay’s round join).

Negative distance for polylines and points is ignored (an open path or a point has no interior to erode).

Structs§

BufferOpts
Configuration for buffer_polygons.

Enums§

BufferJoin
Join (corner) style applied at vertices of the offset path.

Functions§

buffer_lines
Stroke each polyline into a buffered polygon strip of width 2 * distance.abs(). Open paths (start ≠ end). Negative distance has no meaning here and is treated as its absolute value.
buffer_points
Emit a regular n-gon approximating a disk of radius distance.abs() per input point. Segment count is derived from BufferJoin::Round’s max_segment_angle_rad; other joins default to 32 segments.
buffer_polygons
Inflate (positive) or erode (negative) every polygon. Heavy erosion can split a polygon; the result is therefore a single flat Vec<Polygon>.