clipPolys: Clip a PolySet as Polygons

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/PBSmapping.r

Description

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

Usage

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

Author(s)

Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10

See Also

clipLines, fixBound.

Examples

1
2
3
4
5
6
7
8
local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  #--- 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)
  par(oldpar)
})

Example output

sh: 1: cannot create /dev/null: Permission denied

-----------------------------------------------------------
PBS Mapping 2.70.4 -- Copyright (C) 2003-2018 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/usr/lib/R/site-library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2017-06-28
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
https://github.com/pbs-software

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------

PBSmapping documentation built on Jan. 15, 2021, 3:41 p.m.