Ejemplo n.º 1
0
def side_effect_2(turtle, order, side):

    if order == 1:
        polygon(turtle, side, 5)
    else:
        pos = [turtle.x, turtle.y]
        _dir = turtle.phi
        for i in xrange(5):

            pentaflake(turtle, order - 1, side * 1.6)
            turtle.right(72)
            turtle.forward(side)
    return
Ejemplo n.º 2
0
def side_effect_2(turtle, order, side):

    if order == 1:
        polygon(turtle, side, 5)
    else:
        pos  = [ turtle.x, turtle.y ]
        _dir = turtle.phi
        for i in xrange(5):

            pentaflake(turtle, order - 1, side * 1.6)
            turtle.right( 72 )
            turtle.forward( side )
    return
Ejemplo n.º 3
0
def sierpinski(turtle, order, side):

    A1 = [0, 0]
    A2 = [side / 2., 0]
    A3 = [side / 4., -3**0.5 / 4. * side]

    if order == 1:
        polygon(turtle, side, 3)
    else:
        side /= 2
        shift = np.array([turtle.x, turtle.y])
        for pos in [A1, A2, A3]:
            pos += shift
            turtle.set_pos(pos)
            sierpinski(turtle, order - 1, side)

    return
Ejemplo n.º 4
0
def sierpinski(turtle, order, side):


    A1 = [ 0, 0]
    A2 = [ side / 2., 0]
    A3 = [ side / 4.,  - 3**0.5 / 4. * side]

    if order == 1: 
        polygon(turtle, side, 3)
    else:   
        side /= 2
        shift = np.array( [turtle.x, turtle.y])
        for pos in [ A1, A2, A3]:
            pos += shift
            turtle.set_pos( pos )
            sierpinski(turtle, order - 1, side)
        
    return
Ejemplo n.º 5
0
def side_effect_1(turtle, order, side):

    if order == 1:
        polygon(turtle, side, 5)
    else:
        pos = [turtle.x, turtle.y]
        _dir = turtle.phi
        for i in xrange(10):
            #turtle.set_pos( pos )
            turtle.forward(side)
            turtle.right(72)
            pentaflake(turtle, order - 1, side)
        turtle.penup()
        turtle.forward(side)
        turtle.left(72)
        turtle.forward(side)
        turtle.right(36)
        turtle.forward(side)
        turtle.left(72)
        turtle.forward(side)
        turtle.right(72)
        turtle.pendown()

    return
Ejemplo n.º 6
0
def side_effect_1(turtle, order, side):

    if order == 1:
        polygon(turtle, side, 5)
    else:
        pos  = [ turtle.x, turtle.y ]
        _dir = turtle.phi
        for i in xrange(10):
            #turtle.set_pos( pos )
            turtle.forward( side )
            turtle.right( 72 )
            pentaflake(turtle, order - 1, side)
        turtle.penup()
        turtle.forward( side )
        turtle.left( 72 )
        turtle.forward( side )
        turtle.right( 36 )
        turtle.forward( side )
        turtle.left( 72 )
        turtle.forward( side )
        turtle.right(72)
        turtle.pendown()

    return