Difference between revisions of "DynamicImages3"
(New page: <h2>Dynamic Graphic Images, with Filled Regions</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px...) |
(added historical tag and gave updated problem link) |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Misc/DynamicGraphPolygon.html a newer version of this problem]</p> |
||
<h2>Dynamic Graphic Images, with Filled Regions</h2> |
<h2>Dynamic Graphic Images, with Filled Regions</h2> |
||
Line 24: | Line 27: | ||
<pre> |
<pre> |
||
DOCUMENT(); |
DOCUMENT(); |
||
− | loadMacros( |
+ | loadMacros( |
− | + | "PGstandard.pl", |
|
− | + | "PGgraphmacros.pl", |
|
− | + | # "PGnumericalmacros.pl", # might be useful |
|
− | + | ); |
|
− | "extraAnswerEvaluators.pl", |
||
− | "weightedGrader.pl" |
||
− | ); |
||
TEXT(beginproblem()); |
TEXT(beginproblem()); |
||
− | |||
− | install_weighted_grader(); |
||
− | |||
− | $showPartialCorrectAnswers = 1; |
||
</pre> |
</pre> |
||
</td> |
</td> |
||
Line 40: | Line 39: | ||
<p> |
<p> |
||
<b>Initialization:</b> |
<b>Initialization:</b> |
||
− | To do ..(what you are doing)........., we don't have to change the |
||
+ | We need to include the macro file <code>PGgraphmacros.pl</code>. |
||
− | tagging and documentation section of the problem file. |
||
− | In the initialization section, we need to include the macros file <code>-------.pl</code>. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 52: | Line 49: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> |
<td style="background-color:#ffffdd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | # Construct a graph for the left endpoint Riemann sum, |
||
+ | foreach my $i (0..2) { |
||
− | # define the function to be graphed, and add it to the graph |
||
+ | $gr[$i] = init_graph(-5,-5,5,5,grid=>[10,10],axes=>[0,0],pixels=>[400,400]); |
||
− | $graphL = init_graph(-1,-1,9,9,ticks=>[10,10],axes=>[0,0],pixels=>[400,400]); |
||
+ | $gr[$i]->lb('reset'); |
||
− | $c = random(8,12,1); # a constant for scaling the function |
||
+ | foreach my $j (1..4) { |
||
− | $f = FEQ("x**2/$c for x in <-1,9> using color:blue and weight:2"); |
||
+ | $gr[$i]->lb( new Label(-4.7, $j, $j,'black','center','middle')); |
||
− | $ftex = "\frac{x^2}{$c}"; |
||
+ | $gr[$i]->lb( new Label(-4.7, -$j,-$j,'black','center','middle')); |
||
− | # the parentheses around $fRefL are necessary |
||
+ | $gr[$i]->lb( new Label( $j,-4.7, $j,'black','center','middle')); |
||
− | ($fRefL) = plot_functions( $graphL, $f ); |
||
+ | $gr[$i]->lb( new Label( -$j,-4.7,-$j,'black','center','middle')); |
||
+ | } |
||
+ | $gr[$i]->lb( new Label(4.7,0.2,'x','black','center','middle')); |
||
+ | $gr[$i]->lb( new Label(0.2,4.7,'y','black','center','middle')); |
||
+ | $gr[$i]->new_color("lightblue", 214,230,244); # RGB |
||
+ | $gr[$i]->new_color("darkblue", 100,100,255); |
||
+ | $gr[$i]->new_color("lightgreen",156,215,151); |
||
+ | $gr[$i]->new_color("darkgreen", 0, 86, 34); |
||
+ | $gr[$i]->new_color("lightred", 245,234,229); # light red-purple |
||
+ | $gr[$i]->new_color("darkred", 159, 64, 16); # red-brown |
||
+ | $gr[$i]->new_color("nicegreen", 0,110, 0); |
||
+ | } |
||
− | # Generate arrays of x and y values for the Riemann sum. |
||
− | # There are n+1 entries in each array so that we can use |
||
− | # only one pair of arrays for both the left and the right |
||
− | # endpoint Riemann sums. |
||
− | $a = random(2,4,1); # left endpoint of interval |
||
− | $b = $a+4; # right endpoint of interval |
||
− | $n = 8; # number of rectangles |
||
− | $deltax = ($b - $a)/$n; |
||
− | foreach $k (0..$n) { $x[$k] = $a + $k * $deltax; } |
||
− | foreach $k (0..$n) { $y[$k] = &{$fRefL->rule}($x[$k]); } |
||
+ | # |
||
+ | # Filled triangle with dark border |
||
+ | # |
||
+ | # Note: we could fill in any polygon by adding more sides |
||
+ | # |
||
+ | $xmin = random(-3,-1,1); |
||
+ | $xmax = random(1,3,1); |
||
+ | $ymin = random(-3,-1,1); |
||
+ | $ymax = random(1,3,1); |
||
+ | $gr[0]->moveTo($xmin,$ymin); |
||
+ | $gr[0]->lineTo($xmax,$ymin,"darkgreen",2); # bottom edge |
||
+ | $gr[0]->lineTo($xmin,$ymax,"darkgreen",2); # hypotenuse |
||
+ | $gr[0]->lineTo($xmin,$ymin,"darkgreen",2); # left edge |
||
+ | $gr[0]->fillRegion([$xmin+0.1,$ymin+0.1,"lightgreen"]); |
||
− | # Graph the left endpoint Riemann sum |
||
− | $lightblue = $graphL->im->colorAllocate(148,201,255); |
||
− | $darkblue = $graphL->im->colorAllocate(100,100,255); |
||
− | # Create arrays of pixel references for x and y values |
||
− | foreach $k (0..8) { |
||
− | $xpixL[$k] = $graphL->ii($x[$k]); |
||
− | $ypixL[$k] = $graphL->jj($y[$k]); |
||
− | } |
||
− | $xaxisL = $graphL->jj(0); |
||
− | # Plot the rectangles in the Riemann sum |
||
− | foreach $k (0..$n-1) { |
||
− | $graphL->im->filledRectangle($xpixL[$k],$ypixL[$k],$xpixL[$k+1],$xaxisL,$lightblue); |
||
− | $graphL->im->rectangle($xpixL[$k],$ypixL[$k],$xpixL[$k+1],$xaxisL,$darkblue); |
||
− | } |
||
− | $graphL->lb(new Label ( 8.5,0,'x','black','right','top')); |
||
− | $graphL->lb(new Label ( -0.25,8.5,'y','black','right','top')); |
||
+ | # |
||
+ | # Integral as area under the curve example |
||
+ | # |
||
+ | add_functions($gr[1], |
||
+ | "sqrt(x)+1 for x in <0,5> using color:darkblue and weight:2"); |
||
+ | $gr[1]->moveTo(1,2); |
||
+ | $gr[1]->lineTo(1,0,"darkblue",2); |
||
+ | $gr[1]->lineTo(4,0,"darkblue",2); |
||
+ | $gr[1]->lineTo(4,3,"darkblue",2); |
||
+ | $gr[1]->fillRegion([1.1,0.1,"lightblue"]); |
||
− | # Construct a graph for the right endpoint Riemann sum |
||
− | $graphR = init_graph(-1,-1,9,9,ticks=>[10,10],axes=>[0,0],pixels=>[400,400]); |
||
− | # the parentheses around $fRefR are necessary |
||
− | ($fRefR) = plot_functions( $graphR, $f ); |
||
− | # Graph the right endpoint Riemann sum |
||
+ | # |
||
− | $lightblue = $graphR->im->colorAllocate(148,201,255); |
||
+ | # A filled in circle |
||
− | $darkblue = $graphR->im->colorAllocate(100,100,255); |
||
+ | # |
||
− | # Create arrays of pixel references for x and y values |
||
+ | add_functions($gr[2], |
||
− | foreach $k (0..8) { |
||
+ | " sqrt(4-x^2) for x in <-2,2> using color:darkred and weight:2", |
||
− | $xpixR[$k] = $graphR->ii($x[$k]); |
||
+ | "-sqrt(4-x^2) for x in <-2,2> using color:darkred and weight:2" |
||
− | $ypixR[$k] = $graphR->jj($y[$k]); |
||
+ | ); |
||
− | } |
||
+ | $gr[2]->fillRegion([0.1,0.1,"lightred"]); |
||
− | $xaxisR = $graphR->jj(0); |
||
− | # Plot the rectangles in the Riemann sum |
||
− | foreach $k (1..$n) { |
||
− | $graphR->im->filledRectangle($xpixR[$k-1],$ypixR[$k],$xpixR[$k],$xaxisR,$lightblue); |
||
− | $graphR->im->rectangle($xpixR[$k-1],$ypixR[$k],$xpixR[$k],$xaxisR,$darkblue); |
||
− | } |
||
− | $graphR->lb(new Label ( 8.5,0,'x','black','right','top')); |
||
− | $graphR->lb(new Label ( -0.25,8.5,'y','black','right','top')); |
||
</pre> |
</pre> |
||
</td> |
</td> |
||
Line 119: | Line 113: | ||
<p> |
<p> |
||
<b>Setup:</b> |
<b>Setup:</b> |
||
− | We specify that the Context should be <code>......</code>, and define the answer to be a formula. |
||
+ | To use the <code>fillRegion</code> feature, we must first create a region enclosed by one particular color (like darkgreen or darkblue in the examples), then choose a point inside that closed region and a color to fill with (like lightgreen or lightblue in the examples). The fill feature will expand from the chosen point until it comes to the color that bounds the region (like darkgreen or darkblue), and it will cross solid lines of other colors, such as black coordinate axes, to do so. |
||
</p> |
</p> |
||
<p> |
<p> |
||
− | Notes: on using this and related Contexts. |
||
+ | The examples to the left use the features provided by <code>WWPlot.pm</code>, which is part of the base code of WeBWorK. The perl code used to create these graphs, <code>GD.pm</code>, is the engine used by <code>WWPlot.pm</code>. The features provided by <code>WWPlot.pm</code> are very accessible and easy to use (for example, you specify everything in terms of coordinates on the graph, and WWPlot.pm translates all of your commands into pixel coordinates on the image file that is generated). Sometimes, though, you may want to access features provided by <code>GD.pm</code> directly or need a feature not currently provided by <code>WWPlot.pm</code>. Below, we give a few examples of how to access features of <code>GD.pm</code> directly via the <code>->im-></code> command, and how to convert from graph coordinates to pixel coordinates on the image file via the x-coordinate to pixel converter <code>ii()</code> and the y-coordinate to pixel converter <code>jj()</code>. |
||
+ | </p> |
||
+ | <p> |
||
+ | <pre> |
||
+ | # filled rectangle with dark border |
||
+ | # uses some macros directly from GD.pm |
||
+ | # |
||
+ | $gr2 = init_graph(-4,-4,4,4,grid=>[8,8],axes=>[0,0],pixels=>[300,300]); |
||
+ | $lightblue = $gr2->im->colorAllocate(148,201,255); |
||
+ | $darkblue = $gr2->im->colorAllocate(100,100,255); |
||
+ | # |
||
+ | # translate from graph coordinates to pixel coordinates |
||
+ | # |
||
+ | $xminpixel = $gr2->ii($xmin); |
||
+ | $xmaxpixel = $gr2->ii($xmax); |
||
+ | $yminpixel = $gr2->jj($ymin); |
||
+ | $ymaxpixel = $gr2->jj($ymax); |
||
+ | # |
||
+ | # use filledRectangle and rectangle from GD.pm, accessed via ->im-> |
||
+ | # |
||
+ | $gr2->im->filledRectangle($xminpixel,$yminpixel,$xmaxpixel,$ymaxpixel,$lightblue); |
||
+ | $gr2->im->rectangle($xminpixel,$yminpixel,$xmaxpixel,$ymaxpixel,$darkblue); |
||
+ | |||
+ | |||
+ | |||
+ | ################ |
||
+ | # Graph |
||
+ | # |
||
+ | # filled circle with dark border |
||
+ | # uses some macros directly from GD.pm |
||
+ | # |
||
+ | $r = random(1,4,1); # radius |
||
+ | |||
+ | $gr3 = init_graph(-5,-5,5,5,grid=>[10,10],axes=>[0,0],pixels=>[400,400]); |
||
+ | $gr3->lb('reset'); |
||
+ | foreach my $i (1..4) { |
||
+ | $gr3->lb( new Label(-4.7,$i,$i,'black','center','middle')); |
||
+ | $gr3->lb( new Label(-4.7,-$i,-$i,'black','center','middle')); |
||
+ | $gr3->lb( new Label($i,-4.7,$i,'black','center','middle')); |
||
+ | $gr3->lb( new Label(-$i,-4.7,-$i,'black','center','middle')); |
||
+ | } |
||
+ | $gr3->lb( new Label(4.7,0.2,'x','black','center','middle')); |
||
+ | $gr3->lb( new Label(0.2,4.7,'y','black','center','middle')); |
||
+ | |||
+ | $lightblue = $gr3->im->colorAllocate(148,201,255); |
||
+ | $darkblue = $gr3->im->colorAllocate(100,100,255); |
||
+ | # |
||
+ | # use arc() and fillToBorder() from GD.pm, accessed via ->im-> |
||
+ | # |
||
+ | $cxpixel = $gr3->ii(0); # x-coordinate of center |
||
+ | $cypixel = $gr3->jj(0); # x-coordinate of center |
||
+ | $dxpixel = $gr3->ii($r) - $gr3->ii(-$r); # diameter of ellipse, x-direction |
||
+ | $dypixel = $gr3->jj($r) - $gr3->jj(-$r); # diameter of ellipse, y-direction |
||
+ | # |
||
+ | # 0 to 360 are degrees |
||
+ | $gr3->im->arc($cxpixel,$cypixel,$dxpixel,$dypixel,0,360,$darkblue); |
||
+ | $gr3->im->fillToBorder($cxpixel,$cypixel,$darkblue,$lightblue); |
||
+ | </pre> |
||
</p> |
</p> |
||
Line 134: | Line 185: | ||
<pre> |
<pre> |
||
BEGIN_TEXT |
BEGIN_TEXT |
||
− | |||
− | The rectangles in the graph below illustrate a left endpoint Riemann sum for \( \displaystyle f(x) = $ftex \) on the interval \( \lbrack $a, $b \rbrack \). |
||
− | $BR |
||
− | The value of this left endpoint Riemann sum is \{NAMED_ANS_RULE('optional1',30)\}, |
||
− | and this Riemann sum is an \{ NAMED_POP_UP_LIST('optional2',['?','overestimate |
||
− | of','equal to','underestimate of','there is ambiguity']) \} the area of the region enclosed by \(\displaystyle y = f(x) \), the x-axis, and the vertical lines x = $a and x = $b. |
||
− | |||
− | $BR |
||
− | $BR |
||
− | |||
$BCENTER |
$BCENTER |
||
− | \{ begintable(1) \} |
||
+ | \{ image( insertGraph($gr[0]), height=>400, width=>400, tex_size=>800 ) \} |
||
− | \{ row( image( insertGraph($graphL), height=>400, width=>400, tex_size=>800 ) ) \} |
||
+ | $PAR |
||
− | \{ row("Left endpoint Riemann sum for \( y = $ftex \) on \( \lbrack $a, $b \rbrack \)") \} |
||
+ | \{ image( insertGraph($gr[1]), height=>400, width=>400, tex_size=>800 ) \} |
||
− | \{ endtable() \} |
||
+ | $PAR |
||
+ | \{ image( insertGraph($gr[2]), height=>400, width=>400, tex_size=>800 ) \} |
||
$ECENTER |
$ECENTER |
||
− | |||
− | $BR |
||
− | $HR |
||
− | $BR |
||
− | |||
− | The rectangles in the graph below illustrate a right endpoint Riemann sum for \( \displaystyle f(x) = $ftex \) on the interval \( \lbrack $a, $b \rbrack \). |
||
− | $BR |
||
− | The value of this right endpoint Riemann sum is \{NAMED_ANS_RULE('optional3',30)\}, |
||
− | and this Riemann sum is an \{ NAMED_POP_UP_LIST('optional4',['?','overestimate of','equal to','underestimate of','there is ambiguity']) \} the area of the region enclosed by \(\displaystyle y = f(x) \), the x-axis, and the vertical lines x = $a and x = $b. |
||
− | $BR |
||
− | $BR |
||
− | |||
− | $BCENTER |
||
− | \{ begintable(1) \} |
||
− | \{ row( image( insertGraph($graphR), height=>400, width=>400, tex_size=>800 ) ) \} |
||
− | \{ row("Right endpoint Riemann sum for \( y = $ftex \) on \( \lbrack $a, $b \rbrack \)") \} |
||
− | \{ endtable() \} |
||
− | $ECENTER |
||
− | |||
END_TEXT |
END_TEXT |
||
</pre> |
</pre> |
||
Line 184: | Line 207: | ||
<td style="background-color:#eeddff;border:black 1px dashed;"> |
<td style="background-color:#eeddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | $LeftRiemannSum = 0; |
||
− | foreach $k (0..$n-1) { $LeftRiemannSum = $LeftRiemannSum + $y[$k]; } |
||
− | $LeftRiemannSum = $deltax * $LeftRiemannSum; |
||
− | NAMED_WEIGHTED_ANS('optional1',num_cmp($LeftRiemannSum),45); |
||
− | NAMED_WEIGHTED_ANS('optional2',str_cmp("underestimate of"),5); |
||
+ | $showPartialCorrectAnswers = 1; |
||
− | |||
− | $RightRiemannSum = 0; |
||
− | foreach $k (1..$n) { $RightRiemannSum = $RightRiemannSum + $y[$k]; } |
||
− | $RightRiemannSum = $deltax * $RightRiemannSum; |
||
− | NAMED_WEIGHTED_ANS('optional3',num_cmp($RightRiemannSum),45); |
||
− | |||
− | NAMED_WEIGHTED_ANS('optional4',str_cmp("overestimate of"),5); |
||
ENDDOCUMENT(); |
ENDDOCUMENT(); |
||
− | |||
− | |||
</pre> |
</pre> |
||
<td style="background-color:#eeccff;padding:7px;"> |
<td style="background-color:#eeccff;padding:7px;"> |
||
Line 214: | Line 224: | ||
[[IndexOfProblemTechniques|Problem Techniques Index]] |
[[IndexOfProblemTechniques|Problem Techniques Index]] |
||
</p> |
</p> |
||
+ | |||
+ | |||
+ | |||
+ | <ul> |
||
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/PGgraphmacros.html PGgraphmacros.pl]</li> |
||
+ | <li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/PGgraphmacros.pl?view=log PGgraphmacros.pl]</li> |
||
+ | </ul> |
||
+ | |||
+ | |||
+ | <ul> |
||
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/lib/WWPlot.html WWPlot.pm]</li> |
||
+ | <li>PG library file: [http://webwork.maa.org/viewvc/system/trunk/pg/lib/WWPlot.pm?view=log WWPlot.pm]</li> |
||
+ | </ul> |
||
[[Category:Problem Techniques]] |
[[Category:Problem Techniques]] |
Latest revision as of 09:44, 29 June 2023
This problem has been replaced with a newer version of this problem
Dynamic Graphic Images, with Filled Regions
This code snippet shows the essential PG code to check student answers that are equations. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "PGgraphmacros.pl", # "PGnumericalmacros.pl", # might be useful ); TEXT(beginproblem()); |
Initialization:
We need to include the macro file |
foreach my $i (0..2) { $gr[$i] = init_graph(-5,-5,5,5,grid=>[10,10],axes=>[0,0],pixels=>[400,400]); $gr[$i]->lb('reset'); foreach my $j (1..4) { $gr[$i]->lb( new Label(-4.7, $j, $j,'black','center','middle')); $gr[$i]->lb( new Label(-4.7, -$j,-$j,'black','center','middle')); $gr[$i]->lb( new Label( $j,-4.7, $j,'black','center','middle')); $gr[$i]->lb( new Label( -$j,-4.7,-$j,'black','center','middle')); } $gr[$i]->lb( new Label(4.7,0.2,'x','black','center','middle')); $gr[$i]->lb( new Label(0.2,4.7,'y','black','center','middle')); $gr[$i]->new_color("lightblue", 214,230,244); # RGB $gr[$i]->new_color("darkblue", 100,100,255); $gr[$i]->new_color("lightgreen",156,215,151); $gr[$i]->new_color("darkgreen", 0, 86, 34); $gr[$i]->new_color("lightred", 245,234,229); # light red-purple $gr[$i]->new_color("darkred", 159, 64, 16); # red-brown $gr[$i]->new_color("nicegreen", 0,110, 0); } # # Filled triangle with dark border # # Note: we could fill in any polygon by adding more sides # $xmin = random(-3,-1,1); $xmax = random(1,3,1); $ymin = random(-3,-1,1); $ymax = random(1,3,1); $gr[0]->moveTo($xmin,$ymin); $gr[0]->lineTo($xmax,$ymin,"darkgreen",2); # bottom edge $gr[0]->lineTo($xmin,$ymax,"darkgreen",2); # hypotenuse $gr[0]->lineTo($xmin,$ymin,"darkgreen",2); # left edge $gr[0]->fillRegion([$xmin+0.1,$ymin+0.1,"lightgreen"]); # # Integral as area under the curve example # add_functions($gr[1], "sqrt(x)+1 for x in <0,5> using color:darkblue and weight:2"); $gr[1]->moveTo(1,2); $gr[1]->lineTo(1,0,"darkblue",2); $gr[1]->lineTo(4,0,"darkblue",2); $gr[1]->lineTo(4,3,"darkblue",2); $gr[1]->fillRegion([1.1,0.1,"lightblue"]); # # A filled in circle # add_functions($gr[2], " sqrt(4-x^2) for x in <-2,2> using color:darkred and weight:2", "-sqrt(4-x^2) for x in <-2,2> using color:darkred and weight:2" ); $gr[2]->fillRegion([0.1,0.1,"lightred"]); |
Setup:
To use the
The examples to the left use the features provided by
# filled rectangle with dark border # uses some macros directly from GD.pm # $gr2 = init_graph(-4,-4,4,4,grid=>[8,8],axes=>[0,0],pixels=>[300,300]); $lightblue = $gr2->im->colorAllocate(148,201,255); $darkblue = $gr2->im->colorAllocate(100,100,255); # # translate from graph coordinates to pixel coordinates # $xminpixel = $gr2->ii($xmin); $xmaxpixel = $gr2->ii($xmax); $yminpixel = $gr2->jj($ymin); $ymaxpixel = $gr2->jj($ymax); # # use filledRectangle and rectangle from GD.pm, accessed via ->im-> # $gr2->im->filledRectangle($xminpixel,$yminpixel,$xmaxpixel,$ymaxpixel,$lightblue); $gr2->im->rectangle($xminpixel,$yminpixel,$xmaxpixel,$ymaxpixel,$darkblue); ################ # Graph # # filled circle with dark border # uses some macros directly from GD.pm # $r = random(1,4,1); # radius $gr3 = init_graph(-5,-5,5,5,grid=>[10,10],axes=>[0,0],pixels=>[400,400]); $gr3->lb('reset'); foreach my $i (1..4) { $gr3->lb( new Label(-4.7,$i,$i,'black','center','middle')); $gr3->lb( new Label(-4.7,-$i,-$i,'black','center','middle')); $gr3->lb( new Label($i,-4.7,$i,'black','center','middle')); $gr3->lb( new Label(-$i,-4.7,-$i,'black','center','middle')); } $gr3->lb( new Label(4.7,0.2,'x','black','center','middle')); $gr3->lb( new Label(0.2,4.7,'y','black','center','middle')); $lightblue = $gr3->im->colorAllocate(148,201,255); $darkblue = $gr3->im->colorAllocate(100,100,255); # # use arc() and fillToBorder() from GD.pm, accessed via ->im-> # $cxpixel = $gr3->ii(0); # x-coordinate of center $cypixel = $gr3->jj(0); # x-coordinate of center $dxpixel = $gr3->ii($r) - $gr3->ii(-$r); # diameter of ellipse, x-direction $dypixel = $gr3->jj($r) - $gr3->jj(-$r); # diameter of ellipse, y-direction # # 0 to 360 are degrees $gr3->im->arc($cxpixel,$cypixel,$dxpixel,$dypixel,0,360,$darkblue); $gr3->im->fillToBorder($cxpixel,$cypixel,$darkblue,$lightblue); |
BEGIN_TEXT $BCENTER \{ image( insertGraph($gr[0]), height=>400, width=>400, tex_size=>800 ) \} $PAR \{ image( insertGraph($gr[1]), height=>400, width=>400, tex_size=>800 ) \} $PAR \{ image( insertGraph($gr[2]), height=>400, width=>400, tex_size=>800 ) \} $ECENTER END_TEXT |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: PGgraphmacros.pl
- PG macro: PGgraphmacros.pl