Solved

Can someone quickly explain two circle shapes colliding?

Posted on 2000-05-01
5
147 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now