Sunday, 8 April 2018

Menso Wo Kenten


Menso Wo Kenten means "I am not carrying your basket". It is the symbol of industry, self-reliance, and economic self-determination.

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:
  1. Get the coordinates of the starting points of the stars
  2. Lift up the pen
  3. Set the pen size to 10 pixels
  4. Move it to the starting point of the first star
  5. Place the pen down
  6. Move forward by the y coordinate of the star
  7. Find the angle between the turtle and the topmost part of the star
  8. Set the heading of the pen to angle
  9. Find the distance between the turtle and the topmost part of the star
  10. Move forward by the distance found
  11. Set the heading of the pen to the value of the 360 minus the angle
  12. Move forward by the distance found
  13. Set the heading of the pen to 0 degrees
  14. Move forward by the y coordinate of the star
  15. Find the angle between the turtle and the next position of the line
  16. Find the distance between the turtle and the line
  17. Set the heading of the pen to angle obtained in 15
  18. Move forward by distance obtained in 16
  19. Set the heading of the pen to value of 180 minus the value obtained in 15
  20. Move forward by the distance obtained in 16
  21. Set the heading of the pen to 180
  22. Move forward by the y coordinate of the star 
  23. Set the heading of the pen to value of the angle obtained in 7 minus 180 degrees
  24. Move forward by the distance obtained in 9
  25. Set the heading of the pen to the value of 180 minus the angle obtained in 7
  26. Move forward by the distance obtained in 9
  27. Set the heading of the pen to 180 degrees
  28. Move forward by the y coordinate of the first star
  29. Set the heading of the pen to 300 minus the value obtained in 15
  30. Move forward by the value obtained in 16
  31. Set the heading of the pen to 360 minus the value obtained in 15
  32. Move forward by the value obtained in 16
  33. Repeat steps 4 to 32 for the second star
  34. Repeat steps 4 to 32 for the third star

Using Turtle Graphics

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

The first step of our plan is manual. We need to find the coordinates of the starting points of the stars.

Starting from the smallest, these are: (-50, 40), (-100, 70) and (-150, 100). The shape we used is slightly off by 10 pixels.

One of the rules of design for Adinkra symbols is symmetry. As a result of this, we will shift the starting points down by 10 pixels.

The new coordinates are now: (-50, 30), (-100, 60) and (-150, 90). Visual inspection of the new coordinates reveal a pattern.
The code for steps 2 to 6 is given below:

turtle.penup()
turtle.setposition(-50, 30)
turtle.pensize(10)
turtle.pendown()
turtle.forward(30)

Next we try to find the angle from the current position of the turtle to the topmost position of the star. The coordinates of the two positions are (-20, 30) and (0, 60). The code to do this is shown below:

myradians = math.atan2(60 - 30, 0 - (-20))
upperAngle = math.degrees(myradians)
turtle.setheading(upperAngle)

Next we find the distance between the two points using the coordinateDistance function shown below:

def coordinateDistance(x1, y1, x2, y2):
    dx = x1 - x2
    dy = y1 - y2
    D = math.sqrt((dx * dx) + (dy * dy))
    return D
length = coordinateDistance(-20, 30, 0, 60)
turtle.forward(length)

Steps 11 and 12 are easy as we have the values we need the code for these steps is shown below:

turtle.setheading(360 - upperAngle)
turtle.forward(length)

The code for steps 13 and 14 is given below:

turtle.setheading(0)
turtle.forward(30)

The code for step 15 to 18 is shown below:

myradians = math.atan2(0 - 30, 30 - 50)
lowerAngle = math.degrees(myradians)
turtle.setheading(lowerAngle)
lowerLength = coordinateDistance(50, 30, 30, 0)
turtle.forward(lowerLength)

The code for steps 19 and 20 is given below:

turtle.setheading(180 - lowerAngle)
turtle.forward(lowerLength)

From this point on, the rest is easy as we have all the values we need.

The code for steps 21 and 22 is given below:

turtle.setheading(180)
turtle.forward(30)

The code for steps 23 and 24 is given below:

turtle.setheading(upperAngle - 180)
turtle.forward(length)

The code for steps 25 and 26 is given below:

turtle.setheading(180 - upperAngle)
turtle.forward(length)

The code for steps 27 and 28 is given below:

turtle.setheading(180)
turtle.forward(30)

The code for steps 29 and 30 is given below:

turtle.setheading(300 - lowerAngle)
turtle.forward(lowerLength)

The code for steps 31 and 32 is given below:

turtle.setheading(360 - lowerAngle)
turtle.forward(lowerLength)

The generated image is shown below:


When we decide to draw the next star we don’t need to find the angles again. All we need are the distances for the star.
We repeat the code starting from step 2. We will skip the steps in the code where the value is known. The code for steps 2 to 6 is shown below:

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

Next we find the distance from the current position of the turtle to the position of the topmost part of the star. We know the coordinate of the turtle to be (-40, 60) and that of the topmost part to be (0, 120).

The code to draw the line is shown below:

turtle.setheading(upperAngle)
length = coordinateDistance(-40, 60, 0, 120)
turtle.forward(length)

The rest is easy from this point on. The code to draw the rest of the shape is shown below:

turtle.setheading(360 - upperAngle)
turtle.forward(length)

turtle.setheading(0)
turtle.forward(60)

turtle.setheading(lowerAngle)
turtle.forward(length)

turtle.setheading(180 - lowerAngle)
turtle.forward(length)

turtle.setheading(180)
turtle.forward(60)

turtle.setheading(upperAngle - 180)
turtle.forward(length)

turtle.setheading(180 - upperAngle)
turtle.forward(length)

turtle.setheading(180)
turtle.forward(60)

turtle.setheading(300 - lowerAngle)
turtle.forward(length)

turtle.setheading(360 - lowerAngle)
turtle.forward(length)

The generated image is shown below:


To draw the outer star, we don’t need to do much we move the pen to is new position and find the value of the length from the position of the turtle to the topmost position.

The code to do this is shown below:

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

turtle.setheading(upperAngle)
length = coordinateDistance(-60, 90, 0, 180)
turtle.forward(length)

turtle.setheading(360 - upperAngle)
turtle.forward(length)

turtle.setheading(0)
turtle.forward(90)

turtle.setheading(lowerAngle)
turtle.forward(length)

turtle.setheading(180 - lowerAngle)
turtle.forward(length)

turtle.setheading(180)
turtle.forward(90)

turtle.setheading(upperAngle - 180)
turtle.forward(length)

turtle.setheading(180 - upperAngle)
turtle.forward(length)

turtle.setheading(180)
turtle.forward(90)

turtle.setheading(300 - lowerAngle)
turtle.forward(length)

turtle.setheading(360 - lowerAngle)
turtle.forward(length)

The generated image is shown below:


Conclusion

At the end of this section, we have successfully drawn the shape but there is a variance on the left side.
I shall address this when I review this section.

In this section we cover how to draw the Menso Wo Kenten symbol. It is basically a star shaped 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