Implementation of sphere intersection stuff