polyoffset: Perform offset region on Grobs

View source: R/offset.R

polyoffsetR Documentation

Perform offset region on Grobs

Description

Given a polygonal region or closed grob, generate the offset region (guard region, buffer region, morphological dilation) formed by shifting the boundary outwards by a specific distance.

Usage

polyoffset(A, delta, reduce = "union", ...)
## S3 method for class 'grob'
polyoffset(A, delta, reduce = "union",
         ...)
## S3 method for class 'gList'
polyoffset(A, delta, reduce = "union",
         ...)
## S3 method for class 'gPath'
polyoffset(A, delta, reduce = "union",
                         ..., strict=FALSE, grep=FALSE, global=FALSE)
## S3 method for class 'character'
polyoffset(A, delta, reduce = "union",
                             ..., strict=FALSE, grep=FALSE, global=FALSE)
## S3 method for class 'list'
polyoffset(A, delta, reduce = "union",
                             ...)

Arguments

A

A set of coordinates describing the subject shape. Or a grob, gList, or a gPath (or a character value) identifying a grob that has already been drawn from which coordinates are generated.

delta

Distance over which the boundary should be shifted.

reduce

A character value describing the operation to be used if A needs to be collapsed to a single shape. One of "intersection", "flatten", "minus", "union", or "xor".

strict, grep, global

Arguments controlling the interpretation of the gPath (passed to grid.get).

...

For polyoffsetGrob, arguments passed on to polyclip::polyoffset.

Details

Calculate the offset region by using the subject coordinates shift by a delta distance.

Examples of useful arguments that will be passed on to polyclip::polyoffset() are jointype.

The argument jointype determines what happens at the vertices of each line.

  • jointype = "round": a circular arc is generated.

  • jointype = "square": circular arc is replaced by a single straight line.

  • jointype = "miter": circular arc is omitted entirely and replaced by a single straight line.

Value

The result is a new set of coordinates for the outline of the offset region.

Author(s)

Jack Wong

See Also

polyoffset

Examples

grob <- rectGrob(width = 0.5, height = 0.5)
offset <- polyoffset(grob, 0.2)

gridGeometry documentation built on Sept. 11, 2024, 8:41 p.m.