grid.polyoffset: Perform offset region on Grobs

View source: R/offset.R

grid.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

polyoffsetGrob(A, delta, reduce = "union", rule = "winding",
             name=NULL, gp=gpar(),  ...) 
grid.polyoffset(A, delta, ...)

Arguments

A

A grob, gList, or gTree, or a gPath or a character value identifying a grob that has already been drawn. This is known as the subject grob.

delta

Distance over which the boundary should be shifted.

rule

A character value describing the fill rule to be used. One of "winding", "evenodd"

reduce

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

name

A name for the resulting grob.

gp

Graphical parameter settings for the resulting grob.

...

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

Details

The grobs are converted to coordinates by calling grid::xyListFromGrob.

The result is a new grob. In the case of grid.polyoffset, this new grob will be drawn on the current device. In the special case that A is a gPath, by default, the new grob will replace the old grob (the original grob identified by A) in the current scene (and the new grob will use the same gp settings as the old grob).

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 at polyclip::polyoffset. See code link polyoffset.

The argument rule is a character value describing the fill rule to be used. One of "winding", "evenodd"

Value

polyoffsetGrob returns a gTree with offset grob coordinate.

grid.polyoffset is only used for its side-effect of drawing on the current graphics device.

Author(s)

Jack Wong

See Also

polyoffset

Examples

grob <- rectGrob(width = 0.5, height = 0.5)
offset <- polyoffsetGrob(grob, 0.2)
grid.draw(offset)

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