Generally, run fixBound before this function. The ranges of a
PolySet's X and Y columns define the boundary.
For each discrete polygon, this function determines if the first and
last points lie on a boundary. If both points lie on the same
boundary, it adds no points. However, if they lie on different
boundaries, it may add one or two corners to the polygon.
When the boundaries are adjacent, one corner will be added as
follows:
top boundary + left boundary implies add top-left corner;
top boundary + right boundary implies add top-right corner;
bottom boundary + left boundary implies add bottom-left
corner;
bottom boundary + right boundary implies add bottom-right
corner.
When the boundaries are opposite, it first adds the corner closest to
a starting or ending polygon vertex. This determines a side
(left-right or bottom-top) that connects the opposite boundaries.
Then, it adds the other corner of that side to close the polygon.
Value
PolySet identical to polys, except for possible
additional corner points.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(PBSmapping)
-----------------------------------------------------------
PBS Mapping 2.69.76 -- Copyright (C) 2003-2016 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
/home/ddbj/local/lib64/R/library/PBSmapping/doc/PBSmapping-UG.pdf
Packaged on 2015-04-23
Pacific Biological Station, Nanaimo
All available PBS packages can be found at
http://code.google.com/p/pbs-software/
To see demos, type '.PBSfigs()'.
-----------------------------------------------------------
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PBSmapping/closePolys.Rd_%03d_medium.png", width=480, height=480)
> ### Name: closePolys
> ### Title: Close a PolySet
> ### Aliases: closePolys
> ### Keywords: manip
>
> ### ** Examples
>
> local(envir=.PBSmapEnv,expr={
+ oldpar = par(no.readonly=TRUE)
+ #--- 4 corners
+ polys <- data.frame(
+ PID = c(1, 1, 2, 2, 3, 3, 4, 4),
+ POS = c(1, 2, 1, 2, 1, 2, 1, 2),
+ X = c(0, 1, 2, 3, 0, 1, 2, 3),
+ Y = c(1, 0, 0, 1, 2, 3, 3, 2))
+ plotPolys(closePolys(polys), col=2)
+
+ #--- 2 corners and 1 opposite
+ polys <- data.frame(
+ PID = c(1, 1, 2, 2, 3, 3, 3),
+ POS = c(1, 2, 1, 2, 1, 2, 3),
+ X = c(0, 1, 0, 1, 5, 6, 1.5),
+ Y = c(1, 0, 2, 3, 0, 1.5, 3))
+ plotPolys(closePolys(polys), col=2)
+ par(oldpar)
+ })
>
>
>
>
>
> dev.off()
null device
1
>