We will use the 5 pixel grid to trace out this image. The image of this is shown below:
- Lift up the pen
- Find the angle and length between the leftmost position and the top of the symbol
- Draw the entire shape and fill it
Using Turtle Graphics
We will use the template.py file and rename it to obohemmaa.py.
The code to lift up the pen is shown below:
The coordinate of the leftmost part of the symbol is (-100, 0). The coordinate for the topmost part of the symbol is (0, 200).
The code to find the angle is shown below:
myradians = math.atan2(200 - 0), 0 - (-100))
angle = math.degrees(myradians)
To find the distance between the two points we use the coordinateDistance function. The code for it is shown below:
def coordinateDistance(x1, y1, x2, y2):
dx = x1 - x2
dy = y1 - y2
D = math.sqrt((dx * dx) + (dy * dy))
We call the function using the code shown below:
length = coordinateDistance(-100, 0, 0, 200)
The rest is easy. The code to draw the entire shape is shown below:
turtle.setheading(360 - angle)
turtle.setheading(180 + angle)
turtle.setheading(180 - angle)
The generated image is shown below:
At the end of this section, we have succeeded in drawing the Obohemmaa 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.