Пример #1
0
def test_scale_world_origin():
    """Test the Plane scale method with None origin."""
    pt = Point3D(2, 2, 2)
    vec = Vector3D(0, 2, 0)
    plane = Plane(vec, pt)

    new_plane = plane.scale(2)
    assert new_plane.o == Point3D(4, 4, 4)
    assert new_plane.n == Point3D(0, 1, 0)
    assert new_plane.x == plane.x
    assert new_plane.y == plane.y
    assert new_plane.k == 4
Пример #2
0
def test_scale():
    """Test the Plane scale method."""
    pt = Point3D(2, 2, 2)
    vec = Vector3D(0, 2, 0)
    plane = Plane(vec, pt)

    origin_1 = Point3D(0, 2, 2)
    origin_2 = Point3D(1, 1, 2)
    new_plane = plane.scale(2, origin_1)
    assert new_plane.o == Point3D(4, 2, 2)
    assert new_plane.n == Point3D(0, 1, 0)
    assert new_plane.x == plane.x
    assert new_plane.y == plane.y
    assert new_plane.k == 2

    new_plane = plane.scale(2, origin_2)
    assert new_plane.o == Point3D(3, 3, 2)
    assert new_plane.n == Point3D(0, 1, 0)
    assert new_plane.x == plane.x
    assert new_plane.y == plane.y
    assert new_plane.k == 3