Hello math stackexchange community,
We have x as starting point, v as unit normalized direction, c as center of a circle and r as the radius of the circle.
To find if the line described as x + $\alpha$ v intersects the circle we can take the discriminant of the quadratic equation $||x + \alpha v - c||^2 < r^2$ and conclude if and how many collisions are there.
But how can we find the angle beta so that rotating v by beta would lead to line x + $\alpha$ rotate(v, beta) which doesn't intersect the circle?
Greetings, James!
@Tanny Sieben Thank you! The idea to use the tangent is genius!
The angle between the tangent and the line pointing towards the center of the circle - $x + \alpha q$ - is $gamma = arcsin(r/d)$ where d is the distance from x to c and $q = \frac{c-x}{||c-x||^2}$ unit normalized direction vector.
The angle between $x + \alpha q$ and $x + \alpha v$ is $tau = arccos(q * v)$.
And $beta = gamma - tau$