3
$\begingroup$

I created a bounce simulation using exactly the formula from Wikipedia. The behavior I observe is not what I would expect in two cases:

  1. When two balls hit off-centre, they act the same as if the impact was face-on. depiction of off-centre collision
    Click for animation

  2. When a small ball hits big ball (with gravity), it bounces back and forth in arc, not around the big ball: animation.

Is this behavior consistent with the inelastic equation formula?

$\endgroup$
  • $\begingroup$ Is this a 2D or a 3D simulation? $\endgroup$ – ja72 Apr 12 '16 at 13:18
  • $\begingroup$ It's 2D simulation. $\endgroup$ – Tomáš Zato Apr 12 '16 at 13:53
  • $\begingroup$ ok, things are easier in 2D. Follow the procedure in my answer. If you want friction it builds upon this. $\endgroup$ – ja72 Apr 12 '16 at 14:34
  • $\begingroup$ I looked at the Wikipedia page and the demonstration says it's a one-dimensional collision, not two. Take another look. $\endgroup$ – Peter R Apr 12 '16 at 18:29
1
$\begingroup$

For a 2D planar simulation with zero friction do the following

Definitions

  • Each body has 3 degrees of freedom. These are $(x_1,y_1,\theta_1)$ and $(x_2,y_2,\theta_2)$ defined at the center of mass.
  • Each body has mass and mass moment of inertia. These are $m_1$, $m_2$ and $Iz_1$, $Iz_2$.
  • The contact is at point A with coordinates $(x_A,y_A)$ and with normal direction from the angle $\psi$ (measured CCW from +x).
  • The coefficient of restitution is $\epsilon$

Representation

  • The velocity of each body before the impact is defined with a 3×1 vector (in planar screw coordinates at the origin) $$\begin{aligned} v_1 &= \begin{pmatrix} \dot{x}_1 + \dot{\theta}_1 y_1 \\ \dot{y}_1 - \dot{\theta}_1 x_1 \\ \dot{\theta}_1 \end{pmatrix} & v_2 &= \begin{pmatrix} \dot{x}_2 + \dot{\theta}_2 y_2 \\ \dot{y}_2 - \dot{\theta}_2 x_2 \\ \dot{\theta}_2 \end{pmatrix} \end{aligned} $$
  • The contact normal (force) direction is $$ n = \begin{pmatrix} \cos \psi \\ \sin\psi \\ x_A \sin\psi - y_A \cos \psi \end{pmatrix}$$ Note that the velocity of body 1 on the contact point, along the contact normal is found by $n \cdot v_1 = n^\top v_1 = (\dot{x}_1+\dot{\theta}_1 (y_1-y_A))\cos\psi + (\dot{y}_1-\dot{\theta}_1 (x_1-x_A))\sin\psi$

  • The inverse inertia matrix for each body is

$$ \begin{aligned}I_{1}^{-1} & =\begin{vmatrix}\frac{1}{m_{1}}+\frac{y_{1}^{2}}{Iz_{1}} & -\frac{x_{1}y_{1}}{Iz_{1}} & \frac{y_{1}}{Iz_{1}}\\ -\frac{x_{1}y_{1}}{Iz_{1}} & \frac{1}{m_{1}}+\frac{x_{1}^{2}}{Iz_{1}} & -\frac{x_{1}}{Iz_{1}}\\ \frac{y_{1}}{Iz_{1}} & -\frac{x_{1}}{Iz_{1}} & \frac{1}{Iz_{1}} \end{vmatrix} & I_{2}^{-1} & =\begin{vmatrix}\frac{1}{m_{2}}+\frac{y_{2}^{2}}{Iz_{2}} & -\frac{x_{2}y_{2}}{Iz_{2}} & \frac{y_{2}}{Iz_{2}}\\ -\frac{x_{2}y_{2}}{Iz_{2}} & \frac{1}{m_{2}}+\frac{x_{2}^{2}}{Iz_{2}} & -\frac{x_{2}}{Iz_{2}}\\ \frac{y_{2}}{Iz_{2}} & -\frac{x_{2}}{Iz_{2}} & \frac{1}{Iz_{2}} \end{vmatrix}\end{aligned} $$

