Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple 2D ball collision help

  1. Nov 9, 2003 #1
    This is a little "high school", i know, but i'm trying to design a simple collision detection program and i need a few formulas, but i can't find them anywhere.

    Here is the problem. I have two balls of equal size and mass in a frictionless, 2D environment. These balls have known velocities (x,y), radii and mass. The balls collide at a given point. An angle can be determined by drawing a line between the centers of each ball, and determining the angle of that line with respect to the x-axis. Knowing all of these, how can i now go about determining the velocities after the collision? and thus, the angle of deflection?

    I'm looking for something like:
    Ball1 Vx, Vy After collision
    Ball2 Vx, Vy After collision.

    Thanks in advance.

  2. jcsd
  3. Nov 9, 2003 #2

    Chi Meson

    User Avatar
    Science Advisor
    Homework Helper

    A few clarifications:

    Is this for "real world" analysis? That is, will the balls be able to spin? Or will they be without significant rotation. And will the collision be perfectly elastic, or will there be some less-than-perfect collisions?

    "Ideal world" calculations are a lot easier.
  4. Nov 9, 2003 #3
    Arg!!! I forgot to say this. Stupid me. Yeah, totally elastic. This is an 'ideal' situation.

  5. Nov 10, 2003 #4
    Hi benny,
    I was working with this exact problem a while back. Apparently, the impulse between the two masses act along the line joining the centers of mass. If the interaction is over a very short period of time, you can regard this impulse as constant in direction. Knowing this, you can resolve the velocity vectors into components that are perpendicular and parallel to the line of action of the force. Then, you can treat the parallel components as a 1D collision. The perpendicular component is unaffected because acceleleration must be parallel to the force. Simply add the results together to get your final velocities.
  6. Nov 10, 2003 #5

    Chi Meson

    User Avatar
    Science Advisor
    Homework Helper

    The short answer to this problem is in the phenomenon of "velocity exchange." IF two particles that have identical mass collide ina perfectly elastic collision, they will each have a final velocity that is identical to the initial velocity of the other.

    This of course never happens perfectly in the real world. In a sample of low-pressure helium, you would get the closest possible approximation of this ideal situation.

    THe math is a bit harder. YOu have to simultaneously consider the conservation of momentum in the "x" direction, the conservation of momentum in the "y" direction, and the conservation of kinetic energy (which is independant of direction).

    You get three formulas, and since M is constant, it keeps cancelling out. (note the " ' " means "after the collision)

    v1x + v2x = v1x' + v2x' (v1x +v2x is a known quantity, call it "A")

    v1y + v2y = v1y' + v2y' (v1y + v2y is "B")

    conservation of KE brings this formula:
    (v1x)^2 + (v1y)^2 + (v2x)^2 + (v2y)^2 [call this "C"]
    = (v1x')^2 + (v1y')^2 + (v2x')^2 + (v2y')^2

    You need at least one more formula (since there are four unknowns)

    EDIT: I just noticed that my forth formula is not correct (I took it out) can someone else take it from here? I gotta go teach a class.
    Last edited: Nov 10, 2003
  7. Nov 10, 2003 #6

    Chi Meson

    User Avatar
    Science Advisor
    Homework Helper

    OK, I'm back, but I'm still blanking on the last part of this problem. THere is a trick to do here and I've forgotten what it is! Hopefully someone else will be slong soon...
  8. Nov 10, 2003 #7
    perhaps http://www.phy.ntnu.edu.tw/java/collision2D/collision2D.html will help those who are almost on the right track.

    It would seem to me that the equation would be something like this:

    V2' = sqrt((cos θ * V2)^2 + (sin β * V1)^2))
    V1' = sqrt((cos θ * V1)^2 + (sin β * V2)^2))

    θ is the angle between the force vector of ball1 and the V1 direction vector, and
    β is the angle between the force vector of ball2 and the V2 direction vector.

    I think this is right if masses are equal, if not then you just multiply the vectors by the mass. Now, the problem is, on a coordinate x,y 2D plane, where right movement is + left -, up + and down -, how can sign be preserved with all the exponents happening? That is, if the equation is right in the first place.

    Last edited by a moderator: Apr 20, 2017
  9. Nov 11, 2003 #8
    I don't mean to sound like i'm egging you guys on, but i find it odd that questions involving much more complex and abstract physical theories are being answered, yet what would seem to me like a fairly simple problem, is causing so much trouble...or apathy, as the case very well may be.

    Stranger still is that i can't find one piece of source code in any language that provides proper 2D elastic ball collisions. Like i said, i find numberous java applets, like the one above, so the source must exist, but there is no code. I would think that any programmer working on any kind of physics system in their code, or collision system, would construct this very system as a FIRST step, i mean, i would. So why then is code so difficult to find? and why are the formulas not more publisized when ball physics seems quite popular?

    The situation is very confusing to me, but not quite as confusing as trying to derive the solution . I need this by tomorrow, so any help, would be VERY much appreciated.

  10. Nov 12, 2003 #9

    Chi Meson

    User Avatar
    Science Advisor
    Homework Helper

    First thing: I made a mistake about the "velocity exchange" bit. THat i sonly for 1-D elastic collisions.

    Second thing:I didn't notice StepenP's post. THat was the missing element, and it seems that you had the formulas correct (but I did not check it out on paper and I can't stand the way formulas look on this forum).

    Third thing: this is not simple. IT is not done in high school and not even in 1st year college (generally, I'm sure there are exceptions. The math is very cumbersome when using algebra, and only less cumbersome when using vector calculus.

    I was really hoping someone else would pipe in on this one because I wanted to see the results. I think that this problem is more time-consuming than most.
  11. Jan 25, 2004 #10
    Last edited: Feb 25, 2004
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook