[R-sig-Geo] Triangular Tessellation of Polygon
GREGOR Brian J
Brian.J.GREGOR at odot.state.or.us
Mon Jul 23 17:51:43 CEST 2007
I am developing functions to plot 3d maps using the rgl package. I'm
approaching the problem of plotting polygons by dividing polygons into
triangular facets that then can be plotted as surfaces using the
triangles3d function. This has turned out to be somewhat cumbersome
using my approach which is as follows:
1) Use read.shape from maptools to read in a polygon shapefile
2) For each group of vertices describing a polygon:
a) Apply the delaunayn function in the geometry package to get a
Delaunay tessellation
b) Remove triangles that have any segments whose center points
are outside the polygon (using the point.in.polygon function from the sp
package to identify these)
c) Remove triangles that have any segments that cross a line
segment comprising the polygon (using the crossing.psp function from the
spatstat package to identify crossings)
d) Build new triangles for polygon segments that were orphaned
by steps b and c (to be done).
This would be much simpler if there were a function to limit the
tessellation to the interior of the polygon in the first place. Does
anyone have or know of such a function? (Although there might be GIS
tools to do this, I am only interested in a solution in R so that it can
be used in R scripts.)
Brian Gregor, P.E.
Transportation Planning Analysis Unit
Oregon Department of Transportation
Brian.J.GREGOR at odot.state.or.us
(503) 986-4120
More information about the R-sig-Geo
mailing list