Defined functions for basic collision detection