I have a line from A to B and a circle positioned at C with the radius R.

What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred?
I have a line from A to B and a circle positioned at C with the radius R.

What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred?
It looks like oval-point collision detection algorithm:
Its' collision, when distance from point C to line AB is less than radius r.
Lua code:
function pointToOvalOverlap (ax, ay, bx, by, r, px, py) -- ax, ay, bx, by - points A and B -- r - radius of oval -- px, py - point inside/outside oval local dx, dy = bx - ax, by - ay local function getDistance(x1, y1, x2, y2) return math.sqrt((x2 - x1)^2 + (y2 - y1)^2) end local t = ((px - ax) * dx + (py - ay) * dy) / (dx^2 + dy^2) t = math.max(0, math.min(1, t)) -- Clamp t to [0, 1] -- nearest point on line AB: local tx, ty = ax + t * dx, ay + t * dy -- distance from point P to nearest point T: local distance = getDistance(px, py, tx, ty) local overlapDistance = math.max (r - distance, 0) if overlapDistance == 0 then -- no overlap return false, 0, 0 else -- overlap -- push-vector to resolve collision: local nx = overlapDistance*(px-tx)/distance local ny = overlapDistance*(py-ty)/distance return true, nx, ny end end