Jump to content
  • Advertisement
Sign in to follow this  
GMaker0507

Moving a circle between two points

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!