s.voronoi: removing duplicate lines
Dave Gerdes
dpgerdes at zorro.cecer.army.mil
Fri Apr 10 14:17:56 EDT 1992
> Date: Wed, 8 Apr 92 15:34:58 -0500
> From: mccauley at ecn.purdue.edu (Darrell McCauley)
> Message-Id: <9204082034.AA15559 at fescue.ecn.purdue.edu>
> Sender: lists-owner at amber.cecer.army.mil
> Reply-To: grassp-list at amber.cecer.army.mil
> Precedence: Bulk
> To: grassp-list at amber.cecer.army.mil
> Subject: s.voronoi: removing duplicate lines
>
>
> How do you remove duplicate lines from vector files?
> I'm talking about lines that should be *exactly* the same.
> Does v.spag work for this? Should this be something to
> consider adding to v.support (I don't think that it has this)?
v.spag will remove 'exact' duplicate lines, but last I checked, it
still had a couple lingering bugs. I wouldn't rely on it, though, I would
think that the cleanness of the voronoi diagram should give it no trouble.
> The problem is the following: I have vertices of polygons
> for a vector map (a Voronoi diagram). All boundaries (except for
> borders) are shared by two polygons. I'm trying to write a vector
> map. I can easily:
> 1. write each line separately (thus producing many duplicates), or
> 2. write each polygon as a line (producing spaghetti code or missing
> nodes AND duplicates lines).
> The correct way of doing this (I guess) would be do store all lines
> (either in a large array or in a tmp file), compare each of them,
> removing duplicates as I find them (perhaps a unique sort), then write
> each as an area edge.
>
> Comments?
The answer is #3. I would think that there are other ways around the
problem, for example never going to polygons in the first place. How
about building a network instead of a bunch of polygons. You should never
have to re-build any given segment more than once anyway. if you are,
I would think you are doing twice the necessary work.
Disclaimer: these are just my uninformed opinions. I have never tried
to implement code to create a voronoi diagram.
>
> BTW, the sun C libs include a quicker-sort (qsort)... can this be
> safely used when thinking of portability (for all platforms on which
> grass is expected to run)?
qsort is portable.
>
> --Darrell
>
>
--
Dave Gerdes
US Army Construction Engineering Research Lab
Spatial Analysis & Systems Team
dpgerdes at cerl.cecer.army.mil
(217) 352-6511 x591
More information about the grass-dev
mailing list