Learn R Programming

gpclib (version 1.0-1)

polyfile: Read/Write polygon data

Description

Read/Write polygon and contour information from/to a text file.

Usage

read.polyfile(filename)
write.polyfile(poly, filename = "GPCpoly.txt")

Arguments

filename
the name of the file (a character string) from/to which data should be read/written.
poly
an object of class "gpc.poly"

Value

  • read.polyfile returns an object of class "gpc.poly". write.polyfile does not return anything useful.

Details

The text file representation of a "gpc.poly" object is the following format: x1 y1 x2 y2 ... x1 y1 x2 y2 ... For example, a data file for a polygon with 2 contours (a four-sided object and a triangle) might look like:

2 4 1.0 1.0 1.0 2.0 3.4 3.21 10 11.2 3 21.0 11.2 22.3 99.2 4.5 5.4 The vertices of the polygon can be ordered either clockwise or counter-clockwise. Right now polygons are not allowed to have holes.

Examples

Run this code
## None right now.

Run the code above in your browser using DataLab