I have been struggling with a math issue for a game I've been developing. I am in need to find the best starting and ending point for a straight line so that it intersects most of the circles (the blue one always needs to be intersected).
As you can see in the image below I want to be able to calculate that green line based on the given points, where the blue one is required to be intersected. The rule is that the line has to intersect as many circles as possible and should always intersect the blue circle.
I've tried to apply the best fit algorithm but that doesn't really takes intersection into consideration. Would appreciate if someone could help me out solving the math for this.
There will only ba a maximum of 5 circles while calculating the line.
Note: I am not deeply involved into math, only know the basic symbols for it.