Hi, Glen,
Wow! GraphTool with the triangle and quadralateral objects works great! Thank you!
Is there an option to change the color of the graphed object? I didn't see anything about it in the documentation, so perhaps not. As an example, I want to show a triangle and ask the student to graph a reflection of it. A different color is not essential. (I could make it "dashed".) It would look nice having the given image be different from the "answer" image. I've included the code below.
Thanks, again--rac
---------------------------------------------------------------------------------
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'GraphToolTriangle.pl', 'PGcourse.pl');
$x1 = random(1, 4); $y1 = random(1, 8);
$x2 = random(6, 8); $y2 = random(1, 8);
do {
$x3 = random(0, 8); $y3 = random(-8, 8)
}
until ($y3 - $y1) * ($x2 - $x1) != ($y2 - $y1) * ($x3 - $x1) && abs($y2-$y3)>1 && abs($y1-$y3)>1;
$rx1 = -1*$x1; $ry1 = $y1;
$rx2 = -1*$x2; $ry2 = $y2;
$rx3 = -1*$x3; $ry3 = $y3;
$gt = GraphTool("{ triangle, solid, ($rx1, $ry1), ($rx2, $ry2), ($rx3, $ry3) }")
->with(
bBox => [ -10, 10, 10, -10 ],
availableTools => [ 'TriangleTool' ],
staticObjects => ["{triangle, solid, ($x1, $y1), ($x2, $y2), ($x3, $y3)}"]);
BEGIN_PGML
The vertices of the triangle shown below are [`([$x1], [$y1])`], [`([$x2], [$y2])`] and [`([$x3], [$y3])`]. Draw on the same axes the image of the triangle under the reflection in the [`y`]-axis.
[_]{$gt}
END_PGML
ENDDOCUMENT();
Unfortunately there isn't a way to set the colors of the things that are graphed. Perhaps that could be implemented someday, but it would be challenging to figure out how to pass such an option from Perl to JavaScript in a reasonable way.
Thanks!
--rac
Maybe static objects and user-created objects should have different colors? Or at least an option to have different colors?