Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple circle circle collision detection

  1. Dec 30, 2007 #1
    hi all,
    I am testing the collision detection between two circle using classic the distance < sumRadius.

    now i need help to detect the penetration of circles and to resolve the penetration before

    collision reaction
  2. jcsd
  3. Dec 30, 2007 #2

    Doc Al

    User Avatar

    Staff: Mentor

    Can you be clearer about what you are asking? Seems that you are trying to detect whether two circles are overlapping and how far they overlap. Do you have a physics-related question? A math question?
  4. Dec 30, 2007 #3
    ya i need to detect
    1. how far they are overlapping
    2. and need to pull back the circles to the correct position(ie just touching each other, need to avoid overlap)

    thanx in advance
  5. Dec 30, 2007 #4

    Doc Al

    User Avatar

    Staff: Mentor

    I'm still unclear as to what you need. (In your first post it sounded like you knew how to determine when two circles overlap.) When you say that you "need to detect" how far they overlap, what are you given? Is this a math question? I don't quite see the physics question yet.
  6. Dec 30, 2007 #5


    User Avatar

    Staff: Mentor

    Is this a matter of find the point where two circles of different radii (diameters) are tangent? If this is like a scattering problem, then one input would be the impact parameter which is the shortest distance between the parallel lines passing between the centers of the circles. Those lines would also be parallel to the velocity of the circle which is approaching the other.
    Last edited: Dec 30, 2007
  7. Dec 30, 2007 #6
    thanks for showing interest,

    Let me explain, i am detecting collision between two moving circles, i know their X,Y, and radius.
    so in each frame i am checking this condition
    distance_between_circles <= sum_of_their_radii then collision occurs,

    when the circles are moving really fast enough, it skips frames and the collision is detected after one circles penetrates half the other,

    so at the time of collision i don't know which direction the ball came from and collided.

    1.i need to move the circles so that they can just touch each other (not penetrated)

    thats it
  8. Aug 1, 2008 #7
    I'm no physicist but the problem isn't that hard to figure out. What you want to do is rotate one of the circles around the other circle by the angle between their two center points. Once you do that, they are then lying on the x axis. From there you can perform any calculations you want on them then when you're done, just rotate them back. If your using velocities, you'll have to rotate them too. It's easier to think of this problem in one dimension.

    Hope this helps, and hope it's not too late.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Simple circle circle collision detection
  1. A circle of circles (Replies: 3)

  2. Simple circles (Replies: 2)