Categories
Drawing Adinkra Symbols using Python

Dame Dame

Dame Dame means “chequered or checkered” as in the pattern on a chess or draught board. It is the symbol of intelligence, ingenuity, and strategy.

We will use a grid of 5 pixels to trace out the image. The image of this is shown below:

Analyzing the Symbol

Dame Dame consists of a filled square surrounded by an outer circle. The four sides of the square are connected to the circle by a shape that looks like a tong.

The Plan to Draw the Symbol

To draw Dame Dame, we first draw the filled square. Next we draw the outer circle.

The tong like shape connecting the square to the circle is drawn for all the four sides of the square.

The Algorithm to Draw the Symbol

The algorithm to draw Dame Dame is given below:

  1. Increase the pen size to 20 pixels
  2. Move the turtle to the position (-60, 60)
  3. Draw the inner filled square as a square of length 120 pixels
  4. Lift up the pen
  5. Move the pen to the position (0, -170)
  6. Draw a circle of radius 170
  7. Lift up the pen
  8. Set the heading of the pen to 0
  9. Move the pen to the position (60, 20)
  10. Draw the right handle
  11. Lift up the pen
  12. Set the heading of the pen to 0
  13. Draw the line joining the right handle to the circle
  14. Lift up the pen
  15. Set the heading of the pen to 90
  16. Move the pen to the position (-20, 60)
  17. Draw the top handle
  18. Lift up the pen
  19. Set the heading of the pen to 90
  20. Draw the line joining the top handle to the circle
  21. Lift up the pen
  22. Set the heading of the pen to 180
  23. Move the pen to the position (-60, -20)
  24. Draw the left handle
  25. Lift up the pen
  26. Set the heading of the pen to 180
  27. Draw the line joining the left handle to the circle
  28. Lift up the pen
  29. Set the heading of the pen to 270
  30. Move the pen to the position (20, -60)
  31. Draw the bottom handle
  32. Lift up the pen
  33. Set the heading of the pen to 270
  34. Draw the line joining the bottom handle to the circle

From the above steps, you will notice that steps (7-13), (14-20), (21-27) and (28-34) are similar. As a result, they would make a great candidate for a function.

Using Turtle Graphics

We will use the template.py file and rename it to damedame.py. The first task will be do increase the pen size of the turtle.

The code to do this is shown below:

turtle.pensize(20)

Next we draw the filled square. The code to do this is shown below:

turtle.setposition(-60, 60)
turtle.pendown()
turtle.begin_fill()
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.end_fill()

The generated image is shown below:

Next we draw the outer circle. The code to do this is shown below:

turtle.penup()
turtle.setposition(0, -170)
turtle.pendown()
turtle.circle(170)

The generated image is shown below:

Next we draw the right handle. The code to do this is shown below:

turtle.penup()
turtle.setheading(0)
turtle.setposition(60, 20)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

The generated image is shown below:

Now we draw the line that connects the right handle to the circle. The code to do this is shown below:

turtle.penup()
turtle.setheading(0)
turtle.setposition(110, 0)
turtle.pendown()
turtle.forward(50)

The generated image is shown below:

Next we draw the top handle. The code to do this is shown below:

turtle.penup()
turtle.setheading(90)
turtle.setposition(-20, 60)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

The generated image is shown below:

Now we draw the line that connects the top handle with the circle. The code to do this is shown below:

turtle.penup()
turtle.setheading(90)
turtle.setposition(0, 110)
turtle.pendown()
turtle.forward(50)

The generated image is shown below:

Next we draw the left handle. The code to do this is shown below:

turtle.penup()
turtle.setheading(180)
turtle.setposition(-60, -20)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

The generated image is shown below:

Now we draw the line that connects the left handle to the circle. The code to do this is shown below:

turtle.penup()
turtle.setheading(180)
turtle.setposition(-110, 0)
turtle.pendown()
turtle.forward(50)

The generated image is shown below:

Next we draw the bottom handle. The code to do this is shown below:

turtle.penup()
turtle.setheading(270)
turtle.setposition(20, -60)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

The generated image is shown below:

Now we draw the line that connects the bottom handle to the circle. The code to do this is shown below:

