Opened 6 years ago
Last modified 6 years ago
#12933 new Patches
Improve Calculation of Cartesian Point Distances
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.63.0 | Severity: | Optimization |
Keywords: | numeric precision | Cc: |
Description
ISSUE:
in <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
currently the distance between points in cartesian space is calculated via the pythagorean theorem (i.e. sqrt(sum of squared coordinate differences);
While that is theoretically correct, the numerics are "horrible" and a much better alternative with very low implementation effort is available via the "Moler and Morrison" algorithm; its convergence rate is cubic and it completely avoids the intermediate blowup of values. The article can be found online here: http://blogs.mathworks.com/images/cleve/moler_morrison.pdf
TODO: check the benefits of the Moler Morrison algorithm and decide about either replacing the current implementation of point distances in cartesian space or, make the Moler Morrison algorithm available as an alternative.
Thanks for your suggestion