Open ecurtiss opened 2 months ago
On second thought, the distance function is actually discontinuous when you take the query point as a parameter. Hence, trying a root-find at the previous time could give you the next closest point, but it is not guaranteed.
Here's an idea for doing a nearest point query that considers all segments:
Thoughts:
This ends up being a minimization problem on a 6th-degree polynomial. If the user is tracking the nearest point over time, then starting the minimization from a nearby reference point could give quick convergence with a basic algorithm. Otherwise, we could find all roots of the derivative in [0, 1] using http://www.cemyuksel.com/research/polynomials/.