Skip to contents

Apply buffer outside or inside JamPolygon

Usage

buffer_JamPolygon(
  jp,
  buffer = -0.5,
  steps = 20,
  relative = TRUE,
  verbose = FALSE,
  ...
)

Arguments

jp

JamPolygon with one or more polygons. When multiple polygons are provided, they are combined with union_JamPolygon() so that one overall buffer can be provided.

buffer

numeric buffer, where negative values cause the polygon to be reduced in size.

steps

numeric number of steps, default 200, used to determine relative unit sizes when relative=TRUE (which is default).

relative

logical default TRUE, indicating whether to resize polygons using relative dimensions. Relative units are defined by the minimum negative buffer that results in non-zero area, where relative unit -1 would result in zero area.

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Value

JamPolygon with one polygon, although the polygon could contain multiple disconnected parts.

Examples

DEdf <- data.frame(check.names=FALSE,
   name=c("D", "E"),
   x=I(list(
      c(-3, 3, 3, 0, -3),
      c(-4, 2, 2, -4))),
   y=I(list(
   c(-3, -3, 1.5, 4, 1.5),
   c(-2, -2, 4, 4))),
fill=c("#FFD70055", "#B2222255"))
jp <- new("JamPolygon", polygons=DEdf)
plot(jp)


jp2 <- nudge_JamPolygon(jp, nudge=list(D=c(10, 0)));
jp_jp2 <- rbind2(jp2, buffer_JamPolygon(jp2));
plot(jp_jp2,
   border.lty=c(1, 1, 2),
   fill=c(NA, NA, "gold"));