Hacker News new | past | comments | ask | show | jobs | submit login

I’d love to make my own scrolling maps.

Can anyone think of a good algorithm for “unrolling” or nearly “straightening” a wiggly route line so that it could fit in one long narrow straight strip?

It still needs to retain illustrative turns and kinks to help with wayfinding.




Maybe if we cheat with the straight segments to make up for the error?

The idea is that visually a straight road or a road bending with a very large radius are almost impossible to distinguish. Whereas visually a 90 degree left turn is very different from a 10 degree left turn.

For example if you have a simple route plan with 10 mile straight followed by a 90 degree left turn and 10 mile straight again. You could instead draw a 10 mile long circle segment which turns the straight bit slightly to the right side of your strip, then draw an 80 deg turn to the left followed by an other circle segment which bends the route back towards straight.

If you are happy with that solution visually then the algorithm which can generate it for you could be an optimisation with two terms, one which penalises deviations in curvature (penalising more heavily where the original curvature was tight), and an other which penalises the route wiggling too far in either direction away from the centre of the paper strip.

Still not sure how one could handle cases where the route turns 180 or close to it though.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: