计算移动球撞击移动线的时间

时间:2015-05-10 19:19:43

标签: java math collision-detection collision

我有一个类似的问题但是虽然我得到了社区的帮助但我无法解决它。

我有以下问题: 球移向移动线。 我想知道球何时碰撞线。

我最好的解决方法: enter image description here

所有变量: f(x) ... The line of the ball movement

g(x) ... The line before it moved

g1(x) ... The line after it moved

g2(x) ... The line after it moved + the radius (when the ball center hits this line, the ball border hits g1(x)

A (Ax, Ay) ... First point of the line before it moved

A1 (A1x, A1y) ... First point of the line after it moved

B (Bx, By) ... Second point of the line before it moved

B1 (B1x, B1y) ... Second point of the line after it moved

Vc (Vcx, Vxy) ... Speed of ball

Va (Vax, Vay) ... Speed for point A

Vb (Vbx, Vby) ... Speed for point B

r ... Radius of the ball

t ... Time of collision

  1. 我计算A1和B1
  2. A1 = (Ax + Vax * t, Ay + Vay * t)

    B1 = (Bx + Vbx * t, By + Vby * t)

    1. 我为g1(x)
    2. 建立了等式

      g1: y1 = k1 * x + d1y = kx + d

      k1 = (B1y-A1y)/(B1x-A1x)k = (dif between y)/(dif between x)

      d1 = A1y - k1 * A1xd = y - kx

      1. 我为g2(x)
      2. 建立了等式

        g2: y2 = k1 * x + d2

        1. 我使用两条平行线(see wikipedia)之间的距离方程计算d2。我知道g1(x)和g2(x)之间的距离是球的半径
        2. r = abs(d2 - d1)/sqrt(k1^2 + 1)

          1. 我为d2

          2. 解决了这个问题
          3. 我为f(x)

          4. 建立了等式

            f: y = k * x + d

            k = Vcy/Vcx

            d = Cy - k * Cx

            1. 我计算交叉点
            2. f(x) = g2(x)

              1. 我解决了这个问题
              2. Microsoft数学和我的TI Nspire CX CAS能够计算除步骤8之外的每一步

                有更简单的方法吗?

                或者你知道任何应该能够解决它的程序吗?

                (我的老问题:click me

1 个答案:

答案 0 :(得分:1)

哪里哪里。 Derive已经工作了一分钟。它永远不会从这样的旅行中回来。有可能还有错误吗?或者说方程不能用代数方法求解?

以下是它试图解决的等式(两分钟):

enter image description here

让我们分手吧:

解决

enter image description here enter image description here

enter image description here enter image description here

代表。

我只记得如何做下标,有点:

enter image description here

enter image description here