예제 #1
0
def test_empty_sub_path():
    assert len(simplify_polygon([[]], 1)) == 1
예제 #2
0
def test_empty_path():
    assert len(simplify_polygon([], 1)) == 0
예제 #3
0
def test_handles_repeats():
    path = [0, 0, 0, 0, 0, 0, 1, 1]
    assert simplify_polygon([path], 1) == [[0, 0, 1, 1]]
예제 #4
0
def test_respects_epsilon():
    path = [0, 0, 1, 1, 0, 10]
    assert simplify_polygon([path], 1) == [[0, 0, 0, 10]]
    assert simplify_polygon([path], 0.1) == [[0, 0, 1, 1, 0, 10]]
예제 #5
0
def test_keeps_non_linear_points():
    path = [0, 0, 0, 5, 0, 7, 10, 10, 0, 15]
    assert simplify_polygon([path], 1) == [[0, 0, 0, 7, 10, 10, 0, 15]]
예제 #6
0
def test_removes_linear_points():
    path = [0, 0, 0, 5, 0, 10, 0, 15]
    assert simplify_polygon([path], 0) == [[0, 0, 0, 15]]