[GRASS-dev] Re: [GRASS-user] v.clean tool=prune - 'thresh' interpreted wrong?

Moritz Lennert mlennert at club.worldonline.be
Tue Oct 3 12:26:47 EDT 2006


Maciej Sieczka wrote:
> Moritz Lennert wrote:
> 
>> http://freegis.org/cgi-bin/viewcvs.cgi/grass6/lib/vector/diglib/prune.c?rev=HEAD&content-type=text/vnd.viewcvs-markup
>>
>> There is an explanation of the algorithm at the beginning.
> 
> Thanks, I should have looked into the source code first. My only (poor)
> excuse is being a non-programmer and "mentally handicapped" due to my
> disgraceful pre-Linux/FOSS times ;).
> 
> Moritz suggested that maybe "the threshold only applies in cases of
> change of direction (i.e. angles)". Please note there is no any
> reference to angles or direction in the code or comments. It seems the
> threshold refers to distance only.
> 
> There is a following comment:
> 
> * thresh - the distance that a string must wander from a straight
> *          line before another point is selected.
> 
> As I understand it, this means that if my vertcices are on a straight
> line, at intervals of 10, only a thresh of 10 or more should prune
> them. But, as you can see in my original example, any thresh>=0.03
> prunes them. Do I missunderstand sthing (I'm not sure what the
> "straight line" means here)?
> 
> So we have 2 possibilities:
> 
> 1. If in opposite to my interpretation of the source and manual,
> angles/directions DO have something to do with the pruning thresh,
> please somebody knowledgeable tell me what is that relation, so I can
> fix the part of the manual, that reads "prune: remove vertices in
> threshold from lines (...)".
> 
> 2. If the pruning thresh doesn't depend on angles/directions, how do I
> understand the fact that any thresh>=0.03 prunes points which are at
> intervals of 10 on a straight line?
> 

To plead in Markus' direction: there is a 3rd possibility:

3. Forget about the current pruning implementation and push the 
integration of another algorithm  (Douglas-Peucker). (I know you are 
working on a script, but could this wait until this is done ? Maybe if 
you push hard enough someone will "just do it" - Dylan mentioned it as a 
potentially "fun" project: 
http://grass.itc.it/pipermail/grassuser/2006-August/035529.html ;-) and 
actually links to an implementation in c++, which actually looks like 
more or less usable C to me).

Markus you mentioned the source code on the GMT site. Could you be more 
precise on where to find it ?

Moritz




More information about the grass-user mailing list