Euler line

From JSXGraph Wiki
Revision as of 12:51, 26 August 2009 by Bianca (talk | contribs)

Jump to: navigation, search

The JavaScript code

<jsxgraph width="500" height="400" box="box">
brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -1.5], keepaspectratio:true});

brd.suspendUpdate();
A = brd.createElement('point',[1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
B = brd.createElement('point',[-1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
C = brd.createElement('point',[0.2,1.5],{strokeColor:'#901B77',fillColor:'#CA147A'});
pol = brd.createElement('polygon',[A,B,C], {fillColor:'#FFFF0050'});
for(i=0;i<=2;i++) {
    pol.borders[i].setProperty('strokeColor:#009256');
}

pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2, name:['','H_c']});
pBCA = brd.createElement('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2, name:['','H_a']});
pCAB = brd.createElement('perpendicular',[pol.borders[2],B],{strokeWidth:1,dash:2, name:['','H_b']});
pABC[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
pBCA[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
pCAB[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
i1 = brd.createElement('intersection',[pABC[0],pCAB[0],0],{strokeColor:'#009256',fillColor:'#65B72E',name:'H'});
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});

mAB = brd.createElement('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
mBC = brd.createElement('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
mCA = brd.createElement('midpoint',[C,A],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_b'});
ma = brd.createElement('line',[mBC,A],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.createElement('line',[mCA,B],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.createElement('line',[mAB,C],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
i2 = brd.createElement('intersection',[ma,mc,0],{strokeColor:'#009256',fillColor:'#65B72E',name:'S'});

i3 = brd.createElement('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
c = brd.createElement('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});
c[0].setProperty('visible:false');
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});

euler = brd.createElement('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
brd.unsuspendUpdate();

</jsxgraph>