Beispiel #1
0
def test_points_in_poly_array_one_element():

    assert np.array_equal(PinP.points_in_poly(poly1, ((0.5, 0.5, 0.0),
                          )), np.array((True, )))

    assert np.array_equal(PinP.points_in_poly(poly1, ((1.5, -0.5, 0.0),
                          )), np.array((False, )))
Beispiel #2
0
def test_points_in_poly_array_one_element():

    assert np.array_equal(PinP.points_in_poly(poly1, ((0.5, 0.5, 0.0), )),
                          np.array((True, )))

    assert np.array_equal(PinP.points_in_poly(poly1, ((1.5, -0.5, 0.0), )),
                          np.array((False, )))
Beispiel #3
0
def test_float():
    poly = ((-50, -30), (-50, 30), (50, 30), (50, -30))
    poly = np.array(poly, dtype=np.float64)

    # assert PinP.CrossingsTest( poly, (0, 0) ) is True

    assert PinP.CrossingsTest(poly, (100.0, 1.0)) is False
Beispiel #4
0
def test_points_in_poly_array():
    points = np.array((
        (0.5, 0.5, 0.0),
        (1.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
        (-0.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
    ))

    result = np.array((
        True,
        False,
        True,
        True,
        False,
        True,
    ))

    assert np.array_equal(PinP.points_in_poly(poly2, points), result)
Beispiel #5
0
def test_points_in_poly_array():
    points = np.array((
        (0.5, 0.5, 0.0),
        (1.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
        (-0.5, 0.5, 0.0),
        (0.5, 0.5, 0.0),
        ))

    result = np.array((
        True,
        False,
        True,
        True,
        False,
        True,
        ))

    assert np.array_equal(PinP.points_in_poly(poly2, points), result)
Beispiel #6
0
def test_points_in_poly_scalar():

    assert PinP.points_in_poly(poly1, (0.5, 0.5, 0.0)) is True

    assert PinP.points_in_poly(poly1, (1.5, 0.5, 0.0)) is False
Beispiel #7
0
def test_outside2():
    assert PinP.CrossingsTest(poly2, (2, 2)) is False
Beispiel #8
0
def test_on_vertex():
    assert PinP.CrossingsTest(poly1, (1, 1)) is True
Beispiel #9
0
def test_inside2():
    assert PinP.CrossingsTest(poly2, (0.5, 0.5)) is True
Beispiel #10
0
def test_points_in_poly_scalar():

    assert PinP.points_in_poly(poly1, (0.5, 0.5, 0.0)) is True

    assert PinP.points_in_poly(poly1, (1.5, 0.5, 0.0)) is False