Complete Code

"""
Project Name: Drawing Adinkra Symbols using Python
Symbol Name: Dame Dame
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math
 
# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()
 
# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()
 
# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()
 
# Draw the grid
turtle.speed(1000000)
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)
 
# Change the colour mode
turtle.colormode(255)
 
# Change the pencolor to red
turtle.pencolor(255, 0, 0)
 
# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()
 
# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)
 
# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)
 
# Place code here
# Set the pensize to 20
turtle.pensize(20)

# Draw the filled center square
turtle.setposition(-60, 60)
turtle.pendown()
turtle.begin_fill()
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.forward(120)
turtle.right(90)
turtle.end_fill()

# Draw the outer circle
turtle.penup()
turtle.setposition(0, -170)
turtle.pendown()
turtle.circle(170)

# Draw the right handle
turtle.penup()
turtle.setheading(0)
turtle.setposition(60, 20)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

# Draw the line joining the right handle to the circle
turtle.penup()
turtle.setheading(0)
turtle.setposition(110, 0)
turtle.pendown()
turtle.forward(50)

# Draw the top handle
turtle.penup()
turtle.setheading(90)
turtle.setposition(-20, 60)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

# Draw the line joining the top handle to the circle
turtle.penup()
turtle.setheading(90)
turtle.setposition(0, 110)
turtle.pendown()
turtle.forward(50)

# Draw the left handle
turtle.penup()
turtle.setheading(180)
turtle.setposition(-60, -20)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

# Draw the line joining the left handle to the circle
turtle.penup()
turtle.setheading(180)
turtle.setposition(-110, 0)
turtle.pendown()
turtle.forward(50)

# Draw the bottom handle
turtle.penup()
turtle.setheading(270)
turtle.setposition(20, -60)
turtle.pendown()
turtle.forward(50)
turtle.right(90)
turtle.forward(40)
turtle.right(90)
turtle.forward(50)

# Draw the line joining the bottom handle to the circle
turtle.penup()
turtle.setheading(270)
turtle.setposition(0, -110)
turtle.pendown()
turtle.forward(50)

# End the program
turtle.done()

Where it Can be Found

I searched online but I was unable to find any reference to anyone using the Dame Dame symbol.

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Dame Dame symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Next time, we will look at the Epa symbol.

Support the Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Drawing Adinkra Symbols using Python

Akoma Ntoaso

Akoma Ntoaso is the symbol for understanding and agreement.

We will use the 5 pixel grid to trace out this image. The image of this is shown below:

Analyzing the Symbol

Akoma Ntoaso consists of a circle with lines radiating out from it which connect to semi-circles that are perpendicular to those lines.

The Plan to Draw Symbol

To draw this symbol, we will draw the circle first then move from one quadrant to the other and complete the shape.

We will start from the upper right quadrant and draw the semi-circle and the connecting line then move clockwise until the entire symbol is completed.

Algorithm to Draw the Symbol

The algorithm to draw the Akoma Ntoaso symbol is shown below:

  1. Move the turtle to the position (0, -70)
  2. Draw a filled circle of radius 70 pixel
  3. Draw a line in the upper left quadrant from (-165, 30) to (-30, 165)
  4. Draw a semi-circle in the upper left quadrant and fill it
  5. Draw a line from the center of the circle to the upper left semi-circle
  6. Draw a line in the upper right quadrant from (30, 165) to (165, 30)
  7. Draw a semi-circle in the upper right quadrant and fill it
  8. Draw a line from the center of the circle to the upper right semi-circle
  9. Draw a line in the lower right quadrant from (165, -30) to (30, -165)
  10. Draw a semi-circle in the lower right quadrant and fill it
  11. Draw a line from the center of the circle to the lower right semi-circle
  12. Draw a line in the lower left quadrant from (-30, -165) to (-165, -30)
  13. Draw a semi-circle in the lower left quadrant and fill it
  14. Draw a line from the center of the circle to the lower left semi-circle

Using Turtle Graphics

We will use the template.py file and rename it to akoma_ntoaso.py. However, we have to add some code to draw diagonal lines that will cut across the grid.

The code to do this is given below:

def coordinateDistance(x1, y1, x2, y2):
dx = x1 – x2
dy = y1 – y2
D = math.sqrt((dx * dx) + (dy * dy))
return D

turtle.penup()
turtle.setposition(-200, 200)
turtle.setheading(315)
diagonalLength = coordinateDistance(-200, 200, 200, -200)
turtle.pendown()
turtle.forward(diagonalLength)

turtle.penup()
turtle.setposition(-200, -200)
turtle.setheading(45)
diagonalLength = coordinateDistance(-200, -200, 200, 200)
turtle.pendown()
turtle.forward(diagonalLength)

turtle.pencolor(0, 0, 0)

turtle.setheading(0)
turtle.penup()
turtle.home()

The function coordinateDistance calculates the distance between two extreme ends of the grid.

Now we can start drawing the symbol.

The code for steps 1 and 2 is given below:

turtle.penup()
turtle.setposition(0, -70)
turtle.pendown()
turtle.begin_fill()
turtle.circle(70)
turtle.end_fill()

The generated image is show below:

For step 3 we draw a line from (-165, 30) to (-30, 165). To do this, we move the turtle to the position (-165, 30) and we set the heading to 45 degrees.

Next we find the distance between the two points we want our line to extend to and move the turtle that distance.

The code to do this is shown below:

turtle.penup()
turtle.setposition(-165, 30)
turtle.setheading(45)
diagonalLength = coordinateDistance(-165, 30, -30, 165)
turtle.pendown()
turtle.forward(diagonalLength)

The generated image is shown below:

For step 4 of the algorithm, we draw a semi-circle. The code to do this is given below:

turtle.penup()
turtle.setposition(-30, 165)
turtle.pendown()
turtle.setheading(135)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

The generated image is shown below:

Step 5 of the algorithm is easy. We return the turtle back to the center of the grid and draw a line connecting the circle to the semi-circle.

The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.setheading(135)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

The generated image is shown below:

Now that one part of the symbol has been drawn, you will notice that steps 6 to 8, 9 to 11 and 12 to 14 are basically a repeat of steps 3 to 5.

This means that we could use a single function to draw the symbol. I will leave this as an exercise for you.

For step 6, we move the pen to the position (30, 165) and we draw a line to position (165, 30).

The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(30, 165)
turtle.setheading(-45)
diagonalLength = coordinateDistance(30, 165, 165, 30)
turtle.pendown()
turtle.forward(diagonalLength)

The generated image is shown below:

Next we proceed to draw the semi-circle in the upper right quadrant. The code to do this is shown below:

turtle.penup()
turtle.setposition(165, 30)
turtle.pendown()
turtle.setheading(45)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

The generated image is shown below:

Now we draw the line to join the semi-circle to the circle.

The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.setheading(45)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

The generated image is shown below:

Next we draw a line in the lower right quadrant. The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(165, -30)
turtle.setheading(-135)
turtle.pendown()
turtle.forward(diagonalLength)

The generated image is shown below:

We now draw the semi-circle. The code to do this is shown below:

turtle.penup()
turtle.setposition(30, -165)
turtle.pendown()
turtle.setheading(-45)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

The generated image is shown below:

Now we connect the semi-circle to the center circle. The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.setheading(-45)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

Next we draw a line in the lower left quadrant. The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(-30, -165)
turtle.setheading(135)
turtle.pendown()
turtle.forward(diagonalLength)

We now draw the semi-circle. The code to do this is shown below:

turtle.penup()
turtle.setposition(-165, -30)
turtle.pendown()
turtle.setheading(225)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

The generated image is shown below:

Finally, we draw the line connecting the semi-circle to the center circle. The code to do this is shown below:

turtle.penup()
turtle.home()
turtle.setheading(225)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

The generated image is shown below:

Complete Code

"""
Project Name: Drawing Adinkra Symbols using Python
Symbol Name: Akoma Ntoaso
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math
 
# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()
 
# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()
 
# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()
 
# Draw the grid
turtle.speed(1000000)
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)
 
# Change the colour mode
turtle.colormode(255)
 
# Change the pencolor to red
turtle.pencolor(255, 0, 0)
 
# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()
 
# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)
 
# Reset all the properties
turtle.home()
 
# Place code here
def coordinateDistance(x1, y1, x2, y2):
    dx = x1 - x2
    dy = y1 - y2
    D = math.sqrt((dx * dx) + (dy * dy))
    return D

# Draw the top left diagonal
turtle.penup()
turtle.setposition(-200, 200)
turtle.setheading(315)
diagonalLength = coordinateDistance(-200, 200, 200, -200)
turtle.pendown()
turtle.forward(diagonalLength)

# Draw the bottom left diagonal
turtle.penup()
turtle.setposition(-200, -200)
turtle.setheading(45)
diagonalLength = coordinateDistance(-200, -200, 200, 200)
turtle.pendown()
turtle.forward(diagonalLength)

# Reset the colour back to black
turtle.pencolor(0, 0, 0)

# Reset the heading to 0
turtle.setheading(0)
turtle.penup()
turtle.home()

# Draw the center circle
turtle.penup()
turtle.setposition(0, -70)
turtle.pendown()
turtle.begin_fill()
turtle.circle(70)
turtle.end_fill()

