Grid: | ||
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
Labels: |
|
Font
px
|
Trace Lines: | ||
Robot 1: |
|
Width
px
|
Robot 2: |
|
Width
px
|
Robot 3: |
|
Width
px
|
Robot 4: |
|
Width
px
|
Axes: | x-axis | y-axis | Show Grid |
Grid: | 24x24 inches | 36x36 inches | 72x72 inches |
96x96 inches | 192x192 inches | ||
Quad: | 4 quadrants | 1 quadrant | Hardware |
Units: | US Customary | Metric |
Background: |
![]() |
|
|
|
|
|
|
|
|
|
/* Code generated by RoboBlockly v2.0 */ #include <chplot.h> double i; CPlot plot; // draw trees scaled void drawTree(double x, double y, double s) { double ytrunk; plot.fillColor("#006600"); plot.regularPolygon(x, y, 3, s, 0); ytrunk = y - double(s)/(2 * sqrt(3)); plot.fillColor("#663300"); plot.rectangle(x - double(s)/12, ytrunk - double(s)/3, double(s)/6, double(s)/3); } plot.noStrokeColor(); for(i = 1; i <= 20; i++) { //plot.backgroundImage("roadViewWithSun.png"); drawTree(36 - i * 3, 36 - i, 1 + i); drawTree(36 + i * 3, 36 - i, 1 + i); delaySeconds(0.03); } plot.label(PLOT_AXIS_XY, ""); plot.grid(PLOT_OFF); plot.tics(PLOT_AXIS_XY, PLOT_OFF); plot.axis(PLOT_AXIS_XY, PLOT_OFF); plot.axisRange(PLOT_AXIS_XY, 0, 72); plot.ticsRange(PLOT_AXIS_XY, 6); plot.sizeRatio(1); plot.plotting();
Problem Statement: The pre-placed blocks draw the two trees in the distance and provide a function called drawTrees which draws trees at given x and y coordinates at a scale of s. Add more blocks to animate the trees moving closer. The movement of the trees should follow the green lines. The center of the green triangles should always be on the green lines. The left line has a slope of 1/3 and the right line has a slope of -1/3. As the trees get closer, they should also get bigger. |
|||||||||||
|
|||||||||||