Skip to contents

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.

Usage

minkowski_offset(polygon, offset, arc_segments = 50, eps = 1e-05)

Arguments

polygon

A polyclid_polygon vector. If shorter than offset it will be recycled to the length of offset

offset

An euclid_exact_numeric or numeric vector. If shorter than polygon it will be recycled to the length of polygon

arc_segments

The number of segments used to draw a full circle

eps

The error bound of the approximation

Value

A polyclid_polygon_set vector

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)