Diff for /loncom/homework/functionplotresponse.pm between versions 1.6 and 1.8

version 1.6, 2010/10/05 00:10:07 version 1.8, 2010/10/08 23:26:04
Line 214  ENDPLOTSCRIPT Line 214  ENDPLOTSCRIPT
 }  }
   
 #  #
 # Subroutine that generates spline $label based on stored information  # Subroutine that generates code for spline $label based on stored information
 #  #
   
 sub generate_spline {  sub generate_spline {
    my ($id,$label)=@_;     my ($id,$label)=@_;
    my $result='';     my $result='';
      my $order=$Apache::functionplotresponse::splineorder{$label};
      my $x=$Apache::functionplotresponse::splineinitx{$label};
      my $y=$Apache::functionplotresponse::splineinity{$label};
      my $sx=$Apache::functionplotresponse::splinescalex{$label};
      my $sy=$Apache::functionplotresponse::splinescaley{$label};
      my @coords=();
      foreach my $i (1..$order) {
          $result.=&new_coordinate($id,$label.'P'.$i,$x,$y);
          $x+=$sx/(2.*($order-1));
          push(@coords,$label.'P'.$i);
          $result.=&new_coordinate($id,$label.'S'.$i,$x,$y+$sy);
          $x+=$sx/(2.*($order-1));
          push(@coords,$label.'S'.$i);
      }
      $result.='document.ggbApplet_'.$id.'.evalCommand("Spline'.$order.'['.join(',',@coords).']");'."\n";
    return $result;     return $result;
 }  }
 #  #
Line 255  sub start_spline { Line 270  sub start_spline {
    unless ($label) { $label='S'.$Apache::functionplotresponse::counter; }     unless ($label) { $label='S'.$Apache::functionplotresponse::counter; }
   
    my $order=&Apache::lonxml::get_param('order',$parstack,$safeeval);     my $order=&Apache::lonxml::get_param('order',$parstack,$safeeval);
    if (($order<2) || ($order>4)) { $order=2; }     if ($order<2) { $order=2; }
      if ($order>8) { $order=8; }
    $Apache::functionplotresponse::splineorder{$label}=$order;     $Apache::functionplotresponse::splineorder{$label}=$order;
   
    my $x=&Apache::lonxml::get_param('initx',$parstack,$safeeval);     my $x=&Apache::lonxml::get_param('initx',$parstack,$safeeval);
Line 273  sub start_spline { Line 289  sub start_spline {
    my $sy=&Apache::lonxml::get_param('scaley',$parstack,$safeeval);     my $sy=&Apache::lonxml::get_param('scaley',$parstack,$safeeval);
    unless ($sy) { $sy=2; }     unless ($sy) { $sy=2; }
    $Apache::functionplotresponse::splinescaley{$label}=$sy;     $Apache::functionplotresponse::splinescaley{$label}=$sy;
      return '';
 }  }
   
 sub end_spline {  sub end_spline {

Removed from v.1.6  
changed lines
  Added in v.1.8


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