[R-sig-Geo] Re: holes

Nicholas Lewin-Koh nikko at hailmail.net
Tue Jan 13 15:11:33 CET 2004


Hi Roger,
I thought I fixed the polygon direction code, but I may not have worked
it in to the version
I passed over to you. Sorry. I rember that the original code that came
with the shapelib library
in the contrib section did not work properly, and gave screwy results. I
remember replacing it with an algorithm from O'Rourke (Comp Geom in C)
that worked much better. Let me look in my backups (I think that was 3
computers and 2 jobs ago) and compare with the current maptools. If I
didn't work it in I will send you the code.

I think Barry's idea is great and not hard to implement. Essentially he
is suggesting to store the polygons  ' parts in a red-black tree. You can
refrence the polygon parts by id's and just suck them right out of the
array when plotting.

Nicholas 
> 
> Today's Topics:
> 
>    1. Re: Re: Holes (White.Denis at epamail.epa.gov)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 12 Jan 2004 13:38:27 -0800
> From: White.Denis at epamail.epa.gov
> Subject: Re: [R-sig-Geo] Re: Holes
> To: Roger.Bivand at nhh.no
> Cc: r-sig-geo at stat.math.ethz.ch
> Message-ID:
> 	<OFA14AD050.0A53A95D-ON88256E19.0075ADAD-88256E19.0076D9DC at epamail.epa.gov>
> 	
> Content-Type: text/plain; charset=US-ASCII
> 
> 
> 
> 
> 
> > 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
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-geo
> 
> 
> End of R-sig-Geo Digest, Vol 5, Issue 2
> ***************************************




More information about the R-sig-Geo mailing list