Euler line (dup): Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) (New page: <jsxgraph width="500" height="500" box="box"> brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true}); brd.suspendUpdate(); A = brd.createElement('point',...) |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 32: | Line 32: | ||
</jsxgraph> | </jsxgraph> | ||
===The JavaScript code=== | |||
<source lang="xml"> | <source lang="xml"> | ||
<jsxgraph width="500" height="500" box="box"> | |||
brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true}); | |||
brd.suspendUpdate(); | |||
A = brd.createElement('point',[1,0]); | |||
B = brd.createElement('point',[-1,0]); | |||
C = brd.createElement('point',[0.2,1.5]); | |||
pol = brd.createElement('polygon',[A,B,C]); | |||
pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2}); | |||
pBCA = brd.createElement('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2}); | |||
pCAB = brd.createElement('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2}); | |||
i1 = brd.createElement('intersection',[pABC[0],pCAB[0],0]); | |||
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]); | |||
mBC = brd.createElement('midpoint',[B,C]); | |||
mCA = brd.createElement('midpoint',[C,A]); | |||
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]); | |||
i3 = brd.createElement('circumcirclemidpoint',[A,B,C]); | |||
c = brd.createElement('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1}); | |||
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1}); | |||
euler = brd.createElement('line',[i1,i3],{strokeWidth:2,strokeColor:'red'}); | |||
brd.unsuspendUpdate(); | |||
</jsxgraph> | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Geometry]] | [[Category:Geometry]] |
Revision as of 13:25, 8 July 2009
The JavaScript code
<jsxgraph width="500" height="500" box="box">
brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true});
brd.suspendUpdate();
A = brd.createElement('point',[1,0]);
B = brd.createElement('point',[-1,0]);
C = brd.createElement('point',[0.2,1.5]);
pol = brd.createElement('polygon',[A,B,C]);
pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pBCA = brd.createElement('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pCAB = brd.createElement('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
i1 = brd.createElement('intersection',[pABC[0],pCAB[0],0]);
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]);
mBC = brd.createElement('midpoint',[B,C]);
mCA = brd.createElement('midpoint',[C,A]);
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]);
i3 = brd.createElement('circumcirclemidpoint',[A,B,C]);
c = brd.createElement('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});
euler = brd.createElement('line',[i1,i3],{strokeWidth:2,strokeColor:'red'});
brd.unsuspendUpdate();
</jsxgraph>