Polygon Offsetting
You can offset a list of Polygon
s polys
by an amount amount
like this:
>>> result = Polygon.offset(polys, amount)
Again, the return variable will be a list of Polygon
s since offsetting may create additional polygons.
Positive values for amount
result in a growing of the polygons, negative values result in shrinking by that amount.
You may specify an optional tip_decorator
argument which takes a reference to a tip decorator function of the type f(a,b, c,d, is_cw)
. The tip decorator function will return a list of additional vertices to insert between the line segments (a,b) and (c,d) to make them look nicer. The is_cw
variable specifies the orientation of the line segments. As an example for a tip decorator function, have a look at the default “pointy” tip decorator from the Py2D source:
def tip_decorator_pointy(a,b, c,d, is_cw):
intersection = intersect_line_line(a,b,c,d)
return [intersection]