Thales theorem: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 25: | Line 25: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
JXG.Options.label.autoPosition = true; | |||
JXG.Options.text.fontSize = 24; | |||
var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-5,5,5,-5], showCopyright:false, showNavigation:false}); | |||
var p = board.create('point', [-3, -2], {name:'p'}); | |||
var q1 = board.create('point', [0, -2], {name:'q_1'}); | |||
var q2 = board.create('point', [-1, 0.5], {name:'q_2'}); | |||
var l1 = board.create('line', [p, q1], {straightFirst: false}); | |||
var l2 = board.create('line', [p, q2], {straightFirst: false}); | |||
var l3 = board.create('line', [q1, q2], {color: 'black'}); | |||
var q3 = board.create('point', [2.5, 2], {visible: false}); | |||
var l4 = board.create('parallel', [l3, q3], {color: 'black'}); | |||
var t1 = board.create('intersection', [l4, l1], {name: 't_1'}); | |||
var t2 = board.create('intersection', [l4, l2], {name: 't_2'}); | |||
var txt1 = board.create('text', [-3, -3, function() { return 'TV(p,q_1,t_1) = ' + (t1.Dist(p) / q1.Dist(p)).toFixed(2); }]); | |||
var txt2 = board.create('text', [-3, -4, function() { return 'TV(p,q_2,t_2) = ' + (t2.Dist(p) / q2.Dist(p)).toFixed(2); }]); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Geometry]] | [[Category:Geometry]] |
Revision as of 17:44, 2 May 2021
The underlying JavaScript code
JXG.Options.label.autoPosition = true;
JXG.Options.text.fontSize = 24;
var board = JXG.JSXGraph.initBoard("jxgbox", {boundingbox: [-5,5,5,-5], showCopyright:false, showNavigation:false});
var p = board.create('point', [-3, -2], {name:'p'});
var q1 = board.create('point', [0, -2], {name:'q_1'});
var q2 = board.create('point', [-1, 0.5], {name:'q_2'});
var l1 = board.create('line', [p, q1], {straightFirst: false});
var l2 = board.create('line', [p, q2], {straightFirst: false});
var l3 = board.create('line', [q1, q2], {color: 'black'});
var q3 = board.create('point', [2.5, 2], {visible: false});
var l4 = board.create('parallel', [l3, q3], {color: 'black'});
var t1 = board.create('intersection', [l4, l1], {name: 't_1'});
var t2 = board.create('intersection', [l4, l2], {name: 't_2'});
var txt1 = board.create('text', [-3, -3, function() { return 'TV(p,q_1,t_1) = ' + (t1.Dist(p) / q1.Dist(p)).toFixed(2); }]);
var txt2 = board.create('text', [-3, -4, function() { return 'TV(p,q_2,t_2) = ' + (t2.Dist(p) / q2.Dist(p)).toFixed(2); }]);