Three touching circles

From JSXGraph Wiki
Jump to: navigation, search

The underlying JavaScript code

var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-2,5,5,-2]});
var A  = brd.create('point', [0,0]),
    B  = brd.create('point', [2,0]),
    C  = brd.create('point', [1,2]),

    a1 = brd.create('segment', [A,B], {name:'a_1', withLabel:true, label:{position:'top'} }),
    a2 = brd.create('segment', [B,C], {name:'a_2', withLabel:true, label:{position:'top'} }),
    a3 = brd.create('segment', [C,A], {name:'a_3', withLabel:true, label:{position:'top'} }),
    c1 = brd.create('circle', 
            [A, 
             function(){ var r1 = (C.Dist(A)-B.Dist(C)+A.Dist(B))/2.0;
                        return r1; }
            ]);
    c2 = brd.create('circle', 
            [B, 
             function(){ return A.Dist(B)-c1.Radius(); }
            ]);
    c3 = brd.create('circle', 
            [C, 
             function(){ return B.Dist(C)-c2.Radius(); }
            ]);