# Draw a line in the upper left quadrant
turtle.penup()
turtle.setposition(-165, 30)
turtle.setheading(45)
diagonalLength = coordinateDistance(-165, 30, -30, 165)
turtle.pendown()
turtle.forward(diagonalLength)

# Draw a semi-circle in the upper left quadrant
turtle.penup()
turtle.setposition(-30, 165)
turtle.pendown()
turtle.setheading(135)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

# Draw a line from the center of the circle to the upper left semi-circle
turtle.penup()
turtle.home()
turtle.setheading(135)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

# Draw a line in the upper right quadrant
turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(30, 165)
turtle.setheading(-45)
diagonalLength = coordinateDistance(30, 165, 165, 30)
turtle.pendown()
turtle.forward(diagonalLength)

# Draw a semi-circle in the upper right quadrant
turtle.penup()
turtle.setposition(165, 30)
turtle.pendown()
turtle.setheading(45)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

# Draw a line from the center of the circle to the upper right semi-circle
turtle.penup()
turtle.home()
turtle.setheading(45)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

# Draw a line in the lower right quadrant
turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(165, -30)
turtle.setheading(-135)
turtle.pendown()
turtle.forward(diagonalLength)

# Draw a semi-circle in the lower right quadrant
turtle.penup()
turtle.setposition(30, -165)
turtle.pendown()
turtle.setheading(-45)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

# Draw a line from the center of the circle to the lower right quadrant
turtle.penup()
turtle.home()
turtle.setheading(-45)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

# Draw a line in the lower left quadrant
turtle.penup()
turtle.home()
turtle.pensize(1)
turtle.setposition(-30, -165)
turtle.setheading(135)
turtle.pendown()
turtle.forward(diagonalLength)

# Draw a semi-circle in the lower left quadrant
turtle.penup()
turtle.setposition(-165, -30)
turtle.pendown()
turtle.setheading(225)
turtle.begin_fill()
turtle.circle(diagonalLength/2, 180)
turtle.end_fill()

# Draw a line from the center of the circle to the lower left quadrant
turtle.penup()
turtle.home()
turtle.setheading(225)
turtle.pendown()
turtle.pensize(30)
turtle.forward(diagonalLength * 0.75)

# End the program
turtle.done()

Where Can it Be Found?

A search of Google for organizations using this symbol yielded the Ghana Stock Exchange. It is the logo of the organization.

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Akoma Ntoaso symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Next time, we will look at the Dame Dame symbol.

Support the Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Drawing Adinkra Symbols using Python

Abusua Pa

Abusua Pa means “Good Family”. It is the symbol of the family unit. Typically in Akan culture, Abusua is the name in Akan culture for a group of people that share common maternal ancestry.

The Abusua line is considered to be passed through the mother’s blood. It is a taboo to marry someone from the same Abusua.

We will use the 5-pixel grid to trace out this image. The image of this is shown below:

