logo separator

[mkgmap-dev] [PATCH v2] quick distance calculation

From Mark Burton markb at ordern.com on Wed May 20 10:53:22 BST 2009

Added distanceInDegreesSquared() to be used where relative distances
are required (i.e. finding closest city).

Now quickDistance() just calls distanceInDegreesSquared() and applies
the sqrt and scaling.

Still using quickDistance() instead of slowDistance() for all other
distance calculations.



OK, so the parallelisation code has not been very successful so far but
we can still speed up mkgmap.

You have probably noticed that it spends a huge proportion of its time
in Math.acos() which is being called from Coord.distance().

The attached patch renames distance() to slowDistance() and introduces
a new quickDistance() function that is based on the code that was in
the MultipolygonRelation class. I have tested quickDistance() against
slowDistance() and for maps in the UK and Germany it produces distances
that are very similar (within 0.5% or better).

It is substantially faster and so I believe we should change to using
it as long as it doesn't introduce any issues.

So please try out this patch and report:

a - if any breakage is observed

b - performance increase/decrease


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb-quick-distance-v2.patch
Type: text/x-patch
Size: 4889 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20090520/8a711c6d/attachment.bin 

More information about the mkgmap-dev mailing list