Using Multiple Parameters: Some commands require one input parameter, such as driveDistance (the parameter is the distance to be driven), but many require multiple parameters, as we have seen with some of the drawing commands. In these cases, the parameters in the code blocks are separated by commas (if listed horizontally) or displayed in a column. The given order of the parameters matters, i.e., the command expects to receive the appropriate input values in the order listed. (When using drag-and-drop code blocks it's obvious which parameter is which, but when writing text-based programming code, it's not always so clear.) In this activity we introduce another drawing command that uses multiple parameters: the arc command.
|
Grid Size: S M L | Simple View: | MinView: |
|
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
The arc command draws a portion of a circle. For example, the pre-placed arc command draws a half-circle. (Click "Run" to try it out.) Its first two parameters specify the (x,y) coordinates of the center of the circle, the third parameter specifies the radius for the circle, and the final two parameters specify the start and ending angle of the arc, with the positive x axis being an angle of 0 degrees (and 360 degrees) and the positive direction for angle measurement being counter-clockwise. Experiment with different parameter values for the arc command to get a feel for it, and then try to create the code that will reproduce the squiggly line shown, consisting of four arcs. |
|
|
|||||||||||
|
|||||||||||