We will use the 5 pixel grid to trace out this image. The image of this is shown below:
The plan to draw this shape is given below:
- Lift up the pen
- Set the pensize to 40 pixels
- Move the pen to the bottom of the location of the center vertical
- Draw the center vertical
- Set the pensize to 30 pixels
- Draw the remaining center verticals
- Complete the outline of the shape
- Draw the semicircles
Using Turtle Graphics
We will use the template.py file and rename it to nnampo.py.
The code for steps 1 and 2 is given below:
turtle.penup()
turtle.pensize(40)
The coordinates for the bottom of the center vertical are (0, -80). The length of the line is 160 pixels.
The code to draw this line is shown below:
turtle.setposition(0, -60)
turtle.pendown()
turtle.setheading(90)
turtle.forward(120)
The generated image is shown below:
To draw the remaining center verticals, we must first know their coordinates they are: (-165, 60), (-85, 60), (85, 60) and (165, 60).
The code to draw them is given below:
turtle.pensize(30)
turtle.penup()
turtle.setposition(-165, -60)
turtle.pendown()
turtle.setheading(90)
turtle.forward(120)
turtle.penup()
turtle.setposition(-85, -60)
turtle.pendown()
turtle.setheading(90)
turtle.forward(120)
turtle.penup()
turtle.setposition(85, -60)
turtle.pendown()
turtle.setheading(90)
turtle.forward(120)
turtle.penup()
turtle.setposition(165, -60)
turtle.pendown()
turtle.setheading(90)
turtle.forward(120)
The generated image is shown below:
To complete the outline of the shape, we need to draw the top horizontal line and the bottom horizontal line.
The coordinate for the upper line is (-165, 75) and its length is 330 pixels. The code to draw it is shown below:
turtle.penup()
turtle.setposition(-165, 75)
turtle.pendown()
turtle.setheading(0)
turtle.forward(330)
The coordinate for the lower line is (-165, -75). The code to draw it is shown below:
turtle.penup()
turtle.setposition(-165, -75)
turtle.pendown()
turtle.setheading(0)
turtle.forward(330)
The generated image is shown below:
Drawing the semicircles is easy. We need to move the turtle to the position of the rightmost sides and draw the circle.
The code to do this is shown below:
turtle.penup()
turtle.setposition(165, 75)
turtle.pendown()
turtle.setheading(90)
turtle.circle(80, 180)
turtle.penup()
turtle.setposition(-5, 75)
turtle.pendown()
turtle.setheading(90)
turtle.circle(80, 180)
The generated image is shown below:
To draw the lower semicircle we just invert the positions. The code to do this is shown below:
turtle.penup()
turtle.setposition(-165, -75)
turtle.pendown()
turtle.setheading(270)
turtle.circle(80, 180)
turtle.penup()
turtle.setposition(5, -75)
turtle.pendown()
turtle.setheading(270)
turtle.circle(80, 180)
The generated image is shown below:
Conclusion
At the end of this section we have succeeded in drawing the Nnampo Pa Baanu symbol.
This post is part of the series: Drawing Adinkra Symbols using Python. The goal is to draw 40 Adinkra symbols using the Python programming language.
No comments:
Post a Comment