Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

combined velocity is larger than initial velocity

Tags:

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());

}
like image 603
andgarrett Avatar asked Mar 12 '20 18:03

andgarrett


People also ask

Can initial velocity and final velocity be the same?

Such as distance, displacement, speed, times, velocity, etc. Moving objects are having static or varying velocity. Thus initial velocity and final velocity may be different if the motion is having acceleration. Velocity is the rate of the change in the position of an object relative to time.

In which case initial velocity is equal to final velocity?

If we assume at time instance t= 0, then the same thing happens. initial velocity is equal to final velocity.

How do you compare the initial and final velocity of an object launched at an angle?

Vertical motion is symmetrical - the distance and time are the same in the rise as in the fall; the final velocity will have the same magnitude as the initial velocity but in the opposite direction.

How does initial velocity affect projectile motion?

Initial vertical velocity changes throughout projectile motion. Its magnitude decreases when a object travels upwards and increases when it travels downwards. Initial horizontal velocity remains constant and does not change.


1 Answers

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 moon1, 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 velocity2. 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 travel3. 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.

like image 176
William Miller Avatar answered Sep 30 '22 17:09

William Miller