--- loncom/homework/functionplotresponse.pm 2011/10/19 13:21:51 1.68
+++ loncom/homework/functionplotresponse.pm 2011/11/18 17:44:07 1.71
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
-# option list style responses
+# Functionplot responses
#
-# $Id: functionplotresponse.pm,v 1.68 2011/10/19 13:21:51 www Exp $
+# $Id: functionplotresponse.pm,v 1.71 2011/11/18 17:44:07 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,6 +35,7 @@ use Apache::run;
BEGIN {
&Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline',
+ 'plotobject','plotvector',
'functionplotrule','functionplotruleset',
'functionplotelements'));
}
@@ -76,7 +77,7 @@ sub geogebra_default_parameters {
-
+
@@ -379,6 +380,59 @@ sub plot_script {
}
#
+# Subroutine to produce objects
+#
+
+sub plotobject_script {
+ my ($id,$label,$x,$y)=@_;
+ unless ($label) {
+ $Apache::functionplotresponse::counter++;
+ $label='O'.$Apache::functionplotresponse::counter;
+ }
+ return "document.ggbApplet_$id.evalCommand('a=1');\n".
+ "document.ggbApplet_$id.setVisible('a', false);\n".
+ "document.ggbApplet_$id.setLabelVisible('a', false);\n".
+ "document.ggbApplet_$id.evalCommand('$label=a*($x,$y)');\n".
+ "document.ggbApplet_$id.setVisible('$label', true);\n".
+ "document.ggbApplet_$id.setLabelVisible('$label', true);\n";
+}
+
+#
+# Subroutine to produce vectors
+#
+
+sub plotvector_script {
+ my ($id,$label,$xs,$ys,$xe,$ye)=@_;
+ unless ($label) {
+ $Apache::functionplotresponse::counter++;
+ $label='V'.$Apache::functionplotresponse::counter;
+ }
+ my $startlabel=$label.'Start';
+ my $endlabel=$label.'End';
+ my $pointlabel=$label.'Point';
+ my $anglelabel=$label.'Angle';
+ return(<
#