示例#1
0
def hexagon():
    hex = group()

    for n in range(5):
        side = hexagon_side()
        set_transform(side, rotation_y(n * pi / 3))
        add_child(hex, side)

    return hex
示例#2
0
def hexagon_edge():
    edge = cylinder()
    edge.minimum = 0
    edge.maximum = 1
    set_transform(
        edge,
        translation(0, 0, -1) * rotation_y(-pi / 6) * rotation_z(-pi / 2) *
        scaling(0.25, 1, 0.25),
    )
    return edge
示例#3
0
    w = world()
    w.light = point_light(point(-10, 10, -10), color(1, 1, 1))

    black = color(0, 0, 0)
    white = color(1, 1, 1)

    floor = plane()
    floor.transform = scaling(0.5, 0.5, 0.5)
    floor.material.color = color(0.9, 0.9, 0.9)
    floor.material.specular = 0.3
    floor.material.pattern = checkers_pattern(black, white)
    floor.material.reflective = 0.6
    w.objects.append(floor)

    left_wall = plane()
    left_wall.transform = (translation(0, 0, 5) * rotation_y(-pi / 4) *
                           rotation_x(pi / 2) * scaling(10, 0.01, 10))
    left_wall.material.specular = 0.7
    left_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(left_wall)

    right_wall = plane()
    right_wall.transform = (translation(0, 0, 5) * rotation_y(pi / 4) *
                            rotation_x(pi / 2) * scaling(10, 0.01, 10))
    right_wall.material.specular = 0.7
    right_wall.material.pattern = stripe_pattern(black, white)
    w.objects.append(right_wall)

    middle = sphere()
    middle.transform = translation(-0.5, 1, 0.5)
    middle.material = material()
def step_impl(context):
    context.full_quarter = rotation_y(pi / 2)
def step_impl(context):
    context.half_quarter = rotation_y(pi / 4)
示例#6
0
def step_impl(context):
    set_transform(context.g1, rotation_y(pi / 2))
示例#7
0
def step_impl(context):
    context.c.transform = rotation_y(pi / 4) * translation(0, -2, 5)
示例#8
0
    w = world()
    w.light = point_light(point(-10, 10, -10), color(1, 1, 1))

    black = color(0, 0, 0)
    white = color(1, 1, 1)

    floor = plane()
    floor.transform = scaling(10, 0.01, 10)
    floor.material.color = color(1, 0.9, 0.9)
    floor.material.specular = 0.1
    floor.material.pattern = checkers_pattern(black, white)
    w.objects.append(floor)

    left_wall = plane()
    left_wall.transform = (
        translation(0, 0, 5) * rotation_y(-pi / 4) * rotation_x(pi / 2)
    )  # * scaling(10, 0.01, 10)
    left_wall.material = floor.material
    w.objects.append(left_wall)

    right_wall = plane()
    right_wall.transform = (
        translation(0, 0, 5) * rotation_y(pi / 4) * rotation_x(pi / 2)
    )  # * scaling(10, 0.01, 10)
    right_wall.material = floor.material
    w.objects.append(right_wall)

    middle = sphere()
    middle.transform = translation(-0.5, 1, 0.5)
    middle.material = material()
    middle.material.color = color(0.1, 1, 0.5)