Search code examples
computational-geometrymathematical-optimization

Optimum point on the circumference of a circle


I am trying to write a code to find an optimum point along the circumference of a circle.

Say there is a circle defined in 3D space, such that I know its radius and the plane that it lies on. I also know the location of the centre of the circle.

I also have a point outside of this circle, and I know its 3D location. I want to find the point on the circumference of the circle that is closest to this outside point.

What is the most efficient way to compute this?


Solution

  • Analytic solution:

    First: Make a projection of your point to the plane the circle lies in: Wikipedia. This way the problem gets 2D.

    Second: Draw a line between the prjection and the center of the circle. Where you cross the circumference you have your point

    Mathematical Optimization Solution:

    Select three optional points on the circumference of your circle and calculate each distance to your point. Take the two point with the smaller distance.

    Then take a new third point that lies axactly between these two points (on the circumference) and calculate it's distance to your point.

    Do this until you have a point that is close enough.