637
|
// add the point (x,y) to the graph of the circle
|
637
|
// add the point (x,y) to the graph of the circle
|
640
|
- The line `XYPlotWindow wCircleR5;` creates a `wCircleR5` object that will be the window where the graph will be drawn, in this case the graph of a circle of radius 5. In a similar way, the objects `wCircle` and `wButterfly` are created. Observe the `for` cycle. In this cycle a series of values for the angle $t$ is generated and the function `circle` is invoked, passing the value for $t$ and the references to $x$ and $y$. The `circle` function does not return a value, but using parameters by reference, it calculates the values for the coordinates $xCoord$ and $yCoord$ for the circle with center in the origin and radius 5, and allows the `main` function to have these values in the `x` , `y` variables.
|
|
|
|
|
640
|
+ The line `XYPlotWindow wCircleR5;` creates a `wCircleR5` object that will be the window where the graph will be drawn, in this case the graph of a circle of radius 5. In a similar way, the objects `wCircle` and `wButterfly` are created. Observe the `for` cycle. In this cycle a series of values for the angle $t$ is generated and the function `circle` is invoked, passing the value for $t$ and the references to $x$ and $y$. The `circle` function does not return a value, but using parameters by reference, it calculates the values for the coordinates $xCoord$ and $yCoord$ for the circle with center in the origin and radius 5, and allows the `main` function to have these values in the `x` , `y` variables.
|
642
|
After the function call, each ordered pair $(x,y)$ is added to the circle’s graph by the member function `AddPointToGraph(x,y)`. After the cycle, the member function `Plot()` is invoked, which draws the points, and the member function `show()`, which displays the graph. The *members functions* are functions that allow use to work with and object’s data. Notice that each one of the member functions is written after `wCircleR5`, followed by a period. In an upcoming laboratory experience you will learn more about objects, and practice how to create them and invoke their method functions.
|
642
|
After the function call, each ordered pair $(x,y)$ is added to the circle’s graph by the member function `AddPointToGraph(x,y)`. After the cycle, the member function `Plot()` is invoked, which draws the points, and the member function `show()`, which displays the graph. The *members functions* are functions that allow use to work with and object’s data. Notice that each one of the member functions is written after `wCircleR5`, followed by a period. In an upcoming laboratory experience you will learn more about objects, and practice how to create them and invoke their method functions.
|