Solved

Can someone quickly explain two circle shapes colliding?

Posted on 2000-05-01
5
150 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 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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