offset_polygon
- compas.geometry.offset_polygon(polygon, distance, tol=1e-06)[source]
Offset a polygon (closed) by a distance.
- Parameters
polygon (sequence[point] |
Polygon
) – The XYZ coordinates of the corners of the polygon. The first and last coordinates must not be identical.distance (float | list[tuple[float, float]]) – The offset distance as float. A single value determines a constant offset globally. A list of pairs of local offset values per line segment can be used to create variable offsets.
tol (float, optional) – A tolerance value for intersection calculations.
- Returns
list[[float, float, float]] – The XYZ coordinates of the corners of the offset polygon. The first and last coordinates are identical.
Notes
The offset direction is determined by the normal of the polygon. If the polygon is in the XY plane and the normal is along the positive Z axis, positive offset distances will result in an offset towards the inside of the polygon.
The algorithm works also for spatial polygons that do not perfectly fit a plane.
Examples
>>>