Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMichael Tanczos

Posted 07 January 2013 - 12:27 AM

Given two circles c1 and c2 with velocity vectors v1 and v2, it would seem as though what you need to do really is calculate intersection points between two pairs of lines.  

 

This would be my mindset in solving this:

[attachment=13114:circlecollide.gif]

 

I'm not the best at math so I'm taking a shot in the dark without verifying this.   But I'd probably do something to this effect for each circle:

 

1. normalize v1

2. find the perpendicular of v1, let's call it perp_v1

 

If we move away from the center of c1 distance +/- r (radius) we actually have two points still on circle c1.   Something like.. c1.location + perp_v1 * radius

 

You can just use those two points and the normalized v1 to create the two lines shown in red for each circle.  Then it's just a matter of finding the points where the equations for those lines are equal.   There should be four total (circled in blue).   The first intersection point on a circle edge is going to end up being the one closest to both c1 and c2.  Hopefully someone can expand on this.. I'm up later than I should be and my brain in shutting down.  =P

 

Hope this gets things moving a little more.


#1Michael Tanczos

Posted 07 January 2013 - 12:24 AM

Given two circles c1 and c2 with velocity vectors v1 and v2, it would seem as though what you need to do really is calculate intersection points between two pairs of lines.  

 

This would be my mindset in solving this:

[attachment=13114:circlecollide.gif]

 

I'm not the best at math so I'm taking a shot in the dark without verifying this.   But I'd probably do something to this effect for each circle:

 

1. normalize v1

2. find the perpendicular of v1, let's call it perp_v1

 

If we move away from the center of c1 distance +/- r (radius) we actually have two points still on circle c1.   Something like.. c1.location + perp_v1 * radius

 

You can just use those two points and the normalized v1 to create the two lines shown in red for each circle.  Then it's just a matter of finding the points where the equations for those lines are equal.   Hopefully someone can expand on this.. I'm up later than I should be and my brain in shutting down.  =P

 

Hope this gets things moving a little more.

 

 

 

 

 

 


PARTNERS