clipPolys {PBSmapping}R Documentation

Clip a PolySet as Polygons

Description

Clips a PolySet, where each unique (PID, SID) describes a polygon.

Usage

clipPolys (polys, xlim, ylim, keepExtra = FALSE)

Arguments

polys PolySet to clip.
xlim range of X-coordinates.
ylim range of Y-coordinates.
keepExtra Boolean value; if TRUE, tries to carry forward any non-standard columns into the result.

Details

For each discrete polygon, the function connects vertices 1 and N. It recalculates the POS values for each vertex, saving the old values in a column named oldPOS. For new vertices, it sets oldPOS to NA.

Value

PolySet containing the input data, with some points added or removed. A new column oldPOS records the original POS value for each vertex.

See Also

clipLines, fixBound.

Examples

#--- create a triangle that will be clipped
polys <- data.frame(PID=rep(1, 3), POS=1:3, X=c(0,1,.5), Y=c(0,0,1))
#--- clip the triangle in the X direction, and plot the results
plotPolys(clipPolys(polys, xlim=c(0,.75), ylim=range(polys[, "Y"])),
          col=2);

[Package PBSmapping version 2.09 Index]