EZ Programing Demos

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

Links to topics:

Current topic:

Turtle graphics designs, polygon

Here we are drawing an equilateral polygon with n sides. For example, if we draw a triangle, then n = 3.

The turning angle for the turtle when it is drawing an equilateral polygon with n sides is 360 degrees divided by n.

 Slow  Medium  Fast 
Click 'Run' to go.

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

 

Since an equilateral pentagon has 5 sides, the turtle's turning angle is 72 degrees. If you divide 360 degrees by 5, you get 72 degrees.

 

Here we see a general solution for drawing any equilateral polygon with turtle graphics. You simply divide 360 degrees by the number of sides for the polygon to calculate the turning angle for the turtle at each vertex.

 

Here's this demo's flowchart:

 

Here's a look at the imaginary computer code:

    
    n = 5;
    
    repeat(n)
    {
      fd(4);
      lt(360 / n);
    }
    

At EZ Math Movie

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.