Difference between revisions of "Mutually dependent line and gliders"

From JSXGraph Wiki
Jump to navigationJump to search
Line 12: Line 12:
 
var gl1 = board.create('glider', [0,0, el0], {name:'b'});
 
var gl1 = board.create('glider', [0,0, el0], {name:'b'});
 
var gl2 = board.create('glider', [1,0, el1], {name:'a'});
 
var gl2 = board.create('glider', [1,0, el1], {name:'a'});
var line = board.create('line', [0,0,1]);
+
var line = board.create('line', [gl1, gl2]);
 
+
line.draggable = function() { return true; };
  
 
var offset = gl2.Y() - gl1.Y();
 
var offset = gl2.Y() - gl1.Y();
Line 22: Line 22:
 
gl2.on('drag', function() {
 
gl2.on('drag', function() {
 
     offset = gl2.Y() - gl1.Y();
 
     offset = gl2.Y() - gl1.Y();
    var v = JXG.Math.crossProduct(gl1.coords.usrCoords,gl2.coords.usrCoords);
 
    line.stdform.splice(0,3,v);
 
   
 
 
     });
 
     });
  
  
 
</jsxgraph>
 
</jsxgraph>

Revision as of 10:08, 1 June 2012