Collision between a rotating circle and a line segment on a cartesian plane

circlescollision detectiongeometryrotations

I have the following collision detection problem that I am trying to solve:

I have a circle $(x – h)^2 + (y – k)^2 = r^2$ and a line segment $\overline{AB}$ on a cartesian plane. The circle is rotated around the origin $O$. $\overline{AB}$ lies in the path of the circle as it is rotated around $O$.

I am trying to determine the rotation, $R$ around $O$ at which the circle will 'collide' with $\overline{AB}$ (see the linked image). I can solve this iteratively (i.e. incrementally rotate circle 1 around the origin of the reference frame and test for intersection between the circle $\overline{AB}$). However, I would like to know if there is a closed form solution to this problem.

enter image description here

Thanks in advance!

Best Answer

I assume the line is vertical. Otherwise rotate the figure to make it so, and rotate back when the following is done. Or if you prefer, the following gives the coordinates of the point you are looking for in a coordinate system I choose, and you have to make a change of coordinates to find them in your original coordinate system.

I also assume $O$ is at coordinates $(0,0)$, the larger circle $\mathscr C$ has radius $R=\sqrt{h^2+k^2}$, and the vertical line $AB$ cuts the horizontal axis at point $H(a,0)$.

We want the point $M(x,y)$ on $\mathscr C$ such that the circle of center $M$ and radius $r$ is tangent to $AB$. This means that $x+r=a$, and from $x^2+y^2=R^2$ we can find $y$.

Related Question