8.
WAVE
WAVE
#1
SAVE AS
>>>
import turtle
>>>
>>>
Pt = turtle.Turtle()
>>>
>>>
def SquareArcAC(radius):
n = radius/57.35
a = n/2
for i in range(4):
Pt.forward(radius)
Pt.left(90)
Pt.forward(a)
Pt.left(1)
for i in range(89):
Pt.forward(n)
Pt.left(1)
Pt.forward(a)
>>>
def SquareArcC(radius):
n = radius/57.35
a = n/2
for i in range(4):
Pt.forward(radius)
Pt.right(90)
Pt.forward(a)
Pt.right(1)
for i in range(89):
Pt.forward(n)
Pt.right(1)
Pt.forward(a)
>>>
>>>
Pt.backward(200)
>>>
Pt.right(90)
>>>
>>> SquareArcAC(100)
>>> SquareArcAC(100)
>>>
>>> SquareArcC(100)
>>> SquareArcC(100)
>>>
>>>
>>> turtle.done()
>>>
SAVE
The tiles used here, are –
SquareArcAC(radius)
Square Arc
Anti-Clockwise
Which turns to the left
SquareArcC(radius)
Square Arc Clockwise
Which turns to the right
POSITION
Firstly,
The Pt has been positioned,
so that the wave will end up being centred in the screen.
Two anti-clockwise Square Arcs,
are followed by,
two clockwise Square Arcs.
This arrangement produces,
the Wave mechanism.
We can simplify the Wave mechanism,
in Wave #2 -
WAVE
#2
SAVE AS
>>>
import turtle
>>>
>>>
Pt = turtle.Turtle()
>>>
>>>
def SquareArcAC(radius):
n = radius/57.35
a = n/2
for i in range(4):
Pt.forward(radius)
Pt.left(90)
Pt.forward(a)
Pt.left(1)
for i in range(89):
Pt.forward(n)
Pt.left(1)
Pt.forward(a)
>>>
def SquareArcC(radius):
n = radius/57.35
a = n/2
for i in range(4):
Pt.forward(radius)
Pt.right(90)
Pt.forward(a)
Pt.right(1)
for i in range(89):
Pt.forward(n)
Pt.right(1)
Pt.forward(a)
for i in range(2):
SquareArcAC(radius)
for i in range(2):
SquareArcC(radius)
>>>
>>>
Pt.backward(200)
>>>
Pt.right(90)
>>>
>>>
Wave(100)
>>>
>>>
>>>
turtle.done()
>>>
SAVE
For a Wave of any size,
we introduced, into the mechanism,
the variable -
radius
Here,
radius =
number of pixels distance,
from the centre of the
rotation,
to its arc,
which is also the length of the side of the square,
in the SquareArc tiles
SquareArcAC(radius) and
SquareArcC(radius)
need to
have radius inside them.
This is
because, they are inside
Wave(radius),
and this
syncs them with
Wave(radius).
Then,
all we have to do,
to draw a wave of a certain size,
is write the Wave(radius) mechanism, in the program,
and put in the size of the radius
that we want, for example -
Wave(100)
(c) Katherine Stuart 2020
Dochas Books Film
No comments:
Post a Comment