small optimization: use squared distance for hit test