version 1.79, 2011/11/20 02:53:27
|
version 1.80, 2011/11/21 02:34:58
|
Line 914 sub start_functionplotvectorsumrule {
|
Line 914 sub start_functionplotvectorsumrule {
|
$object, |
$object, |
&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('lengthabserror',$parstack,$safeeval), |
|
&Apache::lonxml::get_param('angleerror',$parstack,$safeeval), |
&Apache::lonxml::get_param('angleerror',$parstack,$safeeval), |
))); |
))); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
Line 928 sub start_functionplotvectorsumrule {
|
Line 927 sub start_functionplotvectorsumrule {
|
$token,'16'). |
$token,'16'). |
&Apache::edit::text_arg('Sum vector angle:','angle', |
&Apache::edit::text_arg('Sum vector angle:','angle', |
$token,'16'). |
$token,'16'). |
&Apache::edit::text_arg('Percent error length:','lengthpercenterror', |
&Apache::edit::text_arg('Error length:','lengtherror', |
$token,'8'). |
|
&Apache::edit::text_arg('Absolute error length:','lengthabserror', |
|
$token,'8'). |
$token,'8'). |
&Apache::edit::text_arg('Error angle:','angleerror', |
&Apache::edit::text_arg('Error angle:','angleerror', |
$token,'8'). |
$token,'8'). |
Line 940 sub start_functionplotvectorsumrule {
|
Line 937 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','angleerror'); |
,'lengtherror','angleerror'); |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
} |
} |
return $result; |
return $result; |
Line 1445 sub vectorcheck {
|
Line 1442 sub vectorcheck {
|
return 0; |
return 0; |
} |
} |
} |
} |
|
if ($angle ne '') { |
|
&addlog("Checking for angle $angle with error $angleerror"); |
|
$angle=&Apache::run::run($angle,$safeeval); |
|
&addlog("Angle evaluated to $angle"); |
|
my $thisangle=&plotvectorangle($id,$vector); |
|
&addlog("Found angle $thisangle"); |
|
my $anglediff=abs($thisangle-$angle); |
|
&addlog("Angle difference: $anglediff"); |
|
if ($anglediff>360.-$anglediff) { |
|
$anglediff=360.-$anglediff; |
|
} |
|
&addlog("Smallest angle difference: $anglediff"); |
|
if ($anglediff>$angleerror) { |
|
&setfailed($label); |
|
return 0; |
|
} |
|
} |
&addlog("Rule $label passed."); |
&addlog("Rule $label passed."); |
return 1; |
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,$angleerror)=split(/\:/,$rule); |
my ($label,$type,$id,$object,$length,$angle,$lengtherror,$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."); |
&addlog("Rule $label passed."); |