mapbox / cheap-ruler

Fast approximations for common geodesic measurements 🌐
https://www.mapbox.com/blog/cheap-ruler/
ISC License
418 stars 32 forks source link

PointOnLine 't' result parameter? #30

Closed mm-ns closed 6 years ago

mm-ns commented 7 years ago

What is the t parameter (since it can also be negative) when you calculate the "PointOnLine" ?

mourner commented 6 years ago

This is actually a bug. We should limit that t to be in the [0, 1] range. It should be a parametric measure of where exactly the closest point on the line is, starting with 0 at points[index] and ending with 1 at points[index + 1].