def test_arc_extremals(): extremals = helpers.get_extremal_points_of_arc((0, 1), (0, -1), (0, 0), 1) assert len(extremals) == 3 a = extremals[0] b = extremals[1] c = extremals[2] assert helpers.get_line_length(a, (0, 1)) < 0.00001 or helpers.get_line_length(a, (1, 0)) < 0.00001 or helpers.get_line_length(a, (0, -1)) < 0.00001 assert helpers.get_line_length(b, (0, 1)) < 0.00001 or helpers.get_line_length(b, (1, 0)) < 0.00001 or helpers.get_line_length(b, (0, -1)) < 0.00001 assert helpers.get_line_length(c, (0, 1)) < 0.00001 or helpers.get_line_length(c, (1, 0)) < 0.00001 or helpers.get_line_length(c, (0, -1)) < 0.00001 extremals = helpers.get_extremal_points_of_arc((0, 2), (2, 0), (0, 0), 2) assert len(extremals) == 2 a = extremals[0] b = extremals[1] assert helpers.get_line_length(a, (0, 2)) < 0.00001 or helpers.get_line_length(a, (2, 0)) < 0.00001 assert helpers.get_line_length(b, (0, 2)) < 0.00001 or helpers.get_line_length(b, (2, 0)) < 0.00001 extremals = helpers.get_extremal_points_of_arc((2, 1), (2, 0), (2, 0.5), 0.5) assert len(extremals) == 3 a = extremals[0] b = extremals[1] c = extremals[2] assert helpers.get_line_length(a, (2, 1)) < 0.00001 or helpers.get_line_length(a, (2, 0)) < 0.00001 or helpers.get_line_length(a, (2.5, 0.5)) < 0.00001 assert helpers.get_line_length(b, (2, 1)) < 0.00001 or helpers.get_line_length(b, (2, 0)) < 0.00001 or helpers.get_line_length(b, (2.5, 0.5)) < 0.00001
def test_get_line_length(): assert np.abs(helpers.get_line_length((1, 1), (0, 1)) - 1) < 0.00001 assert np.abs(helpers.get_line_length((1, 0), (0, 1)) - np.sqrt(2)) < 0.00001 assert np.abs(helpers.get_line_length((0, 0), (1, 1)) - np.sqrt(2)) < 0.00001