how to find intersections between a line and a circle?
for simplicity, assume the circle is located at (0,0) and has radius 1:
x1:
y1:
x2:
y2:
Step 1: Create a line (yellow) through the circle's center, which is perpendicular to the actual line.
Step 2: Find the point where those two lines intersect, and check if it is within the circle.
Step 3: Use a triangle in the circle (purple) to determine the actual intersection point(s).
Implementation: