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
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
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 Angle measurement: DegreesRadians
Go on input
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
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: