6 \title{Read/Write polygon data}
8 Read/Write polygon and contour information from/to a text file.
11 read.polyfile(filename, nohole = TRUE)
12 write.polyfile(poly, filename = "GPCpoly.txt")
15 \item{filename}{the name of the file (a character string) from/to which
16 data should be read/written.}
17 \item{nohole}{Is this a polygon without holes?}
18 \item{poly}{an object of class \code{"gpc.poly"}}
21 The text file representation of a polygon is of the following format:
23 <number of contours>\cr
24 <number of points in first contour>\cr
28 <number of points in second contour>\cr
33 For example, a data file for a polygon with 2 contours (a four-sided
34 object and a triangle) might look like:
47 The vertices of the polygon can be ordered either clockwise or
50 If a polygon has contours which are holes, then the format is slightly
51 different. Basically, a flag is set to indicate that a particular
52 contour is a hole. The format is
54 <number of contours>\cr
55 <number of points in first contour>\cr
60 <number of points in second contour>\cr
66 The hole flag is either 1 to indicate a hole, or 0 for a regular
67 contour. For example, a four-sided polygon with a triangular hole
85 If \code{nohole} is \code{TRUE} (the default) \code{read.polyfile}
86 returns an object of class \code{"gpc.poly.nohole"}. This object has
87 the hole flag set to \code{FALSE} for all contours. If \code{nohole} is
88 \code{FALSE}, then an object of class \code{"gpc.poly"} is
91 \code{write.polyfile} does not return anything useful.
93 \author{Roger D. Peng}
96 \code{\link{gpc.poly-class}}, \code{\link{gpc.poly.nohole-class}}