Elastic Impact

  • The impact velocity (scalar) is $$v_{imp} = -n^\top (v_2-v_1)$$

  • The inverse effective mass (scalar) along the contact of each body is $$\begin{aligned}\mu_{1}^{-1} & =n^{\top}I_{1}^{-1}n & \mu_{2}^{-1} & =n^{\top}I_{2}^{-1}n\end{aligned} $$

  • The impulse acting on body 2 is $$\boxed{ J = \frac{(1+\epsilon)\;v_{imp}}{\mu_{1}^{-1}+\mu_{2}^{-1}} } $$

  • The impact $J$ acting along $n$ changes the motion of each body by $$ \begin{aligned}\Delta v_{1} & =-I_1^{-1} n\,J & \Delta v_{2} & =I_2^{-1} n\,J\end{aligned} $$

  • The changes in motion are transferred back to the center of mass (change in) velocities $\Delta \dot{x}_1$, $\Delta \dot{y}_1$ and change in spin $\Delta \dot{\theta}_1$ by solving the following definition

$$\begin{aligned} \Delta v_1 &= \begin{pmatrix} \Delta \dot{x}_1 + \Delta \dot{\theta}_1 y_1 \\ \Delta \dot{y}_1 - \Delta \dot{\theta}_1 x_1 \\ \Delta \dot{\theta}_1 \end{pmatrix} & \Delta v_2 &= \begin{pmatrix} \Delta \dot{x}_2 + \Delta \dot{\theta}_2 y_2 \\ \Delta \dot{y}_2 - \Delta \dot{\theta}_2 x_2 \\ \Delta \dot{\theta}_2 \end{pmatrix} \end{aligned}$$

Impact Step

  • The final velocity at the center of mass is changed from the step values

$$\begin{aligned}\dot{x}_{1} & \leftarrow\dot{x}_{1}+\Delta\dot{x_{1}} & \dot{x}_{2} & \leftarrow\dot{x}_{2}+\Delta\dot{x_{2}}\\ \dot{y}_{1} & \leftarrow\dot{y}_{1}+\Delta\dot{y_{1}} & \dot{y}_{2} & \leftarrow\dot{y}_{2}+\Delta\dot{y_{2}}\\ \dot{\theta}_{1} & \leftarrow\dot{\theta}_{1}+\Delta\dot{\theta_{1}} & \dot{\theta}_{2} & \leftarrow\dot{\theta}_{2}+\Delta\dot{\theta_{2}} \end{aligned} $$

$\endgroup$
  • $\begingroup$ Thanks for the answer! However I'm having a lot of trouble to convert differential formulas to code, or even fully understanding them. I don't even remember what that arrow syntax means any more. I understand that's not your fault, but it means I will need some time to process this answer. $\endgroup$ – Tomáš Zato Apr 12 '16 at 14:38
  • $\begingroup$ Treat the $\leftarrow$ as an assignment. It says assign $\dot{x}+\delta$ to $\dot{x}$. As far as the dots, they are just notation. You don't have to actually take a derivative. In code $\dot{x}_1$ would be a single variable xp_1. And $\Delta \dot{x}_1$ would be dxp_1 for example. You would need to code in 3×3 matrix to 3×1 vector multiplication thought. $\endgroup$ – ja72 Apr 12 '16 at 17:17
  • $\begingroup$ Note: I made a correction on the velocity steps results. I forgot to multiply with the inverse inertia matrix to convert momentum (impulse) into speed. $\endgroup$ – ja72 Oct 6 '16 at 12:57
0
$\begingroup$

No. Momentum is still conserved. In particular, the component of momentum parallel to the ground is conserved. So if the ball is going to the right before hitting the ground, it will continue going to the right after.

The formula you refer to is for one-dimensional collisions. That applies only if the elements are arranged so that there actually is motion in only one dimension. Your two balls would deflect off each other because they hit off center. They would each start moving partially in the vertical direction -- with equal components of momentum in the vertical direction.

$\endgroup$
  • $\begingroup$ Can you please suggest correct formula then? Such that properly handles deflecting and is 2D aware? $\endgroup$ – Tomáš Zato Apr 12 '16 at 12:19
  • $\begingroup$ Getting the totally correct behavior is very complicated, because you also need to worry about angular momentum. This is illustrated most strikingly by superballs: if you toss one out ahead of you with a huge backspin, you can get it to bounce back toward you. Obviously, this will become very complicated; you'll get pretty large systems of equations, and you'll need lots of different variables. I don't have time to derive this all for you. Maybe you should just separate the motion into components parallel and perpendicular to the surface of contact and ignore angular momentum. $\endgroup$ – Mike Apr 12 '16 at 14:14
  • $\begingroup$ I decided to postpone rotation for later, but I'm interested in that too. $\endgroup$ – Tomáš Zato Apr 12 '16 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.