Menelaus's theorem: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
TV(a,b,c) is the affine ratio |ac| / |ab|.
<jsxgraph width="500" height="500">
<jsxgraph width="500" height="500">
JXG.Options.label.autoPosition = true;
JXG.Options.label.autoPosition = true;
JXG.Options.text.fontSize = 24;
JXG.Options.text.fontSize = 24;


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


var a = board.create('point', [-1.7, 0], {name:'a'});
var a = board.create('point', [-1.7, 0], {name:'a'});
Line 13: Line 15:
var s3 = board.create('line', [a, b], {color: 'black'});
var s3 = board.create('line', [a, b], {color: 'black'});


var as = board.create('glider', [2, 2, s2], {name: "a'"})  
var as = board.create('glider', [2, 1.8, s2], {name: "a'"})  
var bs = board.create('glider', [-1, 1.5, s1], {name: "b'"})  
var bs = board.create('glider', [-1, 1.5, s1], {name: "b'"})  
var s4 = board.create('line', [as, bs], {color: 'black'});


var cs = board.create('glider', [-3, 3.3, s3], {name: "c'"});
var TV = function(p,q,t) {
        var v = p.Dist(t) / p.Dist(q);
        if (JXG.Math.Geometry.isSameDir(p.coords, q.coords, p.coords, t.coords)) {
            return v;
        } else {
            return -v;
        }
    };
var txt = board.create('text', [-4.5, -4, function() {
        return "TV(a',c,b) * TV(b',a,c) * TV(c',b,a) = " + (TV(as,c,b)*TV(bs,a,c)*TV(cs,b,a)).toFixed(2); }]);
</jsxgraph>
</jsxgraph>


Line 21: Line 37:


<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], axis:false, showCopyright:false, showNavigation:false});
var a = board.create('point', [-1.7, 0], {name:'a'});
var b = board.create('point', [4, -3], {name:'b'});
var c = board.create('point', [1, 4], {name:'c'});
var s1 = board.create('segment', [c, a], {color: 'black'});
var s2 = board.create('segment', [c, b], {color: 'black'});
var s3 = board.create('line', [a, b], {color: 'black'});
var as = board.create('glider', [2, 1.8, s2], {name: "a'"})
var bs = board.create('glider', [-1, 1.5, s1], {name: "b'"})
var s4 = board.create('line', [as, bs], {color: 'black'});
var cs = board.create('glider', [-3, 3.3, s3], {name: "c'"});
var TV = function(p,q,t) {
        var v = p.Dist(t) / p.Dist(q);
        if (JXG.Math.Geometry.isSameDir(p.coords, q.coords, p.coords, t.coords)) {
            return v;
        } else {
            return -v;
        }
    };
var txt = board.create('text', [-4.5, -4, function() {
        return "TV(a',c,b) * TV(b',a,c) * TV(c',b,a) = " + (TV(as,c,b)*TV(bs,a,c)*TV(cs,b,a)).toFixed(2); }]);
</source>
</source>


[[Category:Examples]]
[[Category:Examples]]
[[Category:Geometry]]
[[Category:Geometry]]

Latest revision as of 07:13, 3 May 2021

TV(a,b,c) is the affine ratio |ac| / |ab|.

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], axis:false, showCopyright:false, showNavigation:false});

var a = board.create('point', [-1.7, 0], {name:'a'});
var b = board.create('point', [4, -3], {name:'b'});
var c = board.create('point', [1, 4], {name:'c'});

var s1 = board.create('segment', [c, a], {color: 'black'});
var s2 = board.create('segment', [c, b], {color: 'black'});
var s3 = board.create('line', [a, b], {color: 'black'});

var as = board.create('glider', [2, 1.8, s2], {name: "a'"}) 
var bs = board.create('glider', [-1, 1.5, s1], {name: "b'"}) 
var s4 = board.create('line', [as, bs], {color: 'black'});

var cs = board.create('glider', [-3, 3.3, s3], {name: "c'"});

var TV = function(p,q,t) {
        var v = p.Dist(t) / p.Dist(q);
        if (JXG.Math.Geometry.isSameDir(p.coords, q.coords, p.coords, t.coords)) {
            return v;
        } else {
            return -v;
        }
    };

var txt = board.create('text', [-4.5, -4, function() {
        return "TV(a',c,b) * TV(b',a,c) * TV(c',b,a) = " + (TV(as,c,b)*TV(bs,a,c)*TV(cs,b,a)).toFixed(2); }]);