Geometric Offset#
Closed polygon offset#
- opstool.preprocessing.offset(points, d)[source]#
Offsets closed polygons, same as
opstool.preprocessing.poly_offset()
Parameters#
- pointslist[list[float, float]]
A list containing the coordinate points, [(x1, y1),(x2, y2),…,(xn.yn)].
- dfloat
Offsets closed polygons, positive values offset inwards, negative values outwards.
Returns#
coords: list[[float, float]]
Examples#
>>> import opstool as opst >>> outlines1 = [[0, 0], [0, 1], [1, 1]] >>> outlines2 = opst.offset(outlines1, d=0.1) >>> outlines3 = [[0, 0], [0, 1], [1, 1], [1, 0]] >>> outlines4 = opst.offset(outlines3, d=0.1)
- opstool.preprocessing.poly_offset(points, d)[source]#
Offsets closed polygons, same as
opstool.preprocessing.offset()
Parameters#
- pointslist[list[float, float]]
A list containing the coordinate points, [(x1, y1),(x2, y2),…,(xn.yn)].
- dfloat
Offsets closed polygons, positive values offset inwards, negative values outwards.
Returns#
coords: list[[float, float]]
Non-closed line segment offset#
- opstool.preprocessing.line_offset(points, d)[source]#
Offset a distance from a non-closed line ring on its right or its left side.
Parameters#
- pointslist[list[float, float]]
A list containing the coordinate points, [(x1, y1),(x2, y2),…,(xn.yn)].
- dfloat
Offsets non-closed line ring, negative for left side offset, positive for right side offset.
Returns#
coords: list[[float, float]]
Examples#
>>> import opstool as opst >>> lines = [[0, 0], [0, 1]] >>> lines2 = opst.line_offset(lines, d=0.1) >>> lines = [[0, 0], [0, 1], [1, 1]] >>> lines3 = opst.line_offset(lines, d=0.1) >>> lines = [[0, 0], [0, 1], [1, 0]] >>> lines4 = opst.line_offset(lines, d=0.1)