I'd think this would be a standard problem, but I've been searching for hours now and my math is too rusty to figure this out on my own.
Here's the scenario:
We have a ball, represented by a circle with the radius R1, center C1 and vector of trajectory V1.
The ball is inside a larger circle with the radius R2, center C2, and the circle is stationary.
Now, given a position C1a inside the larger circle and the position C1b = C1a + V1, I need to find a point P (if any exists) on the line C1a-C1b such that the shortest distance from P to circle 2 is exactly R1, which means the ball is just touching the outer circle.
For simplicity's sake let us assume that C1a-C1b crosses the outer circle once.
What I've got so far:
- Point P must on the line C1a-C1b, which are, at the moment of calculation, given.
- Point P2 (the touching point of the two circles) must be on the larger circle
- P1-P2's length must be exactly R1
- Point P2 must be on the smaller circle
For the life of me, I can't put that into a decent formula.
P.S. Apologies for the sketch, I lack access to a decent drawing tool at the moment.
