# Elastic collision - Part 4 - Synthesis and reminder

## Reminder and synthesis

##### 1 - Compute angles:

$$\begin{array}{r c l} \alpha_1 &=& atan2(y_2-y_1,x_2-x_1) \\ \beta_1 &=& atan2(y_{u_1},x_{u_1}) \\ \gamma_1 &=&\beta_1-\alpha_1 \\ \alpha_2 &=& atan2(y_1-y_2,x_1-x_2) \\ \beta_2 &=& atan2(y_{u_2},x_{u_2}) \\ \gamma_2 &=&\beta_2-\alpha_2 \end{array}$$

##### 2 - Compute norm of vectors after decomposition

$$\begin{array}{r c l} \|\vec{u_{12}}\| &=& \|\vec{u_1}\|.cos(\gamma_1) \\ \|\vec{u_{11}}\| &=& \|\vec{u_1}\|.sin(\gamma_1) \\ \|\vec{u_{21}}\| &=& \|\vec{u_2}\|.cos(\gamma_2) \\ \|\vec{u_{22}}\| &=& \|\vec{u_2}\|.sin(\gamma_2) \end{array}$$

##### 3 - Compute the norm of sub vectors $$\|\vec{v_{12}}\|$$ and $$\|\vec{v_{21}}\|$$ after collision:

$$\begin{cases} \|\vec{v_{12}}\| = \frac{ (m_1-m_2)\|\vec{u_{12}}\| - 2m_2\|\vec{u_{21}}\| }{m_1+m_2} \\ \|\vec{v_{21}}\| = \frac{ (m_1-m_2)\|\vec{u_{21}}\| + 2m_1\|\vec{u_{12}}\| }{m_1+m_2} \end{cases}$$

##### 4 - Finaly compute the velocity $$\vec{v_1}$$ for body 1:

$$\vec{v_1}=\|\vec{u_{11}}\| \left( \begin{array}{r c l} -sin(\alpha) \\ cos(\alpha) \end{array} \right) + \|\vec{v_{12}}\| \left( \begin{array}{r c l} cos(\alpha) \\ sin(\alpha) \end{array} \right)$$

##### 5 - Compute $$\vec{v_2}$$ in the same way:

$$\vec{v_2}=\|\vec{u_{22}}\| \left( \begin{array}{r c l} -sin(\alpha_2) \\ cos(\alpha_2) \end{array} \right) - \|\vec{v_{21}}\| \left( \begin{array}{r c l} cos(\alpha_2) \\ sin(\alpha_2) \end{array} \right)$$