Esempio n. 1
0
def test_init_from_three_points():
    """Test the initalization of Plane from end points."""
    plane = Plane.from_three_points(Point3D(0, 0, 2), Point3D(0, 2, 2),
                                    Point3D(2, 2, 2))
    assert plane.o == Point3D(0, 0, 2)
    assert plane.n == Vector3D(0, 0, -1)
    assert plane.x == Vector3D(1, 0, 0)
    assert plane.y == Vector3D(0, -1, 0)
    assert plane.k == -2

    plane = Plane.from_three_points(Point3D(2, 2, 2), Point3D(0, 2, 2),
                                    Point3D(0, 0, 2))
    assert plane.o == Point3D(2, 2, 2)
    assert plane.n == Vector3D(0, 0, 1)
    assert plane.x == Vector3D(1, 0, 0)
    assert plane.y == Vector3D(0, 1, 0)
    assert plane.k == 2
def test_init_from_three_points():
    """Test the initialization of Plane from end points."""
    plane = Plane.from_three_points(Point3D(0, 0, 2), Point3D(0, 2, 2),
                                    Point3D(2, 2, 2))
    assert plane.o == Point3D(0, 0, 2)
    assert plane.n == Vector3D(0, 0, -1)
    assert plane.x == Vector3D(1, 0, 0)
    assert plane.y == Vector3D(0, -1, 0)
    assert plane.k == -2
    assert round(plane.altitude, 3) == round(-math.pi / 2, 3)
    assert round(plane.azimuth, 3) == 0

    plane = Plane.from_three_points(Point3D(2, 2, 2), Point3D(0, 2, 2),
                                    Point3D(0, 0, 2))
    assert plane.o == Point3D(2, 2, 2)
    assert plane.n == Vector3D(0, 0, 1)
    assert plane.x == Vector3D(1, 0, 0)
    assert plane.y == Vector3D(0, 1, 0)
    assert plane.k == 2
    assert round(plane.altitude, 3) == round(math.pi / 2, 3)
    assert round(plane.azimuth, 3) == 0