Points can be drawn, or plotted, on the (x, y) graph. We will introduce three commands:
setupGraph(); drawPoint(x, y); stop();
Following is an explanation for each one of these.
Before we plot any points we usually need to set up the graph. Often, this entails something like the following lines, all with their obvious meanings:
clearGraph(); drawGrid(); drawAxes(); drawOrigin(); setLineThickness(2); setLineColor('black'); setAreaColor('yellow');
All of this, though, can be done with one command:
In EZ Math Movie you plot a point with the command drawPoint.
Here is a programing line that plots a point at (3, 2):
In the above line 3 is the x-coordinate, and 2 is the y-coordinate.
Be sure to note the open and close parentheses, and the comma between the 3 and the 2, and the semi-colon at the end of the line.
The looping section of EZ Math Movie is stopped with the command stop. When used, it should be placed as the last line in the loop code section. This command stops the program the same way that pressing the stop button would. It looks like this:
Besides showing how to plot a point, this tutorial example shows you how to write a program that does not loop. Just place stop at the end of the loop code section, and that section will only run once.
You have probably figured out that all commands have parentheses after their name. In the case of drawPoint, the parentheses seem at first to be used as some type of container for the x- and y-coordinates. What about those empty parentheses in setupGraph and stop? What use are they?
The parentheses are empty, but still must be present. Technically, it's the parentheses that tell the computer to execute the command. They are not really containers for values. Sometimes they have values within them, sometimes not, but they have to be there to make anything happen, say, like setting up the graph.
The following example program demonstrates the drawPoint command as well as the other commands explained here.
Next tutorial: Drawing a line segment
Here is a link to a related article at EZ Programing Demos: