EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Turtle graphics designs, triangle

This works a lot like the turtle's square demo, except the loop cycles 3 times, and the turning angle is 120 degrees.

 Slow  Medium  Fast 
Click 'Run' to go.

When the turtle goes around an equilateral triangle, it will rotate a total of 360 degrees:

Like with the square, the turtle's turning angle around this equilateral polygon totals to 360 degrees.


The following picture shows each cycle of the repeat loop:


It is important to understand that although we are drawing an equilateral triangle which has internal angles equal to 60 degrees, the turtle's turning angle is not 60 degrees.


The turtle turns through 120 degrees at each vertice of the triangle. The 120 degrees is the size of the external angles for this triangle. The turtle turns through the external angles.


This is an equilateral triangle. So, all of the external angles are equal in measure. Since the external angles are the turtle's turning angles, all of the turtle's turning angles are equal in measure.

The turtle will rotate 360 degrees as it goes around any convex polygon, including this triangle, and those 360 degrees must here be divided equally among three turtle turns. 360 degrees divided by 3 is 120 degrees. So, the turtle must turn 120 degrees at each triangle vertex.

A square would have 4 turning angles, and 360 degrees divided by 4 gives us an angle of 90 degrees.

An equilateral pentagon would have a turning angle of 360 degrees divided by 5, which is 72 degrees.


A flowchart for the turtle's triangle demo:


The imaginary computer code for the turtle's triangle drawing:



Suggested next article:

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.


Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.