Euler line (dup): Difference between revisions
From JSXGraph Wiki
m lines with straight*=false changed to segments  | 
				No edit summary  | 
				||
| Line 3: | Line 3: | ||
brd.suspendUpdate();  | brd.suspendUpdate();  | ||
A = brd.  | A = brd.create('point',[1,0]);  | ||
B = brd.  | B = brd.create('point',[-1,0]);  | ||
C = brd.  | C = brd.create('point',[0.2,1.5]);  | ||
pol = brd.  | pol = brd.create('polygon',[A,B,C]);  | ||
pABC = brd.  | pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});  | ||
pBCA = brd.  | pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});  | ||
pCAB = brd.  | pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});  | ||
i1 = brd.  | i1 = brd.create('intersection',[pABC,pCAB,0]);  | ||
pABC  | pABC.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
pBCA  | pBCA.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
pCAB  | pCAB.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
mAB = brd.  | mAB = brd.create('midpoint',[A,B]);  | ||
mBC = brd.  | mBC = brd.create('midpoint',[B,C]);  | ||
mCA = brd.  | mCA = brd.create('midpoint',[C,A]);  | ||
ma = brd.  | ma = brd.create('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
mb = brd.  | mb = brd.create('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
mc = brd.  | mc = brd.create('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
i2 = brd.  | i2 = brd.create('intersection',[ma,mc,0]);  | ||
i3 = brd.  | i3 = brd.create('circumcirclemidpoint',[A,B,C]);  | ||
c = brd.  | c = brd.create('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});  | ||
euler = brd.  | euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'red'});  | ||
brd.unsuspendUpdate();  | brd.unsuspendUpdate();  | ||
| Line 35: | Line 34: | ||
===The JavaScript code===  | ===The JavaScript code===  | ||
<source lang="  | <source lang="javascript">  | ||
brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true});  | brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true});  | ||
brd.suspendUpdate();  | brd.suspendUpdate();  | ||
A = brd.  | A = brd.create('point',[1,0]);  | ||
B = brd.  | B = brd.create('point',[-1,0]);  | ||
C = brd.  | C = brd.create('point',[0.2,1.5]);  | ||
pol = brd.  | pol = brd.create('polygon',[A,B,C]);  | ||
pABC = brd.  | pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});  | ||
pBCA = brd.  | pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});  | ||
pCAB = brd.  | pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});  | ||
i1 = brd.  | i1 = brd.create('intersection',[pABC,pCAB,0]);  | ||
pABC  | pABC.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
pBCA  | pBCA.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
pCAB  | pCAB.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});  | ||
mAB = brd.  | mAB = brd.create('midpoint',[A,B]);  | ||
mBC = brd.  | mBC = brd.create('midpoint',[B,C]);  | ||
mCA = brd.  | mCA = brd.create('midpoint',[C,A]);  | ||
ma = brd.  | ma = brd.create('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
mb = brd.  | mb = brd.create('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
mc = brd.  | mc = brd.create('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});  | ||
i2 = brd.  | i2 = brd.create('intersection',[ma,mc,0]);  | ||
i3 = brd.  | i3 = brd.create('circumcirclemidpoint',[A,B,C]);  | ||
c = brd.  | c = brd.create('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});  | ||
euler = brd.  | euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'red'});  | ||
brd.unsuspendUpdate();  | brd.unsuspendUpdate();  | ||
</source>  | </source>  | ||
[[Category:Examples]]  | [[Category:Examples]]  | ||
[[Category:Geometry]]  | [[Category:Geometry]]  | ||
Revision as of 14:04, 7 June 2011
The JavaScript code
brd = JXG.JSXGraph.initBoard('box', {boundingbox: [-2, 2, 2, -2], keepaspectratio:true});
brd.suspendUpdate();
A = brd.create('point',[1,0]);
B = brd.create('point',[-1,0]);
C = brd.create('point',[0.2,1.5]);
pol = brd.create('polygon',[A,B,C]);
pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
i1 = brd.create('intersection',[pABC,pCAB,0]);
pABC.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
mAB = brd.create('midpoint',[A,B]);
mBC = brd.create('midpoint',[B,C]);
mCA = brd.create('midpoint',[C,A]);
ma = brd.create('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.create('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.create('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});
i2 = brd.create('intersection',[ma,mc,0]);
i3 = brd.create('circumcirclemidpoint',[A,B,C]);
c = brd.create('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});
euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'red'});
brd.unsuspendUpdate();