We will use the 5 pixel grid to trace out this image. The image of this is shown below:
The plan to draw the shape is shown below:
- Lift the pen
- Set the pen size to 20
- Draw the center circle
- Draw the upper left circle
- Draw the upper right circle
- Draw the lower left circle
- Draw the lower right circle
Using Turtle Graphics
We will use the template.py file and rename it to mframadan.py.
The code for steps 1 and 2 are given below:
turtle.penup()
turtle.pensize(20)
The center circle is to be drawn first. Do keep in mind that it is a circle of radius 70 pixels. So we need to first lift up our turtle and move it to the position (0, -70). Then we draw a circle of 70 pixels. The code to do this is shown below:
turtle.setposition(0, -70)
turtle.pendown()
turtle.circle(70)
The generated image is shown below:
We borrow the code from Akoma Ntoaso project. We only need the diagonal length for the entire grid. This is 565.685424949.
The code below will draw the diagonal line.
turtle.penup()
turtle.setposition(-200, -200)
turtle.setheading(45)
turtle.pendown()
turtle.forward(565.685424949)
turtle.penup()
turtle.setposition(200, -200)
turtle.setheading(135)
turtle.pendown()
turtle.forward(565.685424949)
The generated image is shown below:
turtle.penup()
turtle.setposition(-60, 60)
turtle.setheading(45)
turtle.pendown()
turtle.circle(70)
The generated image is shown below:
turtle.penup()
turtle.setposition(60, 60)
turtle.setheading(-45)
turtle.pendown()
turtle.circle(70)
The generated image is shown below:
turtle.penup()
turtle.setposition(60, -60)
turtle.setheading(225)
turtle.pendown()
turtle.circle(70)
The generated image is shown below:
turtle.penup()
turtle.setposition(-60, -60)
turtle.setheading(135)
turtle.pendown()
turtle.circle(70)
The generated image is shown below:
We have successfully drawn the Mpuannum Nkotimsofo Puua symbol.
No comments:
Post a Comment