Abusua Pa Adinkra Symbol on Grid
Abusua Pa Adinkra Symbol on Grid

Analysing the Symbol

The symbol is a composite symbol made up of a hollowed out square. The inner part of the square consists of four sections which are lined like a window pane.

The outer part of the square intersects with 4 semi-circles. The widths of all the component shapes are the same.

The Plan to Draw the Symbol

To draw this symbol, the first task is to increase the pensize to 40 pixels. Next we move the turtle to the position (-100, 100).

We find the distance between (-100, 100) to (100, -100) and use the drawSquare function to draw the outer square.
Next we move to the position (-100, 0) and draw the horizontal centre line. We then move to the position (0, -100) and draw the vertical centre line.

Once we have completed the outer square and its centre lines, we draw the external semi-circles.

Finally, we reduce the pensize to 5 and draw the inner sections of the symbol.

Algorithm to Draw the Symbol

The algorithm to draw the Abusua Pa symbol is shown below:

  1. Lift up the pen
  2. Set the pensize to 40 pixels
  3. Set the position of the pen to the location (-100, 100)
  4. Place the pen down
  5. Find the length of the side of the outer square
  6. Draw the outer square
  7. Draw the inner centre lines
  8. Draw the outer semi-circles
  9. Reduce the pensize to 5
  10. Draw the inner squares

Using Turtle Graphics

We will use the template.py file and rename it to abusuapa.py.

The code for steps 1 to 4 is given below:

turtle.penup()
turtle.pensize(40)
turtle.setposition(-100, 100)
turtle.pendown()

To find the length between the two points, we use the coordinateDistance function which is shown below:

def coordinateDistance(x1, y1, x2, y2):
dx = x1 – x2
dy = y1 – y2
D = math.sqrt((dx * dx) + (dy * dy))
return D

We calculate the length between the two points using the code shown below:

length = coordinateDistance(-100, -100, 100, -100)

We then draw a square using the drawSquare function.

drawSquare(length)

The generated image is shown below:

Outer Square
Outer Square

I realize that since we are using the drawSquare function, we no longer need the setposition code. We can comment it out.

To draw the center lines, we have to move the turtle to the left-hand side and move forward by the length of the side. Next, we move the turtle to the bottom, set its heading to 90 degrees and move up by the length of the side. The code to do this is shown below:

turtle.setposition(-100, 0)
turtle.pendown()
turtle.forward(length)
turtle.penup()
turtle.setheading(90)
turtle.setposition(0, -100)
turtle.pendown()
turtle.forward(length)

The generated image is shown below:

Centre Lines
Centre Lines

To draw the outer circle we will start with the top and move clockwise. To draw the upper circle, we need to move the turtle to the position (50, 120). Then we draw the semi-circle. The code to do this is shown below:

turtle.penup()
turtle.setposition(50, 120)
turtle.pendown()
turtle.circle(50, 180)

The generated image is shown below:

First Semi-Circle
First Semi-Circle

To draw the remaining semi-circles, we move clockwise and also change the heading of our turtle accordingly. The code to do this is shown below:

turtle.penup()
turtle.setposition(120, -50)
turtle.setheading(0)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.setposition(-50, -120)
turtle.setheading(270)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.setposition(-120, 50)
turtle.setheading(180)
turtle.pendown()
turtle.circle(50, 180)

The generated image is shown below:

Outer Semi-Circles
Outer Semi-Circles

Completing this shape is easy. All we have to do is draw the lines that are within the squares. To do this we must reduce the pensize to 5 and set the orientation of the turtle appropriately to draw the lines.

The code below will draw all the vertical lines:

turtle.penup()
turtle.pensize(5)
turtle.setposition(-60, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-40, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(40, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(60, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

The generated image is shown below:

Vertical Lines
Vertical Lines

To draw the remaining horizontal lines, I shall start from the bottom of the symbol and work my way up.

The code to do this is shown below:

turtle.penup()
turtle.setposition(-100, -60)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, -40)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, 40)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, 60)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

The generated image is shown below:

Final Symbol
Final Symbol

Complete Code

