
8 Jun
2021
8 Jun
'21
3:34 p.m.
Hi all, I've noticed that the line simplification in JOSM works different to the one in mkgmap. Both implement a Douglas-Peucker algo, so I wondered why. It turned out that JOSM calculates the distance of point `px` to the line through(!) end-points `p1` and `p2`, while mkgmap calculates the distance to the segment between(1) those points. So, they get the same distance when the perpendicular is on the segment, but very different values when not. This page helps to see the difference: https://karthaus.nl/rdp/ It would be a bit faster to use distToLineSegment() (like JOSM) instead of shortestDistToLineSegment() but I am not sure which result is better. Any thouhts? Gerd