Hello!

I'm a java beginner and have recently encountered a problem that I have not been able to solve or find a solution to.

Hopefully this is also in the correct sub-forum.

In my program I have specified aLine2D.double(x1, y1, x2, y2)and I want to check if a circle object of mine collides with it. Therefore I'm currently trying to achieve this by checking how long distance the circle center-point is from any point on the line.

To do this I want to create aPoint[i]object, containing every Point on the line. I know that such a point can be given byy=k*x+mand that I can calculate k throughk=(y2-y1)/(x2-x1)and m throughm = k*x1+y1. What I do not know is how to decide what X to use for properly calculating y to create one point on every pixel displayed by drawing the Line2D object.

So, I wonder,how can I get every point on the line stored in a Point[i]?(or, is there any simpler (I assume there are many more effective methods, but I still don't have the knowledge of doing anything too fancy) way of checking collision between a line and a circle?)The method used to get every point on the line needs to work even if k is approaching Infinity.