# EZ Math Movie, Tutorials, Designs, The Circle

### What is a circle?

A circle is a set of points equidistant from a point called the center of the circle. Here our center is at the origin, and our drawing will form a circle around it.

The (x, y) points on the circle can be calculated using trigonometry. These coordinates are calculated using the angle and the radius along with the sine and cosine trig functions. Here is a diagram showing the mathematics:

### The example before loop code

Remember, this code always runs only once. Here we do all the setup work for the animation:

• Get the graph ready with the setupGraph command.
• Set the value for the radius to 5 units.
• Set the starting angle to 0 degrees.

### The example loop code

The loop code will run again and again. Here is what happens every cycle in this classic EZ Math Movie animation:

• The coordinates for the (x, y) point on the circle are calculated for the current angle of rotation.
• The radius is drawn as a line segment from the origin out to the current (x, y) point on the circle.
• The current point on the circle is drawn.
• The angle is increased by 10 degrees.
• So, in the next loop cycle the new angle will be 10 degrees greater than the old angle in the last loop cycle.
• We check to see if the angle is over 360 degrees. If it is, we have gotten all the way around the circle.
• If we are all the way around the circle, then quit looping.
• If we are not all the way around, then continue looping through the next cycle, now with the angle increased by 10 degrees.

### The example program

0ptions

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide

### Experiments

You can make the circle smaller or larger by changing the value for the radius. This would be done in the before loop code. For example, this would make the circle larger:

`radius = 8;`

You could make the number of points more or less by changing the way that the angle increases. For example, if you incremented angle by 5 degrees, rather than by 10 degrees, you would get twice as many points. You would do this in the loop code:

`angle += 5;`

You could draw half a circle by stopping at an angle of 180 degrees. In the loop code:

`if(angle > 180)`

### And....

Next tutorial: Drawing functions, Point by point

### Other sites you may find interesting

Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Custom Search

Name:
Domain:

Name
0

Name:
Name
0