Find the center point of a circle traveling on a fixed line where it is tangential to a quadrilateral

48 Views Asked by At

I have a program I am writing where I have a circle that travels along a fixed line that either passes through a quadrilateral or passes a quadrilateral within a distance less than the radius of the circle. I am trying to find the center point of the circle when it is tangent to an edge of the quadrilateral but I have yet to be able to figure out a way to do this. Below is a link to a drawing I made to help explain the proglem. Any help would be greatly appreciated! https://i.stack.imgur.com/fDGVn.jpg

2

There are 2 best solutions below

0
On BEST ANSWER

I often find it’s easiest (and often fast enough) to overgenerate potential solutions and then cull them. Offset the sides of the quad by the radius of the circle and compute the intersections of their extensions with the path of the circle’s center. That will give you up to four potential solutions. A fairly straightforward range check for each one will tell you whether or not the circle centered at that point actually touches the corresponding side of the rectangle. You’ll need to handle the possibility that a side is parallel to the path separately. Depending on what it is you’re trying to accomplish with this, you might also want to compute where on the path the circle intersects the vertices of the quad. You can do that by computing the intersection of a circle centered on each vertex with the path.

0
On

The locus of the possible centers is the "offset" of the quadrilateral, i.e. a curvilinear polygon at distance R of all sides and corners.

enter image description here

You need to find the intersection of the trajectory and this offset curve. This will involve the computation of the intersection of a line with four line segments and four circular arcs.