I have been working on trying to get an implementation of reciprocal obstacle avoidance working.
I need to find the point tangent to a circle from the origin (0,0). I know how to do this using two circles kind of like the diagram below. I was planning to us the quadratic equation to find the two tangentspoints. http://www.nvcc.edu/home/tstreilein/constructions/Circle/circle5.htm I need both tangent points I know 1: circle center 2: radius 3: And that the tangent points must pass through the origin (0,0). I have not used much trig in many years. Is there a better trigonometry based way? I know how to find the lengths of all sides and the interior angles. But not how to find the tangent points.
Since the tangent is always perpendicular to the line through the center of the circle and the point where the tangent touches the circle, you're dealing with a right angled triangle where you know the hypotenuse (distance from the origin to the center of the circle) and one of the sides (the radius of the circle). So the line segment from the origin to the tangent point on the circle has a length of
L = sqrt(H^2 - R^2)
where H is the length of the line from the origin to the center of the circle and R is the radius of the circle. The angle between the tangent and the line from the origin to the center of the circle is
theta = asin(R/H)
So you can create a vector of length L that is parallel to line from the origin to the center of the circle, and rotate it by +/- theta to get the tangent points.