Results 1 to 11 of 11

Thread: Circle collision prediction?

  1. #1

    Thread Starter
    Junior Member Caleb's Avatar
    Join Date
    Jan 2001
    Posts
    24

    Unhappy Circle collision prediction?

    Hi! I've been trying to solve this for ages. When you have to circle moving at some point with some velocity... is there a formular to actually predict precisely when it will collide?

    Hope you guys can help
    Thanks.

  2. #2
    New Member
    Join Date
    Feb 2002
    Location
    South Wales
    Posts
    11
    This stuff is a bit complicated... but here are a few equations.

    The one you need is in, I've just included a few more incase you need them and so others know what's going on.

    -----------------------------

    Assume that the initial point is (x, y) and the initial velocity is (vx, vy). We want to advance the particle by t time units.

    1) Compute xx = x + t vx and yy = y + t vy. If xx^2 + yy^2 <= 1, the particle is still in the unit circle and there is no collision. The new
    position is (xx, yy) and the new velocity is the same (vx, vy).

    2) If xx^2 + yy^2 > 1, then there is a collision. Need to find the collision time, tc, the point of collision (xc , yc), and the velocity after collision (vxc , vyc).

    3) To find the point of collision, solve the quadratic equation
    ((1 - )x + xx)^2 + ((1 - )y + yy)^2 = 1
    Pick the root between 0 and 1 and call it root.

    4) The point of collision is given by xc = (1 - root) x + root xx and yc = (1-root) y+root yy. The time of collision is given by tc = root t.

    5) The slope of the tangent to the circle at the point of collision is tangentSlope = -xc / yc . The angle between the velocity and the tangent is given by turnAngle = arctan vy - tangentSlope vx
    vx + tangentSlope vy

    6) The velocites after collision are given by
    vxc = cos(2 turnAngle) vx + sin(2 turnAngle) vy
    vyc = -sin(2 turnAngle) vx + cos(2 turnAngle) vy

    7) Recursively advance (xc , yc) with velocity (vxc , vyc) by t - tc

    --------------------------

    Not 100% on this? Join the gang. I'm still @ 95% trying to solve a pretty hard question.
    Regards,
    Lloyd

  3. #3
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    What exactly do you want.
    Do you want to know when two circles collide?
    Last edited by Bjwbell; Feb 18th, 2002 at 05:04 PM.
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  4. #4

    Thread Starter
    Junior Member Caleb's Avatar
    Join Date
    Jan 2001
    Posts
    24

    yes

    I ment two circle. Sorry for the typo error. :P

    ...... really hard..... hmmmm.....

    That might help... thanks... lloydie

  5. #5
    Junior Member
    Join Date
    Nov 2001
    Posts
    16
    hey there,

    This is one of the things we learned in mechanics last year.

    for each circle apply this formula

    r = current position + t(velocity)

    Call them r1 and r2

    Now if the circles will collide, r1 = r2. (Note you may wish to re arrange the equation of both r1 and r2 before making them equal to each other, for co-efficient purposes)

    Now using the co-efficients of i and j find a value for t which satisfies both equations and that value of t is the time when they will collide.
    Simplicity over efficiency!!!

  6. #6
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    here's two attachments for circles colliding and some other stuff
    Attached Files Attached Files
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  7. #7
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    c
    Attached Files Attached Files
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  8. #8

    Thread Starter
    Junior Member Caleb's Avatar
    Join Date
    Jan 2001
    Posts
    24

    Smile

    Ge... thanks alot...

  9. #9
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Hi

    Hi,

    Can some body give me an algorithm to determine collsion between 3 circles with initial velocities..

    Thanks,
    Pradeep
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  10. #10
    New Member
    Join Date
    Mar 2003
    Posts
    1

    Re: Hi

    Originally posted by pradeepkrao
    Hi,

    Can some body give me an algorithm to determine collsion between 3 circles with initial velocities..

    Thanks,
    Pradeep
    Can the triangles hit eachother at different times, so that 2 hit before the third catches up?

  11. #11
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Deviousdan

    Hi Deviousdan

    Couldnt get you...
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width