A line intersects a circle with center in C (cx,cy)
and radius r
. The line is described by a position P (px, py)
and a direction D (dx, dy)
. P
lies inside the circle and the line is infinitely long. What's the distance d
from P
to the point of intersection?
float Intersect(Vector2d C, float r, Vector2d P, Vector2d D){
...
return d;
}