# Moving a circle between two points

This topic is 3696 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I wanted to know how i could tell if a circle could go in between two points without hitting then, and at what angle would this best be done.

##### Share on other sites
The direction of motion which allows the largest circle to pass is the direction perpendicular to the line obtained by joining the two points. A circle can pass in that direction between the points without intersecting them only if its diameter is less than the distance between the two points.

##### Share on other sites
thanks, now how about if it approaches not head on but at an angle

##### Share on other sites
In the general case of the circle approaching at an angle theta to the line joining the two points, the circle's diameter must be less than [sin(theta) x (distance between two points)] to pass between them. To convince yourself of this condition, draw a diagram where the circle touches just one of the points and then construct a line which is a tangent to the circle and on which the second point lies.

##### Share on other sites
I think the circle could fit through if distanceBetweenPoints * cos(angle) > diameterOfCircle.

That of course assumes the circle travels in a straight line as it passed between the points.

##### Share on other sites
Very roughly you can just aim at the midpoint between the two points.

If you want to be more precise then you can calculate the minimum safe distance to pass each point. This gives you an interval from which you can pick the midpoint for the safest shot. If the interval is 'negative' then you know it's impossible. If you allow for the circle to do physics and bounce off the point and then go in, it probably gets even more complicated.

To calculate the minimum safe distance to get the circle past a point, imagine that the point is a circle and the circle is a point and now you're shooting the point so it just clips the circle. [Bleh, getting interrupted. I'll finish this in a bit.]

##### Share on other sites
okay, how would i find the angle to perfectly fit inside

##### Share on other sites
What are you actually trying to accomplish? We really need to know this before you can expect a full answer. Also, my first post should effectively answer your most recent question. Turn the inequality into an equation and solve to find:
theta = arcsin((diameter of circle) / (distance between two points))

##### Share on other sites
not sure this is the best way to do it, but making a pool game and have 12 vertices that mark the corners that turn into the pockets

##### Share on other sites
Ah, now I understand what you're trying to accomplish... This sounds like a sensible way to check whether the ball will be potted, though of course it won't be completely reliable. However, I suspect it may be best just to use the physics engine to simulate everything.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634092
• Total Posts
3015437
×