Hello Behdad, > Thank you Anuj. I really enjoyed observing your work this summer, even though I didn't get to contribute more review.
Thank you for checking it out and for your suggestions. >> Lemma: if the closest point on curve [0,1] is to the endpoint at t=1 and the cubic equation has no real root at t=1, the cubic equation must have at least one real root at some t > 1. >> Similarly, if the closest point on curve [0,1] is to the endpoint at t=0 and the cubic equation has no real root at t=0, the cubic equation must have at least one real root at some t < 0. >> >> As such, you just need to compute all real roots, clamp them to [0,1] and remove duplicates. > > Here's the proof for the first case: Consider the derivative of the distance, called "the function" from here on. It's a continuous function. At t=1 the function is a negative number because of the assumptions. > When t tends towards +infinity, the function approaches +infinity. As such, there exist t > 1 where the function is zero. Thanks for proof. I finally understand what is happening in the code that I have written and can update the comments. Best, Anuj