Dual lattice: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
<jsxgraph height="500" width="500" board="board"  box="box1">
<jsxgraph height="500" width="500" board="board"  box="box1">
brd = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], axis:true});
brd = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], axis:false});
var b1 = brd.create('point', [4,0], {size:6, name:'', color:'blue', snaptogrid: true}),
var b1 = brd.create('point', [4,0], {size:6, name:'1', color:'blue', snaptogrid: true}),
     b2 = brd.create('point', [3,3], {size:6, name:'', color:'blue', snaptogrid: true}),
     b2 = brd.create('point', [3,3], {size:6, name:'2', color:'blue', snaptogrid: true}),
     v1 = brd.create('arrow', [[0,0], b1], {strokeColor: 'black'}),   
     v1 = brd.create('arrow', [[0,0], b1], {strokeColor: 'black'}),   
     v2 = brd.create('arrow', [[0,0], b2], {strokeColor: 'red'}),
     v2 = brd.create('arrow', [[0,0], b2], {strokeColor: 'red'}),
     w1, w2;
     w1, w2, i, j;
 
 
for (i=-5;i<6;i++) for (j=-5;j<6;j++) {
  if (!(i==1&&j==0) && !(i==0&&j==1)) {
    brd.create('point',[
      function(x,y){ return function(){ return x*b1.X()+y*b2.X(); };}(i,j),
      function(x,y){ return function(){ return x*b1.Y()+y*b2.Y(); };}(i,j)
      ], {name:'', size:2});
}}


w1 = brd.create('arrow', [[0,0], function() {
w1 = brd.create('arrow', [[0,0], function() {
     var num = b1.X() * b2.Y() - b2.X() * b1.Y();
     var num = b1.X() * b2.Y() - b2.X() * b1.Y();
     return [b2.Y() / num,  -b2.X() / num];
     return [b2.Y() / num,  -b2.X() / num];
}], {strokeColor: 'red'});
}], {strokeColor: 'black', name:"1'", withLabel:true, label:{position:'rt'}});


w2 = brd.create('arrow', [[0,0], function() {
w2 = brd.create('arrow', [[0,0], function() {
     var num = b1.X() * b2.Y() - b2.X() * b1.Y();
     var num = b1.X() * b2.Y() - b2.X() * b1.Y();
     return [-b1.Y() / num,  b1.X() / num];
     return [-b1.Y() / num,  b1.X() / num];
}], {strokeColor: 'black'});
}], {strokeColor: 'red', name:"2'", withLabel:true, label:{position:'rt'}});





Latest revision as of 11:10, 20 June 2016