"""
Project Name: Drawing Adinkra Symbols using Python
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here
turtle.penup()
turtle.pensize(40)
turtle.setposition(-100, 100)
turtle.pendown()

def coordinateDistance(x1, y1, x2, y2):
    dx = x1 - x2
    dy = y1 - y2
    D = math.sqrt((dx * dx) + (dy * dy))
    return D

length = coordinateDistance(-100, -100, 100, -100)
drawSquare(length)

turtle.setposition(-100, 0)
turtle.pendown()
turtle.forward(length)
turtle.penup()
turtle.setheading(90)
turtle.setposition(0, -100)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(50, 120)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.setposition(120, -50)
turtle.setheading(0)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.setposition(-50, -120)
turtle.setheading(270)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.setposition(-120, 50)
turtle.setheading(180)
turtle.pendown()
turtle.circle(50, 180)

turtle.penup()
turtle.pensize(5)
turtle.setposition(-60, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-40, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(40, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(60, -100)
turtle.setheading(90)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, -60)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, -40)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, 40)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

turtle.penup()
turtle.setposition(-100, 60)
turtle.setheading(0)
turtle.pendown()
turtle.forward(length)

# End the program
turtle.done()

Where Can It Be Found?

A brief Google search led to only one significant reference online which is the Abusua Pa Experience.

Abusua Pa Experience is a travel and tour experience company based in Cape Coast, Ghana.

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Abusua Pa symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Next time, we will look at the Akoma Ntoaso Adinkra symbol.

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Drawing Adinkra Symbols using Python

Aban

Aban means “fortress”. It is the symbol of strength and authority.

We will use the 5 pixel grid to trace out this image. The image of this is shown below:

Aban on a Grid

Analysing the Symbol

The symbol is a composite symbol made up of 4 symbols that look like tongs.

A single tong is symmetrical in its quadrant. This property means that we draw a tong and use the steps to draw others.

The Plan to Draw the Symbol

We shall move the pen to the position (0, 80). Once we do this, we shall set the heading of the pen to 45 degrees thus drawing the tong in the upper right quadrant.

Once the drawing of the first tong is completed, the position of the turtle will place it on the x axis on the right.

At that point, we simply set the heading of the pen to 315 degrees and draw the second tong. When the second tong is drawn, the turtle will be on the negative y axis.

At this point, we simply set the heading of the pen to 225 degrees and draw the third tong. When the third tong is drawn, the turtle will be on the negative x axis.

At this point, we simple set the heading of the pen to 135 degrees and draw the fourth tong thus completing our shape.

Algorithm to Draw the Symbol

The algorithm to draw the Aban symbol is shown below:

  1. Lift up the pen
  2. Set the heading to 45 degrees
  3. Move the pen to the position (0, 80)
  4. Set the pen size to half the width of the shape
  5. Place the pen down
  6. Move forward to draw the first line
  7. Turn right by 90 degrees
  8. Move forward to draw half of the first line
  9. Turn left by 90 degrees
  10. Move forward to draw the protruding line at a distance of 5/8 of the length
  11. Lift up the pen
  12. Reverse the turtle by moving back the same distance as you moved forward
  13. Turn right by 90 degrees
  14. Place the pen down
  15. Draw the second half of the line
  16. Turn right by 90 degrees
  17. Move forward to draw the third line
  18. Change the heading to 315 and repeat steps 6 – 17
  19. Change the heading to 225 and repeat steps 6 – 17
  20. Change the heading to 135 and repeat steps 6 – 17

Using Turtle Graphics

We will use the template.py file and rename it to aban.py.

The code for steps 1 to 3 is given below:

turtle.penup()
turtle.setheading(45)
turtle.setposition(0, 80)

In step 4 of the algorithm to draw Aban, we have to find the width of the shape. We will also need to find the length of the shape.

To find the width of the line, we need to find the distance between two parallel points it passes through and this are: (120, 0) and (40, 80).

To find the length of a side of the Aban symbol, we take the point (0, 80) as our starting point and get the coordinates of the centre point (80, 160) which is where a line drawing the symbol would stop and turn.

We have to introduce a function coordinateDistance to give us the distance between the two coordinates. The function definition is shown below:

def coordinateDistance(x1, y1, x2, y2):
dx = x1 – x2
dy = y1 – y2
D = math.sqrt((dx * dx) + (dy * dy))
return D

To find the width and length, we use the expressions below:

width = coordinateDistance(120, 0, 40, 80)
length = coordinateDistance(0, 80, 80, 160)

The code for steps 4 and 5 is shown below:

turtle.pensize(width / 2)
turtle.pendown()

Since steps 6 to 17 will be repeated 3 more times, they are a good candidate for a function. We shall call this function drawTong.

Steps 6 to 17 can be automated using the drawTong function. We will first write out the commands for the steps to check then we will later integrate them into the drawTong function.

The code for steps 6 to 10 is given below:

turtle.forward(length)
turtle.right(90)
turtle.forward(length / 2)
turtle.left(90)
turtle.forward(length * 5 / 8)

The generated image is shown below:

Half Tong
Half Tong

The code to lift the pen is straightforward enough. To reverse the shape, we need to move backward the same number of steps as forward.

The code to do this is shown below:

turtle.penup()
turtle.backward(length * 5 / 8)
turtle.right(90)
turtle.pendown()
turtle.forward(length / 2)
turtle.right(90)
turtle.forward(length)

The generated image is shown below:

Full Tong
Full Tong

Now that we have drawn one part of the symbol, we can use the code to create the drawTong function so that we don’t have to repeat ourselves.

The code for the function is shown below:

def drawTong():
turtle.forward(length)
turtle.right(90)
turtle.forward(length / 2)
turtle.left(90)
turtle.forward(length * 5 / 8)
turtle.penup()
turtle.backward(length * 5 / 8)
turtle.right(90)
turtle.pendown()
turtle.forward(length / 2)
turtle.right(90)
turtle.forward(length)

To draw the shape completely, we need to call this function and alternate with the setheading angle that is representative of the quadrant the function will draw in. The code to do this is shown below:

drawTong()
turtle.setheading(315)
drawTong()
turtle.setheading(225)
drawTong()
turtle.setheading(135)
drawTong()

The generated image is shown below:

Completed Symbol
Completed Symbol

Complete Code

"""
Project Name: Drawing Adinkra Symbols using Python
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here
turtle.penup()
turtle.setheading(45)
turtle.setposition(0, 80)

