|
| 1 | +## DESCRIPTION |
| 2 | +## Shows a triangle tool within the GraphTool. |
| 3 | +## ENDDESCRIPTION |
| 4 | + |
| 5 | +## DBsubject(WeBWorK) |
| 6 | +## DBchapter(Sample Problems) |
| 7 | +## DBsection(Graph Tool) |
| 8 | +## Date(02/25/2025) |
| 9 | +## Institution(Missouri Western) |
| 10 | +## Author(Glenn Rice) |
| 11 | +## MO(1) |
| 12 | +## KEYWORDS('graph tool', 'vectors') |
| 13 | + |
| 14 | +#:% name = Line Segment Graph Tool |
| 15 | +#:% type = Sample |
| 16 | +#:% subject = [geometry] |
| 17 | +#:% categories = [graph, graphtool] |
| 18 | +#:% see_also = [VectorGraphTool.pg, TriangleGraphTool.pg, QuadrilateralGraphTool.pg] |
| 19 | + |
| 20 | +#:% section = preamble |
| 21 | +#: Load the PODLINK('parserGraphTool.pl') macro to be able to use the GraphTool. |
| 22 | +DOCUMENT(); |
| 23 | + |
| 24 | +loadMacros('PGstandard.pl', 'PGML.pl', 'parserGraphTool.pl', 'PGcourse.pl'); |
| 25 | + |
| 26 | +#:% section = setup |
| 27 | +#: This problem first finds two points with unequal x-values and unequal y-values. |
| 28 | +#: Below we will ask to drap the line segment between these two and add the correct answer |
| 29 | +#: `{ segment, solid, ($sx1, $sy1), ($sx2, $sy2) }` creates this line segment as a solid line. |
| 30 | +#: |
| 31 | +#: |
| 32 | +#: The line segment must have the given the endpoints. |
| 33 | +#: |
| 34 | +#: Mulitple line segments can be added to the graph tool, but note that there is a |
| 35 | +#: Triangle Graph Tool, PROBLINK('TriangleGraphTool.pg') and a Quadrilateral Graph too, |
| 36 | +#: PROBLINK('QuadrilateralGraphTool.pg') as well. |
| 37 | +$sx1 = random(-8, 8); |
| 38 | +$sy1 = random(-8, 8); |
| 39 | +do { $sx2 = random(-8, 8); $sy2 = random(-8, 8); } |
| 40 | + until $sx2 != $sx1 || $sy2 != $sy1; |
| 41 | + |
| 42 | +$gt = GraphTool("{segment, solid, ($sx1, $sy1), ($sx2, $sy2)}",) |
| 43 | + ->with(availableTools => [ 'SegmentTool', 'FillTool', 'SolidDashTool' ]); |
| 44 | + |
| 45 | +#:% section = statement |
| 46 | +#: First, ask the question with the given points. Then add the `[_]{$gt}` to produce |
| 47 | +#: the graph tool within the problem. |
| 48 | +BEGIN_PGML |
| 49 | +Graph the line segment between the points [`([$sx1], [$sy1])`] and |
| 50 | +[`([$sx2], [$sy2])`]. |
| 51 | + |
| 52 | +[_]{$gt} |
| 53 | +END_PGML |
| 54 | + |
| 55 | +#:% section = solution |
| 56 | +#: The important thing to note is that it is simple to add the correct graph using the |
| 57 | +#: method `generateAnswerGraph` as shown in the solution here. The PGML directive [ ]* |
| 58 | +#: needs a * for the graph tool to be rendered correctly. |
| 59 | +BEGIN_PGML_SOLUTION |
| 60 | +The correct answer is |
| 61 | + |
| 62 | +[$gt->generateAnswerGraph]* |
| 63 | +END_PGML_SOLUTION |
| 64 | + |
| 65 | +ENDDOCUMENT(); |
0 commit comments