version 1.78, 2011/11/20 00:34:52
|
version 1.79, 2011/11/20 02:53:27
|
Line 768 sub start_functionplotvectorrule {
|
Line 768 sub start_functionplotvectorrule {
|
} |
} |
$label=~s/\W//gs; |
$label=~s/\W//gs; |
unless ($label) { |
unless ($label) { |
$label='V'.$Apache::functionplotresponse::counter; |
$label='R'.$Apache::functionplotresponse::counter; |
} else { |
} else { |
$label='V'.$label; |
$label='R'.$label; |
} |
} |
if ($Apache::functionplotresponse::splineorder{$label}) { |
if ($Apache::functionplotresponse::splineorder{$label}) { |
&Apache::lonxml::error(&mt('Rule indices must be unique.')); |
&Apache::lonxml::error(&mt('Rule indices must be unique.')); |
Line 822 sub start_functionplotvectorrule {
|
Line 822 sub start_functionplotvectorrule {
|
$nottippoint, |
$nottippoint, |
&Apache::lonxml::get_param('length',$parstack,$safeeval), |
&Apache::lonxml::get_param('length',$parstack,$safeeval), |
&Apache::lonxml::get_param('angle',$parstack,$safeeval), |
&Apache::lonxml::get_param('angle',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengthpercenterror',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengtherror',$parstack,$safeeval), |
&Apache::lonxml::get_param('anglepercenterror',$parstack,$safeeval), |
&Apache::lonxml::get_param('angleerror',$parstack,$safeeval), |
))); |
))); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result=&Apache::edit::tag_start($target,$token,'Function Plot Vector Rule'). |
$result=&Apache::edit::tag_start($target,$token,'Function Plot Vector Rule'). |
Line 847 sub start_functionplotvectorrule {
|
Line 847 sub start_functionplotvectorrule {
|
$token,'16'). |
$token,'16'). |
&Apache::edit::text_arg('Angle:','angle', |
&Apache::edit::text_arg('Angle:','angle', |
$token,'16'). |
$token,'16'). |
&Apache::edit::text_arg('Percent error length:','lengthpercenterror', |
&Apache::edit::text_arg('Absolute error length:','lengtherror', |
$token,'8'). |
$token,'8'). |
&Apache::edit::text_arg('Percent error angle:','anglepercenterror', |
&Apache::edit::text_arg('Absolute error angle:','angleerror', |
$token,'8'). |
$token,'8'). |
&Apache::edit::end_row(); |
&Apache::edit::end_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
Line 864 sub start_functionplotvectorrule {
|
Line 864 sub start_functionplotvectorrule {
|
$safeeval,'index','vector','attachpoint','notattachpoint', |
$safeeval,'index','vector','attachpoint','notattachpoint', |
'tailpoint','tippoint','nottailpoint','nottipoint', |
'tailpoint','tippoint','nottailpoint','nottipoint', |
'length','angle', |
'length','angle', |
'lengthpercenterror','anglepercenterror'); |
'lengtherror','angleerror'); |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
} |
} |
return $result; |
return $result; |
Line 892 sub start_functionplotvectorsumrule {
|
Line 892 sub start_functionplotvectorsumrule {
|
} |
} |
$label=~s/\W//gs; |
$label=~s/\W//gs; |
unless ($label) { |
unless ($label) { |
$label='V'.$Apache::functionplotresponse::counter; |
$label='R'.$Apache::functionplotresponse::counter; |
} else { |
} else { |
$label='V'.$label; |
$label='R'.$label; |
} |
} |
if ($Apache::functionplotresponse::splineorder{$label}) { |
if ($Apache::functionplotresponse::splineorder{$label}) { |
&Apache::lonxml::error(&mt('Rule indices must be unique.')); |
&Apache::lonxml::error(&mt('Rule indices must be unique.')); |
Line 916 sub start_functionplotvectorsumrule {
|
Line 916 sub start_functionplotvectorsumrule {
|
&Apache::lonxml::get_param('angle',$parstack,$safeeval), |
&Apache::lonxml::get_param('angle',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengthpercenterror',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengthpercenterror',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengthabserror',$parstack,$safeeval), |
&Apache::lonxml::get_param('lengthabserror',$parstack,$safeeval), |
&Apache::lonxml::get_param('anglepercenterror',$parstack,$safeeval), |
&Apache::lonxml::get_param('angleerror',$parstack,$safeeval), |
))); |
))); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result=&Apache::edit::tag_start($target,$token,'Function Plot Vector Sum Rule'). |
$result=&Apache::edit::tag_start($target,$token,'Function Plot Vector Sum Rule'). |
Line 932 sub start_functionplotvectorsumrule {
|
Line 932 sub start_functionplotvectorsumrule {
|
$token,'8'). |
$token,'8'). |
&Apache::edit::text_arg('Absolute error length:','lengthabserror', |
&Apache::edit::text_arg('Absolute error length:','lengthabserror', |
$token,'8'). |
$token,'8'). |
&Apache::edit::text_arg('Percent error angle:','anglepercenterror', |
&Apache::edit::text_arg('Error angle:','angleerror', |
$token,'8'). |
$token,'8'). |
&Apache::edit::end_row(); |
&Apache::edit::end_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
Line 940 sub start_functionplotvectorsumrule {
|
Line 940 sub start_functionplotvectorsumrule {
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
$safeeval,'index','object', |
$safeeval,'index','object', |
'length','angle', |
'length','angle', |
'lengthpercenterror','lengthabserror','anglepercenterror'); |
'lengthpercenterror','lengthabserror','angleerror'); |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
} |
} |
return $result; |
return $result; |
Line 1432 sub vectorcheck {
|
Line 1432 sub vectorcheck {
|
my ($label,$type,$id,$vector, |
my ($label,$type,$id,$vector, |
$attachpoint,$notattachpoint, |
$attachpoint,$notattachpoint, |
$tailpoint,$tippoint,$nottailpoint,$nottippoint, |
$tailpoint,$tippoint,$nottailpoint,$nottippoint, |
$length,$angle,$lengthpercenterror,$anglepercenterror)=split(/\:/,$rule); |
$length,$angle,$lengtherror,$angleerror)=split(/\:/,$rule); |
&addlog("Vector Rule $label for vector ".$vector); |
&addlog("Vector Rule $label for vector ".$vector); |
|
if ($length ne '') { |
|
&addlog("Checking for length $length with error $lengtherror"); |
|
$length=&Apache::run::run($length,$safeeval); |
|
&addlog("Length evaluated to $length"); |
|
my $thislength=&plotvectorlength($id,$vector); |
|
&addlog("Found length $thislength"); |
|
if (abs($thislength-$length)>$lengtherror) { |
|
&setfailed($label); |
|
return 0; |
|
} |
|
} |
|
&addlog("Rule $label passed."); |
|
return 1; |
} |
} |
|
|
sub sumcheck { |
sub sumcheck { |
my ($rule,$xmin,$xmax,$ymin,$ymax,$safeeval)=@_; |
my ($rule,$xmin,$xmax,$ymin,$ymax,$safeeval)=@_; |
my ($label,$type,$id,$object,$length,$angle,$lengthpercenterror,$lengthabserror,$anglepercenterror)=split(/\:/,$rule); |
my ($label,$type,$id,$object,$length,$angle,$lengthpercenterror,$lengthabserror,$angleerror)=split(/\:/,$rule); |
&addlog("Vector Sum Rule $label for vectors attached to ".$object); |
&addlog("Vector Sum Rule $label for vectors attached to ".$object); |
|
|
|
&addlog("Rule $label passed."); |
|
return 1; |
} |
} |
|
|
# |
# |
Line 1542 sub functionplotrulecheck {
|
Line 1557 sub functionplotrulecheck {
|
unless (&compare_rel($relationship,$value,$integral,$tol)) { |
unless (&compare_rel($relationship,$value,$integral,$tol)) { |
&addlog("Actual integral ".(defined($integral)?$integral:'undef').", expected $value, tolerance $tol"); |
&addlog("Actual integral ".(defined($integral)?$integral:'undef').", expected $value, tolerance $tol"); |
&addlog("Rule $label failed."); |
&addlog("Rule $label failed."); |
my $hintlabel=$label; |
&setfailed($label); |
$hintlabel=~s/^R//; |
|
push(@Apache::functionplotresponse::failedrules,$hintlabel); |
|
&addlog("Set hint condition $hintlabel"); |
|
return 0; |
return 0; |
} |
} |
} else { |
} else { |
Line 1611 sub checklength {
|
Line 1623 sub checklength {
|
} |
} |
|
|
sub setfailed { |
sub setfailed { |
my ($label)=@_; |
my ($hintlabel)=@_; |
my $hintlabel=$label; |
|
$hintlabel=~s/^R//; |
$hintlabel=~s/^R//; |
push(@Apache::functionplotresponse::failedrules,$hintlabel); |
push(@Apache::functionplotresponse::failedrules,$hintlabel); |
&addlog("Set hint condition $hintlabel"); |
&addlog("Set hint condition $hintlabel"); |