I have an array of circles whose diameters and spacing is uniform and arbitrary. (I wish I could post a picture) There are several points, all outside the circle perimeters, whose locations are random x, y coordinates. From each point is a line whose direction is a random theta. The question is as follows: what is the distance from the randomly generated points to the perimeter of the circle that lies on the trajectory of the line with angle theta. The array is not continuous so for some lines the distance will be infinity.

  • $\begingroup$ Just to make sure, you basically have some half-line, and you want the distance from the origin of that half-line to the "first" intersection of that half-line with the array of circles? Or is it the distance from the point to a circle, where you chose the circle as the first one being intersected by the half-line? $\endgroup$
    – N.Bach
    May 23, 2017 at 16:49
  • $\begingroup$ If I understand your question come correctly then it would be the latter. I think I have figured it out myself but I haven't posted an answer because I have not yet tested it. My algorithm is as follows: I know the "equations" of each circle and the "equations" of each line. I can then substitute the equation of each line into the equation of each circle to find the points of intersection detailed here: math.stackexchange.com/questions/228841/… ... $\endgroup$ May 23, 2017 at 16:59
  • $\begingroup$ I can then use the distance formula to find the distance from the origin to the intersection points and choose the shortest distance. The intersection points must meet conditions for the given theta to account for the direction of the line since I do not want intersections on the line going the other direction from the origin. $\endgroup$ May 23, 2017 at 17:00
  • $\begingroup$ From your answers to my comment, to me it seems like it is the former: you compute distance between "intersection of your line with circle" and the "origin of the half-line". Anyway, what you described works. $\endgroup$
    – N.Bach
    May 23, 2017 at 17:14


You must log in to answer this question.

Browse other questions tagged .