Thursday 14 December 2017

Mframadan


Mframadan means "wind resistant house". It is the symbol of symbol of fortitude and readiness to face life's vicissitudes.

This symbol suggests a reinforced or well-built home one built to withstand windy and treacherous conditions. It reflects in Asante history a clause in the unwritten constitutution of the Golden Stool.

Oral acocunts say that according to that clause, mud houses in Kumasi must be reinforced with turf. This reinforcing would cause the house to be sturdier and resistant to unfavorable weather conditions.

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 shown below:

  1. Lift the turtle
  2. Set the pen size to 10
  3. Draw the outer square
  4. Draw the inner square
  5. Draw the diagonal lines
  6. Draw the 4 remaining lines at the bottom
  7. Draw the 4 remaining lines at the top

Using Turtle Graphics

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

The code for steps 1 and 2 is given below:

turtle.penup()
turtle.pensize(15)

The outer square of the symbol is to be drawn first. Thankfully, we have the drawSquare function. Its length is 380 pixels. We use the drawSquare function to draw this shape by entering 380 as a parameter. The code for this is shown below:

drawSquare(380)

The generated image is shown below:


To draw the inner square, we also need to use the drawSquare function. The length of the square is 300 pixels. We use the drawSquare function to draw this shape by entering 300 as a parameter. The code to do this is shown below:

drawSquare(300)

The generated image is shown below:


To draw the diagonals that start at the lower left and move to the right quadrant, we must first get their positions.

To draw the lower line, we must move the turtle to its position and set is heading to 45 degrees. Then we move the turtle forward. The code to do this is shown below:

turtle.setposition(-110, -150)
turtle.setheading(45)
turtle.pendown()
turtle.forward(365)

The generated image is shown below:


Next we draw the upper left lower line. To do this, we move it to a position that is (-150, -110). We set the heading of the turtle to 45 degrees and we draw a line of length 365. The code to do this is shown below:

turtle.penup()
turtle.setposition(-150, -110)
turtle.setheading(45)
turtle.pendown()
turtle.forward(365)

The generated image is shown below:


Now we shall do the same thing for the right lines. The coordinates for the lower right lower line is (110, -150). Now that we know that, we shall repeat the steps we used to draw its counterpart only that its heading will be 135 degrees. The code to do this is shown below:

turtle.penup()
turtle.setposition(110, -150)
turtle.setheading(135)
turtle.pendown()
turtle.forward(365)

We just do the same thing for the upper right lower line. Its coordinates are (150, -110). The code to draw it is given below:



Next we draw the bottom lines. The first bottom line starts at the position (-90, -130) and extends to the position (90, -130). The distance between the lines is 180 pixels. The code for this is shown below:

turtle.penup()
turtle.setposition(-90, -130)
turtle.setheading(0)
turtle.pendown()
turtle.forward(180)

The generated image is shown below:


The coordinates for the second bottom line are at (-70, -110). We need to draw a line of length 140. The code to do this is shown below:

turtle.penup()
turtle.setposition(-70, -110)
turtle.setheading(0)
turtle.pendown()
turtle.forward(140)

The generated image is shown below:


The coordinates for the third bottom line are at (-50, -90). We need to draw a line of length 100. The code to do this is shown below:

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

The generated image is shown below:


The coordinates for the third bottom line are at (-30, -70). We need to draw a line of length 60. The code to do this is shown below:

turtle.penup()
turtle.setposition(-30, -70)
turtle.setheading(0)
turtle.pendown()
turtle.forward(60)

The generated image is shown below:


To draw the four top lines, we only need to reverse the along the y axis. So, the code to draw the four top lines is shown below:

turtle.penup()
turtle.setposition(-90, 130)
turtle.setheading(0)
turtle.pendown()
turtle.forward(180)

turtle.penup()
turtle.setposition(-70, 110)
turtle.setheading(0)
turtle.pendown()
turtle.forward(140)

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

turtle.penup()
turtle.setposition(-30, 70)
turtle.setheading(0)
turtle.pendown()
turtle.forward(60)

The final shape is now shown below:


Conclusion

We have used Python Turtle Graphics to draw the Mframadan symbol. Now that the meaning is clear, I realize that the lines we drew last represents the rafters.

The entire symbol is symbolic of a roof viewed from above.

Tuesday 12 December 2017

Me-Ware-Wo


Me-Ware-Wo means "I shall marry you". It is the symbol of commitment and perseverance.

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 shown below:
  1. Lift the turtle
  2. Set the pen size to 20 pixels
  3. Move the turtle to the position (-90, 10)
  4. Place the pen down
  5. Draw a circle of radius 80 pixels
  6. Set the heading of the turtle to 90 degrees
  7. Move forward by 50 pixels
  8. Change the heading of the turtle to 0 degrees
  9. Change the pen size to 1 pixel
  10. Draw a filled circle of radius 30 pixels
  11. Lift the pen
  12. Move the turtle to the position (90, 10)
  13. Set the pen size to 20 pixels
  14. Repeat steps 4 to 10
  15. Lift the pen
  16. Move the turtle to the position (90, -170)
  17. Set the pen size to 20 pixels
  18. Repeat steps 4 to 10
  19. Lift the pen
  20. Move the turtle to the position (-90, -170)
  21. Set the pen size to 20 pixels
  22. Repeat steps 4 to 10
Using Turtle Graphics

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

The code for steps 1 - 5 is given below:

turtle.penup()
turtle.pensize(20)
turtle.setposition(-90, 10)
turtle.pendown()
turtle.circle(80)

The generated image is shown below:


The code for steps 6 to 10 is given below:

turtle.setheading(90)
turtle.forward(50)
turtle.setheading(0)
turtle.pensize(1)
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()

The generated image is shown below:


Steps 14, 18 and 22 are repeated. This would be a good candidate for a function. So we create a function called draw_quarter_symbol and place it just after drawVertical function.

The code for the draw_quarter_symbol is shown below:

def draw_quarter_symbol():
    turtle.pendown()
    turtle.circle(80)
    turtle.setheading(90)
    turtle.forward(50)
    turtle.setheading(0)
    turtle.pensize(1)
    turtle.begin_fill()
    turtle.circle(30)
    turtle.end_fill()

This step we have carried out is called refactoring. The code that draws our symbol now becomes:

turtle.penup()
turtle.pensize(20)
turtle.setposition(-90, 10)
draw_quarter_symbol()

Run the above code and test it. The program runs as expected. To draw the rest of the symbol, you only need to copy and paste the code above 3 more times. Then you change the position you move your turtle to.

The code for our program now becomes:

turtle.penup()
turtle.pensize(20)
turtle.setposition(-90, 10)
draw_quarter_symbol()
turtle.penup()
turtle.pensize(20)
turtle.setposition(90, 10)
draw_quarter_symbol()
turtle.penup()
turtle.pensize(20)
turtle.setposition(90, -170)
draw_quarter_symbol()
turtle.penup()
turtle.pensize(20)
turtle.setposition(-90, -170)
draw_quarter_symbol()

The generated image is shown below:


Conclusion

At the end of this section, we have used the Python language to draw the Adinkra symbol Me Ware Wo.