Friday, 9 February 2018

Nkyinkyim


Nkyinkyim means "twisting". It is the symbol of that depicts the twists and turns of life.

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


This symbol is simple to draw. It consists of lines. What will make it tricky will be the way the lines change in width.

The plan to draw this symbol is given below:

  1. Lift up the turtle
  2. Move the turtle to the position (150, 170)
  3. Set the pensize to 40 pixels
  4. Set the heading of the turtle to 180 degrees
  5. Place the pen down
  6. Move forward by 300 pixels
  7. Move backward by 10 pixels
  8. Set the heading to 270 degrees
  9. Move forward by 10 pixels
  10. Change the pen size to 60 pixels
  11. Move the pen forward by 50 pixels
  12. Lift up the pen
  13. Move forward by 10 pixels
  14. Change the pen size to 40 pixels
  15. Set the heading to 0 degrees
  16. Place the pen down
  17. Move forward by 290 pixels
  18. Repeat steps 7 to 11
  19. Repeat steps 12 to 16 but change the heading to 180
  20. Repeat steps 7 to 11
  21. Repeat steps 12 to 16
  22. Repeat steps 7 to 11 however change the number of steps from 50 to 110
  23. Lift up the pen
  24. Move backward by 60 steps
  25. Repeat steps 12 to 16
  26. Repeat steps 7 to 11 however change the number of steps from 50 to 40
  27. Lift up the pen
  28. Change the pen size to 40 pixels
  29. Move the turtle to the position (-40, -110)
  30. Change the heading to 270 degrees
  31. Move forward by 60 pixels
  32. Lift up the pen
  33. Change the pen size to 40 pixels
  34. Move the turtle to the position (40, -110)
  35. Change the heading to 270 degrees
  36. Move forward by 60 pixels

Using Turtle Graphics

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

The code for steps 1 to 6 is given below:

turtle.penup()
turtle.setposition(150, 170)
turtle.pensize(40)
turtle.setheading(180)
turtle.pendown()
turtle.forward(300)

The code for steps 7 to 11 is given below:

turtle.backward(10)
turtle.setheading(270)
turtle.forward(10)
turtle.pensize(60)
turtle.forward(50)

The code for steps 12 to 16 is given below:

turtle.penup()
turtle.forward(10)
turtle.pensize(40)
turtle.setheading(0)
turtle.pendown()
turtle.forward(290)

Step 18 involves us repeating steps 7 to 11 so we copy and paste the code.

We do the same for steps 19, 20 and 21.

The image we have generated so far is shown below:


Executing steps 21 generates the image shown below:


The code for steps 23 and 24 is given below:

turtle.penup()
turtle.backward(60)

Then copy the code for steps 7 to 11 but remember to change the number of steps from 50 to 40.

The generated image is shown below:


The code for steps 27 to 31 is given below:

turtle.penup()
turtle.pensize(40)
turtle.setposition(-40, -110)
turtle.setheading(270)
turtle.pendown()
turtle.forward(60)

The code for steps 32 to 36 is given below:

turtle.penup()
turtle.pensize(40)
turtle.setposition(40, -110)
turtle.setheading(270)
turtle.pendown()
turtle.forward(60)

The generated image is shown below:


Conclusion

At the end of this section, we have succeeded in drawing the Nkyinkyim.

No comments:

Post a Comment