Friday, January 29, 2016

New direction vector after collision of spheres



I have a volume in 3-space in which random spheres are spawned in motion. They have the following attributes to them:



  • position known (in three axes)

  • a direction vector (in three axes)

  • a scalar speed

  • a radius (all radii are equal)



I can determine if a collision is made from objects position and radius using the below formula:


$$d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2} - 2r$$


If $d = 0$, then a collision has happened. What I want to know is how to determine the new direction vector after impact. I'm not working with angles.


I considered that if spheres $A$ and $B$ collided, and $A_x > B_x$, then $A$ is to the right of $B$, thus the new direction of movement for $A$ would be $D_x = -D_{old x}$, same thing for $B$, but I'm not sure if this is entirely correct.


If it makes a difference, there's no air resistance or friction.



Answer



Consider the motion of the two spheres in their center of mass frame: that is, the frame of reference moving at a velocity


$$\vec{v_f}=\frac{\vec{v_1}+\vec{v_2}}{2}$$


Subtract that velocity from the "stationary world" coordinates; then perform the analysis below. Finally, add that velocity back to the result.



At the moment the two spheres touch, draw a line between their centers. Along that direction their velocities are reversed; the other component of their velocity (perpendicular to that axis) is unchanged.


So if particle 1 has initial vector $\vec{v_1}$, and the direction of the line connecting the centers at the moment of collision is $\vec{r}$ (normalized), then the velocity along the connecting line is


$$\vec{v_{1a}}=\left(\vec{v_1}\cdot\vec{r}\right)\;\vec{r} $$


and the velocity perpendicular to the connecting line is


$$\vec{v_{1p}} = \vec{v_1}-\vec{v_{1a}}$$


After collision, the "along" velocity is reversed, and the new velocity is


$$\vec{v_{after}}=\vec{v_{1p}} - \vec{v_{1a}}= \vec{v_1}-2\vec{v_{1a}}$$


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...