Difference between revisions of "Barycenter"

From JSXGraph Wiki
Jump to navigationJump to search
 
(15 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-2,7,7,-2], axis: true, showCopyright:false, showNavigation:false});
 
var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-2,7,7,-2], axis: true, showCopyright:false, showNavigation:false});
  
 +
var p0  = board.create('point', [0, 0], {name:"p_0"});
 
var p0s = board.create('point', [2, 1], {name:"p_0'"});
 
var p0s = board.create('point', [2, 1], {name:"p_0'"});
 
var p1s = board.create('point', [4, 4], {name:"p_1'"});
 
var p1s = board.create('point', [4, 4], {name:"p_1'"});
 
var p2s = board.create('point', [1, 2], {name:"p_2'"});
 
var p2s = board.create('point', [1, 2], {name:"p_2'"});
  
var l1 = board.create('line', [p0s, p1s], {straightLast: true, color: 'orange'});
+
var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
var l1 = board.create('line', [p0s, p2s], {straightLast: true, color: 'orange'});
+
var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});
 +
var v1 = board.create('arrow', [p0s, p1s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
var v2 = board.create('arrow', [p0s, p2s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
 
 +
var v3 = board.create('arrow', [p0, p0s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
 
 +
var q = board.create('point', [3, 5], {name:"q"});
 +
 
 +
var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
 +
var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});
  
 
</jsxgraph>
 
</jsxgraph>
Line 18: Line 28:
  
 
<source lang="javascript">
 
<source lang="javascript">
 +
JXG.Options.label.autoPosition = true;
 +
JXG.Options.text.fontSize = 20;
 +
 +
var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-2,7,7,-2], axis: true, showCopyright:false, showNavigation:false});
 +
 +
var p0  = board.create('point', [0, 0], {name:"p_0"});
 +
var p0s = board.create('point', [2, 1], {name:"p_0'"});
 +
var p1s = board.create('point', [4, 4], {name:"p_1'"});
 +
var p2s = board.create('point', [1, 2], {name:"p_2'"});
 +
 +
var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
 +
var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});
 +
var v1 = board.create('arrow', [p0s, p1s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
var v2 = board.create('arrow', [p0s, p2s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
 +
var v3 = board.create('arrow', [p0, p0s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
 +
 +
var q = board.create('point', [3, 5], {name:"q"});
 +
 +
var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
 +
var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});
 
</source>
 
</source>
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Geometry]]
 
[[Category:Geometry]]

Latest revision as of 20:58, 9 May 2021


The underlying JavaScript code

JXG.Options.label.autoPosition = true;
JXG.Options.text.fontSize = 20;

var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-2,7,7,-2], axis: true, showCopyright:false, showNavigation:false});

var p0  = board.create('point', [0, 0], {name:"p_0"});
var p0s = board.create('point', [2, 1], {name:"p_0'"});
var p1s = board.create('point', [4, 4], {name:"p_1'"});
var p2s = board.create('point', [1, 2], {name:"p_2'"});

var l1 = board.create('line', [p0s, p1s], {lastArrow: true, color: 'orange'});
var l2 = board.create('line', [p0s, p2s], {lastArrow: true, color: 'orange'});
var v1 = board.create('arrow', [p0s, p1s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});
var v2 = board.create('arrow', [p0s, p2s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});

var v3 = board.create('arrow', [p0, p0s], {color: 'black', strokeWidth: 1, layer: 8, lastArrow:{size: 10}});

var q = board.create('point', [3, 5], {name:"q"});

var par1 = board.create('parallel', [l1, q], {strokeWidth: 1, dash: 1});
var par2 = board.create('parallel', [l2, q], {strokeWidth: 1, dash: 1});