def coordinateDistance(x1, y1, x2, y2):
    dx = x1 - x2
    dy = y1 - y2
    D = math.sqrt((dx * dx) + (dy * dy))
    return D

width = coordinateDistance(120, 0, 40, 80)
length = coordinateDistance(0, 80, 80, 160)

turtle.pensize(width/2)
turtle.pendown()

def drawTong():
    turtle.forward(length)
    turtle.right(90)
    turtle.forward(length / 2)
    turtle.left(90)
    turtle.forward(length * 5 / 8)
    turtle.penup()
    turtle.backward(length * 5 / 8)
    turtle.right(90)
    turtle.pendown()
    turtle.forward(length / 2)
    turtle.right(90)
    turtle.forward(length)

drawTong()
turtle.setheading(315)
drawTong()
turtle.setheading(225)
drawTong()
turtle.setheading(135)
drawTong()

# End the program
turtle.done()

Where Can It Be Found?

A brief Google search led me to the following places where you can get branded Aban products:

  1. Aban Zanzibar Trinity Rings on Simbasante
  2. Socks by Adinkra Republic
  3. Protection Adinkra Earrings by Ahima
  4. Aban Gold Pendant on Amazon
  5. Aban Wooden Stamp on Etsy

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Aban symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Next time, we will look at the Abusua Pa Adinkra symbol

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Drawing Adinkra Symbols using Python

Adinkrahene

Adinkrahene is the symbol for leadership and charisma. This symbol is reportedly the inspiration for the design of the other symbols. Its simple yet abstract design, consisting of three concentric circles emphasizes the importance of ideas and abstract concepts.

In the last section, I introduced the grid. The grid will allow us create any symbol we want to because we can analyse and replicate the symbol of our choice.

