The minkowski sum of two polygons is the polygon you get when you trace one
polygon around the boundary of the other and adding the covered area to the
boundary. As such it provides an offset with rounded corners for obtuse
angles. The algorithm provided here is an approximation with the allowed
error bound being controlled by the eps
argument. Further, the introduced
corner arcs are estimations of the disc as they are converted to line
segments.
Arguments
- polygon
A
polyclid_polygon
vector. If shorter thanoffset
it will be recycled to the length ofoffset
- offset
An
euclid_exact_numeric
or numeric vector. If shorter thanpolygon
it will be recycled to the length ofpolygon
- arc_segments
The number of segments used to draw a full circle
- eps
The error bound of the approximation
See also
Other polygon offsetting:
skeleton_offset()
Other minkowski sum functions:
minkowski_sum()
Examples
poly <- polyclid::denmark()
plot(poly, col = "grey")
# Negative offset (inset)
ins <- minkowski_offset(poly, -0.05, arc_segments = 10)
euclid_plot(ins, lty = 2)
# Positive offset
off <- minkowski_offset(poly, 0.1, arc_segments = 10)
euclid_plot(off, lty = 3)