Solved

Can someone quickly explain two circle shapes colliding?

Posted on 2000-05-01
5
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

735 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