Re: [Gpsbabel-misc] Problem with -x position, distance= xxx , all option (GPSBabel 1.3.1 Windows X
Brought to you by:
robertl
From: Ron P. <ro...@pa...> - 2006-10-22 20:33:49
|
Andy Elliott wrote: > Ron > > The additional problem whereby I was getting different points removed > depending on what order I filtered duplicates was down to the method > position.c uses to sort the list of waypoints. The answer is to sort out the > qsort position_comp filter. The existing one was somewhat crude, but quick. > My alternative is: > Nope, that's not going to work either. I guarantee that it'll miss points that are properly close together. The problem is that you can't do a one-dimensional sort and expect it to solve a two-dimensional problem. For this sort, the problem case looks like this: Two points A and B, both more or less 1500km from the 0,0 point but three km from each other. One other point, C, more or less 1501 km from the 0,0 point, and 1 km from A. Depending on what order the two 1500-km points sort, the two close points can end up separated by the point that's further away. That is, you can end up with them sorting B,A,C and missing the B,C pair. I'll admit that this sort routine has the advantage of at least being well-ordered, but it still doesn't solve the problem. I have been working on the code I wrote about in that earlier post, and when it's finished I believe it will solve the problem once and for all and without any significant increase in complexity (it should be O(n log n) just as qsort is.) |