0
$\begingroup$

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!

$\endgroup$
6
  • $\begingroup$ You are looking for the point $M$ on the larger circle such that the distance of $M$ to the line is $r$, so that the small circle is tangent to the line. If you know the distance from the line to $O$, and the radius of the larger circle, then you just need Pythagoras' theorem. $\endgroup$ Commented Feb 17, 2020 at 10:54
  • $\begingroup$ Dear Jean-Claude - the point $M$ on the larger circle (the arc-path of the small circle's centroid) which lies tangential to the line segment by the distance $r$ is exactly what I am after (there are two solutions of course in this case). The radius of the large circle is known. Not sure what you mean by 'the distance from the line to $O$'. I assume this is from the point of collision ($P$) to $O$. If this is correct, then this is unknown. It would be great if you could elaborate on your comment! $\endgroup$
    – Dr Thomas
    Commented Feb 17, 2020 at 13:12
  • $\begingroup$ I mean the distance between $O$ and the orthogonal projection of $O$ on $AB$. If you know the equation of the line, it will also do (it's easy to find this distance then). $\endgroup$ Commented Feb 17, 2020 at 13:13
  • $\begingroup$ Thanks again Jean-Claude. Apologies, but I still do not see the Pythagorean geometric solution given the knowns: i.e. the orthogonal projection of $O$ on $AB$ ($O'$), the distance between $O$ and $O'$ ($d$), the radius of the large circle $r_2$ and $r$. Thanks again! $\endgroup$
    – Dr Thomas
    Commented Feb 17, 2020 at 13:52
  • $\begingroup$ @DrThomas What is $\mathbf{\it{R}}$? Is that the distance the center of the small circle must travel from the point $\left(h, k\right)$ to bring about its collision with the line $AB$? $\endgroup$
    – YNK
    Commented Feb 17, 2020 at 15:04

1 Answer 1

1
$\begingroup$

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$.

$\endgroup$
2
  • $\begingroup$ @DavidK Absolutely! Thanks. $\endgroup$ Commented Feb 17, 2020 at 14:47
  • $\begingroup$ Ah, I see! so $a - r = x$, $x^2 + y^2 = R^2$, and $y = \sqrt{R^2 - x^2}$. Perfect... BTW my line segment is always is parallel or perpendicular to the horizontal axis. $\endgroup$
    – Dr Thomas
    Commented Feb 17, 2020 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .