Check whether one object overlaps with another in Cartesian coordinates