grid.polylineoffset: Perform Line offset region on Grobs

View source: R/offset.R

grid.polylineoffsetR Documentation

Perform Line offset region on Grobs

Description

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

Usage

polylineoffsetGrob(A, delta, rule = "winding",
             name=NULL, gp=gpar(),  ...) 
grid.polylineoffset(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"

name

A name for the resulting grob.

gp

Graphical parameter settings for the resulting grob.

...

For polylineoffsetGrob, arguments passed on to polyclip::polylineoffset.

Details

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

The result is a new grob. In the case of grid.polylineoffset, 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).

The argument jointype determines what happens at the vertices of each line at polyclip::polylineoffset. See code link polylineoffset.

The argument endtype determines what happens at the beginning and end of each line at polyclip::polylineoffset. See code link polylineoffset.

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

Value

polylineoffsetGrob returns a gTree with offset grob coordinate.

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

Author(s)

Jack Wong

See Also

polylineoffset

Examples

grobLine = linesGrob(x = c(.4, .8, .8, .2, .6), y = c(.3, .3, .8, .8, .6), name = "Line 1")
grid.polylineoffset(grobLine, delta = unit(0.1, "cm"), jointype="square", endtype = "opensquare")

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