简体   繁体   English

组合速度大于初速度

[英]combined velocity is larger than initial velocity

I'm making a billiards game in Java.我正在用 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%.额外速度的数量似乎是 0%-50%。 About 0% on a straight shot and 50% on an extremely wide shot.直射约 0%,极宽射约 50%。 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.这对于非弹性碰撞更直观,特别是当您考虑小行星与地球的月球1碰撞等场景时,典型的撞击速度约为每秒 10 - 20公里 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.如果在这种情况下标量速度是守恒的——即使在 45°(最有可能的)“宽”撞击角下——月球的最终速度也足以将其从地球轨道上弹出。

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 .正如您所指出的,这是因为存在一种情况,即完美弹性碰撞中的标量速度是守恒的(直接碰撞),而非弹性碰撞从不守恒速度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°).考虑两个球之间最简单的弹性碰撞:一个球静止,第二个球撞击第一个“直线”(撞击角为 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 .然而,对于 90° 以外的撞击角,情况并非如此,因为幅度总和未能将矢量分量抵消掉 Say for example you have one ball again at rest and the second ball striking it at 45°.举例来说,你有一个球静止不动,第二个球以 45° 撞击它。 Both balls will then leave the collision at 45° angles from the second ball's initial direction of travel 3 .然后,两个球将与第二个球的初始行进方向3成 45° 角离开碰撞。 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 . 1更大的一个——因为地球最近捕获了第二颗真正的卫星

2 This is, in fact, part of the definition of an inelastic collision. 2这实际上是非弹性碰撞定义的一部分。

3 For additional background on calculating angles of departure see here . 3有关计算出发角的其他背景信息,请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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