def middle_point(self): """ :return: middle point of area """ l1 = Line(point1=self._top_left, point2=self._bot_right) l2 = Line(point1=self._bot_left, point2=self._top_right) return l1.intersection(l2)
def test_same(self): l1 = Line((-3, 2), (-3, 3)) l2 = Line((-2, 2), (-2, 3)) with self.assertRaises(NoIntersectionError): l1.intersection(l2)
def test_intersection(self): l1 = Line((0, 0), (1, 0)) l2 = Line((0, 0), (0, 1)) self.assertEqual(l1.intersection(l2), (0, 0))