We will use the 5 pixel grid to trace out this image. The image of this is shown below:
- Lift up the pen
- Set the pen size to 40
- Move the pen to the location (40, 0)
- Place the pen down
- Move forward by 70 pixels
- Lift up the pen
- Move the pen to the location (-40, 0)
- Set the heading of the pen to 180 degrees
- Place the pen down
- Move forward by 70 pixels
- Lift up the pen
- Move the pen to the position (-170, 50)
- Set the heading of the pen to 90 degrees
- Place the pen down
- Move forward by 120 pixels
- Set the heading of the pen to 0 degrees
- Move forward by 120 pixels
- Lift up the pen
- Move the pen to the position (-170, 50)
- Set the heading of the pen to 270 degrees
- Place the pen down
- Move forward by 120 pixels
- Set the heading of the pen to 0 degrees
- Move forward by 120 pixels
- Lift up the pen
- Move the pen to the position (170, 50)
- Set the heading of the pen to 90 degrees
- Place the pen down
- Move forward by 120 pixels
- Set the heading of the pen to 180 degrees
- Move forward by 120 pixels
- Lift up the pen
- Move the pen to the position (170, -50)
- Set the heading of the pen to 270 degrees
- Place the pen down
- Move forward by 120 pixels
- Set the heading of the pen to 0 degrees
- Move forward by 120 pixels
Using Turtle Graphics
We will use the template.py file and rename it to wuforo.py.
The code of the first five steps is given below:
turtle.penup()
turtle.pensize(40)
turtle.setposition(40, 0)
turtle.pendown()
turtle.forward()
The generated image is shown below:
The code for steps 6 to 10 is simply to repeat the initial steps. This is given below:
turtle.penup()
turtle.setposition(-40, 0)
turtle.setheading(180)
turtle.pendown()
turtle.forward(70)
The generated image is shown below:
Drawing the rest of the symbol will involve lifting up the pen and moving around the shape. We will start with the upper left quadrant, move to the lower left quadrant and follow the same pattern in the right quadrant.
The code for steps 11 to 16 is shown below:
turtle.penup()
turtle.setposition(-170, 50)
turtle.setheading(90)
turtle.pendown()
turtle.forward(120)
turtle.setheading(0)
turtle.forward(120)
The generated image is shown below:
The code for steps 18 to 24 is shown below:
turtle.penup()
turtle.setposition(-170, -50)
turtle.setheading(270)
turtle.pendown()
turtle.forward(120)
turtle.setheading(0)
turtle.forward(120)
The generated image is shown below:
Steps 25 to 31 will draw the parts of the symbol at the upper right hand corner. The code to do this is shown below:
turtle.penup()
turtle.setposition(170, 50)
turtle.setheading(90)
turtle.pendown()
turtle.forward(120)
turtle.setheading(180)
turtle.forward(120)
The generated image is shown below:
To complete this symbol, the code for the lower left part is shown below:
turtle.penup()
turtle.setposition(170, -50)
turtle.setheading(270)
turtle.pendown()
turtle.forward(120)
turtle.setheading(180)
turtle.forward(120)
The generated image is shown below:
Conclusion
This shape wasn't much of a stretch to draw. It was based on repeating the patterns for drawing.
No comments:
Post a Comment