简体   繁体   中英

combined velocity is larger than initial velocity

I'm making a billiards game in Java. I used this guide for collision resolution. During testing, I noticed that there is more velocity between the two collided pool balls after collision. The amount of extra velocity seems to be 0%-50%. About 0% on a straight shot and 50% on an extremely wide shot. I assumed that the combined velocities would remain the same. Is it my code or my understanding of physics that is wrong?

private void solveCollision(PoolBall b1, PoolBall b2) {

    System.out.println(b1.getMagnitude() + b2.getMagnitude());

    // vector tangent to collision point
    float vTangX = b2.getY() - b1.getY();
    float vTangY = -(b2.getX() - b1.getX());

    // normalize tangent vector
    float mag = (float) (Math.sqrt((vTangX * vTangX) + (vTangY * vTangY)));
    vTangX /= mag;
    vTangY /= mag;

    // get new vector based on velocity of circle being collided with
    float NVX1 = b1.getVector().get(0) - b2.getVector().get(0);
    float NVY1 = b1.getVector().get(1) - b2.getVector().get(1);

    // dot product
    float dot = (NVX1 * vTangX) + (NVY1 * vTangY);

    // adjust length of tangent vector
    vTangX *= dot;
    vTangY *= dot;

    // velocity component perpendicular to tangent
    float vPerpX = NVX1 - vTangX;
    float vPerpY = NVY1 - vTangY;

    // apply vector to pool balls
    b1.setVector(b1.getVector().get(0) - vPerpX, b1.getVector().get(1) - vPerpY);
    b2.setVector(b2.getVector().get(0) + vPerpX, b2.getVector().get(1) + vPerpY);

    System.out.println(b1.getMagnitude() + b2.getMagnitude());

}

Not all of this explanation will be strictly on topic, and I will assume minimal foreknowledge to accommodate potential future users - unfortunately some may consequently find it pedantic.


Velocity is not a conserved quantity and therefore the magnitude-sum of velocities before a collision is not necessarily equal to the magnitude-sum of velocities after .

This is more intuitive for inelastic collisions, particularly when you consider a scenario such as an asteroid colliding with Earth's moon 1 , where a typical impact velocity is on the order of 10 - 20 kilometers per second. If scalar velocity was conserved in this case - even at a 'wide' impact angle of 45° (the most probable) - the resulting velocity for the moon would be sufficient to eject it from Earth's orbit.

So clearly scalar velocity is not necessarily conserved for an inelastic collision. Elastic collisions are less intuitive.

This - as you've noted - is because there is a scenario where scalar velocity in a perfectly elastic collision is conserved (a straight-on collision), while inelastic collisions never conserve velocity 2 . This creates an unacceptable incongruence.

To rectify this, we have to treat velocity as a vector instead of a scalar. Consider the simplest elastic collision between two balls: one ball at rest and the second ball striking the first 'straight-on' (impact angle of 90°). The second ball will come to rest and the first will leave the collision with velocity equal to the second's initial velocity. Velocity is conserved - the magnitude-sum of velocities before and after are equal - all is well.

This will not, however, be the case for impact angles other than 90° because the magnitude sum fails to account for vector components canceling out . Say for example you have one ball again at rest and the second ball striking it at 45°. Both balls will then leave the collision at 45° angles from the second ball's initial direction of travel 3 . The two balls will then also have the same velocity component parallel to the initial direction of motion, and equal but opposite perpendicular velocity components. When you take a vector sum the two perpendicular components will cancel and the sum of the two parallel components will recover the initial velocity vector. However, the magnitude of each ball's resulting velocity vector will be larger than the magnitude of the second ball's initial velocity - because the magnitude is calculated by a sum of squared values and therefore does not account for opposing components.

Of course the best approach is not to look at the velocity but at the momentum - it is the conservation of momentum which governs the behaviors outlined above and in terms of momentum the explanation is very simple: it dictates that in a perfectly elastic collision the velocity of the center of mass must not change.


1 The bigger one - since Earth recently captured a second true satellite .

2 This is, in fact, part of the definition of an inelastic collision.

3 For additional background on calculating angles of departure see here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM