Ejemplo n.º 1
0
def test_check_non_zero():
    """Test the check_non_zero method."""
    plane_1 = Plane(Vector3D(0, 0, 1))
    pts_1 = (Point3D(0, 0), Point3D(2, 0), Point3D(2, 2))
    pts_2 = (Point3D(0, 0), Point3D(2, 0), Point3D(2, 0))
    door_1 = Door('Door 1', Face3D(pts_1, plane_1))
    door_2 = Door('Door 2', Face3D(pts_2, plane_1))

    assert door_1.check_non_zero(0.0001, False) is True
    assert door_2.check_non_zero(0.0001, False) is False
    with pytest.raises(Exception):
        assert door_2.check_self_intersecting(0.0001, True)
Ejemplo n.º 2
0
def test_check_self_intersecting():
    """Test the check_self_intersecting method."""
    plane_1 = Plane(Vector3D(0, 0, 1))
    plane_2 = Plane(Vector3D(0, 0, -1))
    pts_1 = (Point3D(0, 0), Point3D(2, 0), Point3D(2, 2), Point3D(0, 2))
    pts_2 = (Point3D(0, 0), Point3D(0, 2), Point3D(2, 0), Point3D(2, 2))
    door_1 = Door('Door 1', Face3D(pts_1, plane_1))
    door_2 = Door('Door 2', Face3D(pts_2, plane_1))
    door_3 = Door('Door 3', Face3D(pts_1, plane_2))
    door_4 = Door('Door 4', Face3D(pts_2, plane_2))

    assert door_1.check_self_intersecting(False) is True
    assert door_2.check_self_intersecting(False) is False
    with pytest.raises(Exception):
        assert door_2.check_self_intersecting(True)
    assert door_3.check_self_intersecting(False) is True
    assert door_4.check_self_intersecting(False) is False
    with pytest.raises(Exception):
        assert door_4.check_self_intersecting(True)