[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm

www www@source.lon-capa.org
Fri, 08 Oct 2010 23:26:05 -0000


www		Fri Oct  8 23:26:05 2010 EDT

  Modified files:              
    /loncom/homework	functionplotresponse.pm 
  Log:
  Correct scaling and maximum spline order
  
  
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.7 loncom/homework/functionplotresponse.pm:1.8
--- loncom/homework/functionplotresponse.pm:1.7	Tue Oct  5 01:28:00 2010
+++ loncom/homework/functionplotresponse.pm	Fri Oct  8 23:26:04 2010
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: functionplotresponse.pm,v 1.7 2010/10/05 01:28:00 www Exp $
+# $Id: functionplotresponse.pm,v 1.8 2010/10/08 23:26:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -228,10 +228,10 @@
    my @coords=();
    foreach my $i (1..$order) {
        $result.=&new_coordinate($id,$label.'P'.$i,$x,$y);
-       $x+=$sx/$order;
+       $x+=$sx/(2.*($order-1));
        push(@coords,$label.'P'.$i);
        $result.=&new_coordinate($id,$label.'S'.$i,$x,$y+$sy);
-       $x+=$sx/$order;
+       $x+=$sx/(2.*($order-1));
        push(@coords,$label.'S'.$i);
    }
    $result.='document.ggbApplet_'.$id.'.evalCommand("Spline'.$order.'['.join(',',@coords).']");'."\n";
@@ -270,7 +270,8 @@
    unless ($label) { $label='S'.$Apache::functionplotresponse::counter; }
 
    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;
 
    my $x=&Apache::lonxml::get_param('initx',$parstack,$safeeval);