Diff for /loncom/homework/functionplotresponse.pm between versions 1.61 and 1.64

version 1.61, 2011/04/05 02:29:22 version 1.64, 2011/09/28 23:33:52
Line 74  sub geogebra_default_parameters { Line 74  sub geogebra_default_parameters {
         <param name="image" value="/adm/lonIcons/lonanim.gif"  />          <param name="image" value="/adm/lonIcons/lonanim.gif"  />
         <param name="boxborder" value="false"  />          <param name="boxborder" value="false"  />
         <param name="centerimage" value="true"  />          <param name="centerimage" value="true"  />
  <param name="cache_archive" value="geogebra.jar, geogebra_main.jar, geogebra_gui.jar, geogebra_cas.jar, geogebra_algos.jar, geogebra_export.jar, geogebra_javascript.jar, jlatexmath.jar, jlm_greek.jar, jlm_cyrillic.jar, geogebra_properties.jar" />   <param name="cache_archive" value="geogebra.jar, geogebra_main.jar, geogebra_gui.jar, geogebra_cas.jar, geogebra_export.jar, geogebra_algos.jar, geogebra_javascript.jar, geogebra_properties.jar, jlatexmath.jar, jlm_cyrillic.jar, jlm_greek.jar" />
  <param name="cache_version" value="3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0, 3.9.214.0" />   <param name="cache_version" value="3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0, 3.9.219.0" />
         <param name="framePossible" value="false" />          <param name="framePossible" value="false" />
   
         <param name="showResetIcon" value="false" />          <param name="showResetIcon" value="false" />
Line 751  sub array_index { Line 751  sub array_index {
 #  #
   
 sub populate_arrays {  sub populate_arrays {
     my ($id,$xmin,$xmax)=@_;      my ($id,$xmin,$xmax,$ymin,$ymax)=@_;
     for (my $i=0; $i<=400; $i++) {      for (my $i=0; $i<=400; $i++) {
        $Apache::functionplotresponse::actualxval[$i]=undef;         $Apache::functionplotresponse::actualxval[$i]=undef;
        $Apache::functionplotresponse::func[$i]=undef;         $Apache::functionplotresponse::func[$i]=undef;
Line 779  sub populate_arrays { Line 779  sub populate_arrays {
                 my $xi=&array_index($xmin,$xmax,$xreal);                  my $xi=&array_index($xmin,$xmax,$xreal);
                 if ($xi<$xiold) { return 'no_func'; }                  if ($xi<$xiold) { return 'no_func'; }
                 if (($xi>$xiold) && ($xi>=0) && ($xi<=400)) {                  if (($xi>$xiold) && ($xi>=0) && ($xi<=400)) {
                    if (defined($Apache::functionplotresponse::func[$xi])) { return 'no_func'; }  
                    $xiold=$xi;                     $xiold=$xi;
                    $Apache::functionplotresponse::actualxval[$xi]=$xreal;                     $Apache::functionplotresponse::actualxval[$xi]=$xreal;
 # Function value  # Function value
                    my $funcval=&cubic_hermite($t,@yparms);                     my $funcval=&cubic_hermite($t,@yparms);
   
   # Do we already have a value for this point, and is it different from the new one?
                      if ((defined($Apache::functionplotresponse::func[$xi])) &&
                          (abs($Apache::functionplotresponse::func[$xi]-$funcval)>($ymax-$ymin)/100.)) { 
                          return 'no_func'; 
                      }
   # Okay, remember the new point
                    $Apache::functionplotresponse::func[$xi]=$funcval;                     $Apache::functionplotresponse::func[$xi]=$funcval;
   
                    if (defined($funcval)) {                     if (defined($funcval)) {
                       if ($xi<$Apache::functionplotresponse::functionplotrulelabels{'start'}) {                        if ($xi<$Apache::functionplotresponse::functionplotrulelabels{'start'}) {
                          $Apache::functionplotresponse::functionplotrulelabels{'start'}=$xi;                           $Apache::functionplotresponse::functionplotrulelabels{'start'}=$xi;
Line 880  sub start_functionplotresponse { Line 887  sub start_functionplotresponse {
              &Apache::edit::select_arg('Grid visible:','gridvisible',               &Apache::edit::select_arg('Grid visible:','gridvisible',
                                   ['yes','no'],$token).'<br />'.                                    ['yes','no'],$token).'<br />'.
              &Apache::edit::text_arg('Background plot(s) for answer (function(x):xmin:xmax,function(x):xmin:xmax,x1:y1:sx1:sy1:x2:y2:sx2:sy2,...):',               &Apache::edit::text_arg('Background plot(s) for answer (function(x):xmin:xmax,function(x):xmin:xmax,x1:y1:sx1:sy1:x2:y2:sx2:sy2,...):',
                                          'answerdisplay',$token,'50');                                           'answerdisplay',$token,'50').
   
              &Apache::edit::end_row().&Apache::edit::start_spanning_row();               &Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {    } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,      my $constructtag=&Apache::edit::get_new_args($token,$parstack,
Line 1170  sub end_functionplotruleset { Line 1176  sub end_functionplotruleset {
         $Apache::functionplotresponse::ruleslog='';          $Apache::functionplotresponse::ruleslog='';
         $Apache::functionplotresponse::functionplotrulelabels{'start'}=400;          $Apache::functionplotresponse::functionplotrulelabels{'start'}=400;
         $Apache::functionplotresponse::functionplotrulelabels{'end'}=0;          $Apache::functionplotresponse::functionplotrulelabels{'end'}=0;
         if (&populate_arrays($internalid,$xmin,$xmax) eq 'no_func') {          if (&populate_arrays($internalid,$xmin,$xmax,$ymin,$ymax) eq 'no_func') {
            $ad='NOT_FUNCTION';             $ad='NOT_FUNCTION';
         } else {          } else {
            &addlog("Start of function ".&actualval($Apache::functionplotresponse::functionplotrulelabels{'start'},$xmin,$xmax)." (index ".             &addlog("Start of function ".&actualval($Apache::functionplotresponse::functionplotrulelabels{'start'},$xmin,$xmax)." (index ".

Removed from v.1.61  
changed lines
  Added in v.1.64


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>