def test_line_point_distance(self): # nan in point a = distance_line_segment(np.array([0, 0]), np.array([0, float("nan")]), 10, 10, 5, 5) np.testing.assert_equal(a, [0, float("nan")]) # distance to the middle of the line segment a = distance_line_segment(np.array(0), 0, 10, 10, 10, 0) self.assertEqual(a, 50**0.5) # equal endpoints a = distance_line_segment(np.array(0), 0, 0, 0, 10, 0) self.assertEqual(a, 10)
def test_line_point_distance(self): # nan in point a = distance_line_segment(np.array([0, 0]), np.array([0, float("nan")]), 10, 10, 5, 5) np.testing.assert_equal(a, [0, float("nan")]) # distance to the middle of the line segment a = distance_line_segment(np.array(0), 0, 10, 10, 10, 0) self.assertEqual(a, 50**0.5) # equal endpoints a = distance_line_segment(np.array(0), 0, 0, 0, 10, 0) self.assertEqual(a, 10)