[system] / trunk / pg / lib / Value / Point.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value/Point.pm

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

Revision 2558 Revision 2579
45 unless defined($p) && scalar(@{$p}) > 0; 45 unless defined($p) && scalar(@{$p}) > 0;
46 foreach my $x (@{$p}) { 46 foreach my $x (@{$p}) {
47 $isFormula = 1 if Value::isFormula($x); 47 $isFormula = 1 if Value::isFormula($x);
48 Value::Error("Coordinate of Point can't be ".Value::showClass($x)) 48 Value::Error("Coordinate of Point can't be ".Value::showClass($x))
49 unless Value::isNumber($x); 49 unless Value::isNumber($x);
50 $x = Value::Real->make($x) if $$Value::context->flag('useFuzzyReals');
50 } 51 }
51 } 52 }
52 return $self->formula($p) if $isFormula; 53 return $self->formula($p) if $isFormula;
53 bless {data => $p}, $class; 54 bless {data => $p}, $class;
54} 55}
175# Generate the various output formats 176# Generate the various output formats
176# 177#
177 178
178sub stringify { 179sub stringify {
179 my $self = shift; 180 my $self = shift;
180 $Value::parens{Point}{open}.join(',',@{$self->data}).$Value::parens{Point}{close}; 181 my $point = $$Value::context->lists->get('Point');
182 $point->{open} . join(',',@{$self->data}) . $point->{close};
181} 183}
182 184
183sub string { 185sub string {
184 my $self = shift; my $equation = shift; 186 my $self = shift; my $equation = shift;
185 my $open = shift || $Value::parens{Point}{open}; 187 my $open = shift || $$Value::context->lists->get('Point')->{open};
186 my $close = shift || $Value::parens{Point}{close}; 188 my $close = shift || $$Value::context->lists->get('Point')->{close};
189 my @coords = ();
190 foreach my $x (@{$self->data}) {
191 if (Value::isValue($x)) {push(@coords,$x->string($equation))} else {push(@coords,$x)}
192 }
187 return $open.join(',',@{$self->data}).$close; 193 return $open.join(',',@coords).$close;
194}
195
196sub string {
197 my $self = shift; my $equation = shift;
198 my $open = shift || $$Value::context->lists->get('Point')->{open};
199 my $close = shift || $$Value::context->lists->get('Point')->{close};
200 my @coords = ();
201 foreach my $x (@{$self->data}) {
202 if (Value::isValue($x)) {push(@coords,$x->TeX($equation))} else {push(@coords,$x)}
203 }
204 return '\left'.$open.join(',',@coords).'\right'.$close;
188} 205}
189 206
190########################################################################### 207###########################################################################
191 208
1921; 2091;

Legend:
Removed from v.2558  
changed lines
  Added in v.2579

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9