def test_point_on_line(self): p1 = (-5.0, 5.0) p2 = (10.0, -10.0) test = (3.0, -3.0) dist = point_line_distance(test, p1, p2) assert_almost_equal(dist, 0.0)
def test_vertical_line(self): p1 = (10.0, 10.0) p2 = (10.0, 60.0) test = (30.0, 35.0) dist = point_line_distance(test, p1, p2) assert_equal(dist, 20.0)
def test_diag_lines(self): p1 = (0.0, 0.0) p2 = (10.0, 10.0) test = (0.0, 5.0) dist = point_line_distance(test, p1, p2) assert_almost_equal(dist, 2.5 * sqrt(2.0))
def test_horizontal_line(self): p1 = (10.0, 10.0) p2 = (60.0, 10.0) test = (35.0, 30.0) dist = point_line_distance(test, p1, p2) assert_equal(dist, 20.0)