… | |
… | |
2 | |
2 | |
3 | sub _parserParametricLine_init {}; # don't reload this file |
3 | sub _parserParametricLine_init {}; # don't reload this file |
4 | |
4 | |
5 | =head1 DESCRIPTION |
5 | =head1 DESCRIPTION |
6 | |
6 | |
7 | ###################################################################### |
7 | ###################################################################### |
8 | # |
8 | # |
9 | # This is a Parser class that implements parametric lines as |
9 | # This is a Parser class that implements parametric lines as |
10 | # a subclass of the Formula class. The standard ->cmp routine |
10 | # a subclass of the Formula class. The standard ->cmp routine |
11 | # will work for this, provided we define the compare() function |
11 | # will work for this, provided we define the compare() function |
12 | # needed by the overloaded ==. We assign the special precedence |
12 | # needed by the overloaded ==. We assign the special precedence |
13 | # so that overloaded operations will be promoted to the ones below. |
13 | # so that overloaded operations will be promoted to the ones below. |
14 | # |
14 | # |
15 | # Use ParametricLine(point,vector) or ParametricLine(formula) |
15 | # Use ParametricLine(point,vector) or ParametricLine(formula) |
16 | # to create a ParametricLine object. You can pass an optional |
16 | # to create a ParametricLine object. You can pass an optional |
17 | # additional parameter that indicated the variable to use for the |
17 | # additional parameter that indicated the variable to use for the |
18 | # parameter for the line. |
18 | # parameter for the line. |
19 | # |
19 | # |
20 | # Usage examples: |
20 | # Usage examples: |
21 | # |
21 | # |
22 | # $L = ParametricLine(Point(3,-1,2),Vector(1,1,3)); |
22 | # $L = ParametricLine(Point(3,-1,2),Vector(1,1,3)); |
23 | # $L = ParametricLine([3,-1,2],[1,1,3]); |
23 | # $L = ParametricLine([3,-1,2],[1,1,3]); |
24 | # $L = ParametricLine("<t,1-t,2t-3>"); |
24 | # $L = ParametricLine("<t,1-t,2t-3>"); |
25 | # |
25 | # |
26 | # $p = Point(3,-1,2); $v = Vector(1,1,3); |
26 | # $p = Point(3,-1,2); $v = Vector(1,1,3); |
27 | # $L = ParametricLine($p,$v); |
27 | # $L = ParametricLine($p,$v); |
28 | # |
28 | # |
29 | # $t = Formula('t'); $p = Point(3,-1,2); $v = Vector(1,1,3); |
29 | # $t = Formula('t'); $p = Point(3,-1,2); $v = Vector(1,1,3); |
30 | # $L = ParametricLine($p+$t*$v); |
30 | # $L = ParametricLine($p+$t*$v); |
31 | # |
31 | # |
32 | # Context()->constants->are(a=>1+pi^2); # won't guess this value |
32 | # Context()->constants->are(a=>1+pi^2); # won't guess this value |
33 | # $L = ParametricLine("(a,2a,-1) + t <1,a,a^2>"); |
33 | # $L = ParametricLine("(a,2a,-1) + t <1,a,a^2>"); |
34 | # |
34 | # |
35 | # Then use |
35 | # Then use |
36 | # |
36 | # |
37 | # ANS($L->cmp); |
37 | # ANS($L->cmp); |
38 | # |
38 | # |
39 | # to get the answer checker for $L. |
39 | # to get the answer checker for $L. |
40 | # |
40 | # |
41 | |
41 | |
42 | =cut |
42 | =cut |
43 | |
43 | |
44 | # |
44 | # |
45 | # Define a new context for lines |
45 | # Define a new context for lines |