
function did_collide = check_collisions(i_neutron)
% i_neutron: index of neutron
    global neutrons uraniums stables
    colliding_neutron = neutrons(i_neutron);
    for i=1:length(uraniums)
        % only care if a neutron collides with a uranium
        if is_collision(colliding_neutron.position, uraniums(i).position)
            % determine new speeds
            
            % remove uranium
            uraniums(i)=[];
            
            % add two stable particles
            for q=1:2
                stable = Particle;
                stable.type = Particle.STABLE;
                stable.position = colliding_neutron.position;
                stable.direction = [rand*2-1; rand*2-1; rand*2-1];
                stable.direction = stable.direction / norm(stable.direction);
                stable.speed = colliding_neutron.speed*1.1; %TODO conserve momentum

                stables = [stables stable];
            end
            
            % add 3 neutrons
            for q=1:3
                new_neutron = Particle;
                new_neutron.type = Particle.NEUTRON;
                new_neutron.position = colliding_neutron.position;
                new_neutron.direction = [rand*2-1; rand*2-1; rand*2-1];
                new_neutron.direction = new_neutron.direction / norm(new_neutron.direction);
                new_neutron.speed = colliding_neutron.speed*1.1; %TODO conserve momentum
                neutrons(length(neutrons)+1) = new_neutron;
            end
            
            % change direction and speed on old neutron
            colliding_neutron.direction = [rand*2-1; rand*2-1; rand*2-1];
            colliding_neutron.direction = colliding_neutron.direction / norm(colliding_neutron.direction);
            colliding_neutron.speed = colliding_neutron.speed*1.1; %TODO conserve momentum
            neutrons(i_neutron) = colliding_neutron;
            
            did_collide = true;
            return; % break on the first one to only collide with one uranium
        end
    end
    did_collide = false;

end