Randomly came across an explanation about this algorithm and realized it would work perfectly to solve the closest point on the curve problem. In some ways, this works a lot better than my other project. But I think the best method would be to mix them. Use this method to find where the global maxima is, and then the other method to improve upon this one. This method is relatively expensive, and takes a while to settle.
Another method of solving this same problem: https://scratch.mit.edu/projects/785717980/ Where I saw it: https://www.chessprogramming.org/Simulated_Annealing