Beispiel #1
0
def test_point_is_false():
    """
    Test point does not pass
    """
    assert quad.is_convex((1.0, 0.0), (1.0, 0.0), (1.0, 0.0),
                          (1.0, 0.0)) == False
Beispiel #2
0
def test_triangle_is_false():
    """
    Test triangle does not pass
    """
    assert quad.is_convex((0.0, 0.0), (1.0, 0.0), (1.0, 1.0),
                          (0.0, 0.0)) == False
Beispiel #3
0
def test_line_is_false():
    """
    Test line does not pass
    """
    assert quad.is_convex((0.0, 0.0), (1.0, 0.0), (1.0, 0.0),
                          (0.0, 0.0)) == False
Beispiel #4
0
def test_non_convex_2_is_false():
    """
    Test rotated non-convex quad
    """
    assert quad.is_convex((0.0, 0.0), (1.0, 0.0), (1.0, 1.0),
                          (0.7, 0.3)) == False
Beispiel #5
0
def test_non_convex_3_is_false():
    """
    Test non-convex quad
    """
    assert quad.is_convex((0.7, 0.8), (1.0, 0.0), (1.0, 1.0),
                          (0.0, 1.0)) == False
Beispiel #6
0
def test_non_convex_0_is_false2():
    """
    Test non-convex quad
    """
    assert quad.is_convex((0.0, 0.0), (0.2, 0.7), (1.0, 1.0),
                          (0.0, 1.0)) == False
Beispiel #7
0
def test_deformed_convex_is_true():
    """
    Test deformed convex quad
    """
    assert quad.is_convex((0.0, 0.0), (1.1, 0.1), (0.9, 0.8),
                          (0.1, 0.9)) == True
Beispiel #8
0
def test_another_convex_is_true():
    """
    Test another convex quad
    """
    assert quad.is_convex((-1.0, -1.0), (1.0, -1.0), (1.0, 1.0),
                          (-1.0, 1.0)) == True
Beispiel #9
0
def test_convex_is_true():
    """
    Test convex quad
    """
    assert quad.is_convex((0.0, 0.0), (1.0, 0.0), (1.0, 1.0),
                          (0.0, 1.0)) == True
Beispiel #10
0
from quad import is_convex

print(is_convex((2.0, 50.0), (9.0, 40.0), (5.0, 20.0), (0.0, 1.0)))

print(is_convex((-1.0, -1.0), (1.0, -1.0), (1.0, 1.0), (-1.0, 1.0)))