# Collision of two rigid spheres with spin

I'm trying to create a particle simulation (solar system kind). Until now my particles have no spin so the collision is rather simple

void collide(const Particle& b) {
const Vector3d normal = math::normal(position(), b.position());
const Vector3d relativeVelocity = velocity() - b.velocity();
const double dot = math::dot(relativeVelocity, normal);
const Vector3d work = normal * dot;

_velocity = _velocity - work;
}

Since I've read that particle spin plays a huge part in such simulations I'm trying to implement angular momentum but unfortunately this exceeds my math skills. I tried searching the internet for quite a while now for any source I understand but I'm at the brink of giving up.

How can I integrate particle spin into my code? I can work with any kind of (pseudo) code as long as the variables are somewhat clear. Particles are rigid spheres with mass = volume.

Edit: Dont get hang up on what the simulation is trying to achieve. The task can be simplified down to: Two rigid spheres collide in space. Calculate their motion and spin after the collision.

• You say "...solar system kind.". Your code shows an elastic collision? Like pool balls. Planets are big balls of mush, they never bounce off each other, they glob (technical term LOL) into each other. Rotational velocities have little effect, however orbital momentum is considered part of the total angular momentum that must be conserved which can significantly change final spin. Commented Jul 15 at 14:49
• Solar system kind in the state of rocks and asteroids, far earlier than planet formation. Pool balls are not far away from what I want, just more friction.
– S M
Commented Jul 15 at 14:54
• A lot of asteroids are essentially loose piles of gravel held together by only their own gravity, so they fragment and re-form on collision rather than bouncing rigidly. But maybe your goal isn't realistic solar system simulation? It helps to clarify that so folks don't get hung up on trying to model real astrophysics and material behaviours. Commented Jul 22 at 18:35
• The task can be simplified down to: Two rigid spheres collide in space. Calculate their motion and spin after the collision.
– S M
Commented Aug 4 at 11:07