polylineoffset: Perform Line offset region on Grobs

View source: R/offset.R

polylineoffsetR Documentation

Perform Line offset region on Grobs

Description

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

Usage

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

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.

strict, grep, global

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

...

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

Details

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

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.

The argument endtype determines what happens at the beginning and end of each line.

  • endtype = "closedpolygon": ends are joined together (using the jointype value) and the path filled as a polygon.

  • endtype = "closedline": nds are joined together (using the jointype value) and the path filled as a polyline.

  • endtype = "openbutt": ends are squared off abruptly.

  • endtype = "opensquare": ends are squared off at distance delta.

  • endtype = "openround": ends are replaced by a semicircular arc.

Value

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

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")
offset <- polylineoffset(grobLine, delta = unit(0.1, "cm"), 
                        jointype="square", endtype = "opensquare")

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