We will draw a grid of 5 pixel squares on the image of the Adinkra symbol of our choice and replicate that on our grid. The squares on our grid are 10 pixels each. The goal of our program would be to create a grid that is two times the size of the original grid.

Drawing the 5 pixel squares on the Adinkrahene symbol will look as shown below:

Adinkrahene on a Grid
Adinkrahene on a Grid

Analysing the Symbol

The first circle is 8 squares away from the centre of the circle. So multiplying by 5 would give us 40 pixels.

The second circle is 13 pixels away from the centre of the circle. So multiplying by 5 would give us 65 pixels.

The third circle is 18 pixels away from the centre of the circle. So multiplying by 5 would give us 90 pixels.

The outer circle doesn’t touch the edge of the grid. It leaves a space of 1 square. The thickness of the circles are all 10 pixels.

The Plan to Draw the Symbol

To draw the Adinkahene symbol, we have to compensate for scaling up the shape to twice its size.

As a result of this, we shall increase the size of our pen to 20 pixels.

The first circle will have a radius of 80 pixels. We will move the pen to the location (0, -80) and draw a circle of 80 pixels.

The second circle will have a radius of 130 pixels. We will move the pen to the location (0, -130) and draw a circle of 130 pixels.

The third circle will have a radius of 180 pixels. We will move the pen to the location (0, -180) and draw a circle of radius 180 pixels.

Algorithm to Draw the Symbol

The algorithm to draw the Adinkrahene symbol is shown below:

  1. Lift up the pen
  2. Increase the pensize to 20 pixels
  3. Move the turtle to the position (0, -80)
  4. Place the pen down
  5. Draw a circle that is 80 pixels in radius
  6. Lift up the pen
  7. Move the turtle to the position (0, -130)
  8. Place the pen down
  9. Draw a circle that is 130 pixels in radius
  10. Lift up the pen
  11. Move the turtle to the position (0, -180)
  12. Place the pen down
  13. Draw a circle that is 180 pixels in radius

Using Turtle Graphics

We will use the template.py file and rename it to adinkrahene.py.

The first step in drawing the Adinkrahene symbol is to draw the innermost circle and work our way out.

The first task is to lift up the pen. The code to do this is shown below:

turtle.penup()

Next we will increase our pensize to 20. The code to do this is shown below:

turtle.pensize(20)

The origin of the turtle is at (0, 0). To move the turtle to the position (0, -80), we use the command shown below:

turtle.setposition(0, -80)

At this point, place the pen down and draw a circle of radius 80 pixels. The code to do this is shown below:

turtle.pendown()
turtle.circle(80)

Our Python Turtle window will look like shown below:

Inner concentric circle of Adinkrahene
Inner Concentric Circle

Steps 6 to 9 are the steps for drawing the second circle. The code is similar to what you have already seen before and is shown below:

turtle.penup()
turtle.setposition(0, -130)
turtle.pendown()
turtle.circle(130)

When we run the code, our second circle now appears as shown below:

Middle Circle of Adikrahene
Middle Concentric Circle

Steps 10 to 13 will draw the third circle. The code to do this is similar to what you have already seen before and is shown below:

turtle.penup()
turtle.setposition(0, -180)
turtle.pendown()
turtle.circle(180)

When you run the code, the image is as shown below:

Adinkrahene
Final Image

Complete Code

The code for drawing the symbol is shown below:

"""
Project Name: Drawing Adinkra Symbols using Python
Symbol Name: Adinkrahene
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here
# Lift up the pen
turtle.penup()

# Set the pensize
turtle.pensize(20)

# Draw the first circle
turtle.setposition(0, -80)
turtle.pendown()
turtle.circle(80)

# Draw the second circle
turtle.penup()
turtle.setposition(0, -130)
turtle.pendown()
turtle.circle(130)

# Draw the third circle
turtle.penup()
turtle.setposition(0, -180)
turtle.pendown()
turtle.circle(180)

# End the program
turtle.done()

Where Can It Be Found?

A brief Google search led me to the following places where you can get branded Adinkrahene products:

  1. TShirts, Mugs and Phone Cases on TeePublic
  2. Pendants on Purple Blessing
  3. Socks on Adinkra Republic

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Adinkrahene symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.