[system] / trunk / pg / macros / parserParametricLine.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/parserParametricLine.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4385 Revision 4997
1loadMacros('Parser.pl'); 1loadMacros('Parser.pl');
2 2
3sub _parserParametricLine_init {}; # don't reload this file 3sub _parserParametricLine_init {}; # don't reload this file
4
5=head1 DESCRIPTION
4 6
5###################################################################### 7######################################################################
6# 8#
7# This is a Parser class that implements parametric lines as 9# This is a Parser class that implements parametric lines as
8# a subclass of the Formula class. The standard ->cmp routine 10# a subclass of the Formula class. The standard ->cmp routine
34# 36#
35# ANS($L->cmp); 37# ANS($L->cmp);
36# 38#
37# to get the answer checker for $L. 39# to get the answer checker for $L.
38# 40#
41
42=cut
39 43
40# 44#
41# Define a new context for lines 45# Define a new context for lines
42# 46#
43$context{ParametricLine} = Context("Vector")->copy(); 47$context{ParametricLine} = Context("Vector")->copy();
88 $line->{p} = $p; $line->{v} = $v; 92 $line->{p} = $p; $line->{v} = $v;
89 $line->{isValue} = $line->{isFormula} = 1; 93 $line->{isValue} = $line->{isFormula} = 1;
90 return bless $line, $class; 94 return bless $line, $class;
91} 95}
92 96
97=head3 compare($lhs,$rhs)
98
93# 99#
94# Two parametric lines are equal if they have 100# Two parametric lines are equal if they have
95# parallel direction vectors and either the same 101# parallel direction vectors and either the same
96# points or the vector between the points is 102# points or the vector between the points is
97# parallel to the (common) direction vector. 103# parallel to the (common) direction vector.
98# 104#
105
106=cut
107
99sub compare { 108sub compare {
100 my ($l,$r,$flag) = @_; 109 my ($l,$r,$flag) = @_;
101 if ($l->promotePrecedence($r)) {return $r->compare($l,!$flag)} 110 if ($l->promotePrecedence($r)) {return $r->compare($l,!$flag)}
102 $r = ParametricLine->new($r); 111 $r = ParametricLine->new($r);
103 if ($flag) {my $tmp = $l; $l = $r; $r = $tmp} 112 if ($flag) {my $tmp = $l; $l = $r; $r = $tmp}

Legend:
Removed from v.4385  
changed lines
  Added in v.4997

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9