[R-sig-Geo] Re: Holes
White.Denis at epamail.epa.gov
White.Denis at epamail.epa.gov
Mon Jan 12 22:38:27 CET 2004
> I'm a bit worried about holes too in the polygon setting, the original
> compiled code in maptools for finding ring direction seems buggy, and
ring
> direction seems to be a typical way of flagging holes as against
> boundaries for fill.
If filling is the main concern, then it may not matter (which direction
inner polygons are recorded). If, in this script,
p <- c(
1,1,
8,1,
8,8,
1,8,
1,1,
2,2,
7,2,
7,7,
2,7,
2,2,
1,1,
3,3,
6,3,
6,6,
3,6,
3,3,
1,1,
4,4,
5,4,
5,5,
4,5,
4,4,
1,1,
NA,NA)
p <- matrix (p, nrow=2, ncol=length(p)/2)
plot (p[1,], p[2,], type="n", axes=FALSE, xlab="", ylab="")
polygon (p[1,], p[2,], col=1)
the directions of the successive inner polygons are reversed, the
graphic result is the same. The fill algorithm evidently uses the
parity feature (fill on, fill off, while crossing successive boundaries
in the direction of shading). The diagonal line showing from (2,2) to
(3,3) is another matter. I wrote Paul Murrell about this a couple of
years ago and he referred me to Ross Ihaka who, Paul said, was working
on new polygon routines.
For topological applications, the tree structure suggested by Barry
Rowlingson seems like an elegant method.
Denis
More information about the R-sig-Geo
mailing list