buffer_along_path

buffer_along_path#

zeroheliumkit.src.utils.buffer_along_path(points: List[tuple | Point], widths: list | float) Polygon[source]#

Calculates a polygon (aka “buffer”) along the path defined by the list of point and widths.

Parameters:
  • points (List[Union[tuple, Point]]) – The points along which the polygon structure is constructed.

  • widths (Union[list, float]) – The widths of the polygon defined by a list or a single value (uniform widths).

Returns:

A polygon object representing the buffer along the path.

Return type:

Polygon

Raises:

ValueError – If the number of points and widths do not match.

Example

>>> points = [(0, 0), (1, 1), (2, 0)]
>>> widths = [1, 2, 1]
>>> result = make_polygon_along_path(points, widths)
>>> print(result)
    POLYGON ((-0.5 0, 0.5 0, 1.5 1, 2.5 0, 1.5 -1, 0.5 -1, -0.5 0))