Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can someone quickly explain two circle shapes colliding?

Posted on 2000-05-01
5
Medium Priority
?
156 Views
Last Modified: 2010-08-05
I need to know how to calculate the collision of two circular shapes for a project due in two days.  I have the whole program working (even a computer opponent) and obviously whats missing is the collisions.  I have the code if you need it.  Thanks
0
Comment
Question by:edone73
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 150 total points
ID: 2767729
If C1 (x1,y1) is center of the first circle, and C2 (x2,y2) of the second, calculate distance d from C1 to C2.
   d = sqr((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
Collision is if:
   d < r1+r2
where r1 and r2 are radiuses of the circles.
0
 

Author Comment

by:edone73
ID: 2767795
Hey Ameba, thanks for your answer.  But how bout the angles?  Please help me out.  I really need it.
0
 

Author Comment

by:edone73
ID: 2767817
I need to know how to calculate the angles once i calculate the distance (angles of deflection).
0
 
LVL 15

Expert Comment

by:ameba
ID: 2767825
Thanks for B.
Sorry, cannot help with angles now.
0
 

Author Comment

by:edone73
ID: 2768034
Why Not?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question