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.createElement('point',[1,0]);
A = brd.create('point',[1,0]);
B = brd.createElement('point',[-1,0]);
B = brd.create('point',[-1,0]);
C = brd.createElement('point',[0.2,1.5]);
C = brd.create('point',[0.2,1.5]);
pol = brd.createElement('polygon',[A,B,C]);
pol = brd.create('polygon',[A,B,C]);


pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pBCA = brd.createElement('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pCAB = brd.createElement('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
i1 = brd.createElement('intersection',[pABC[0],pCAB[0],0]);
i1 = brd.create('intersection',[pABC,pCAB,0]);
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pABC.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});


mAB = brd.createElement('midpoint',[A,B]);
mAB = brd.create('midpoint',[A,B]);
mBC = brd.createElement('midpoint',[B,C]);
mBC = brd.create('midpoint',[B,C]);
mCA = brd.createElement('midpoint',[C,A]);
mCA = brd.create('midpoint',[C,A]);
ma = brd.createElement('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});
ma = brd.create('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.createElement('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.create('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.createElement('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.create('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});
i2 = brd.createElement('intersection',[ma,mc,0]);
i2 = brd.create('intersection',[ma,mc,0]);


i3 = brd.createElement('circumcirclemidpoint',[A,B,C]);
i3 = brd.create('circumcirclemidpoint',[A,B,C]);
c = brd.createElement('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});
c = brd.create('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'});
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="xml">
<source lang="javascript">
<jsxgraph width="500" height="500" box="box">
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.createElement('point',[1,0]);
A = brd.create('point',[1,0]);
B = brd.createElement('point',[-1,0]);
B = brd.create('point',[-1,0]);
C = brd.createElement('point',[0.2,1.5]);
C = brd.create('point',[0.2,1.5]);
pol = brd.createElement('polygon',[A,B,C]);
pol = brd.create('polygon',[A,B,C]);


pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2});
pBCA = brd.createElement('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2});
pCAB = brd.createElement('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,strokeColor:'yellow',dash:2});
i1 = brd.createElement('intersection',[pABC[0],pCAB[0],0]);
i1 = brd.create('intersection',[pABC,pCAB,0]);
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pABC.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pBCA.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
pCAB.setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});


mAB = brd.createElement('midpoint',[A,B]);
mAB = brd.create('midpoint',[A,B]);
mBC = brd.createElement('midpoint',[B,C]);
mBC = brd.create('midpoint',[B,C]);
mCA = brd.createElement('midpoint',[C,A]);
mCA = brd.create('midpoint',[C,A]);
ma = brd.createElement('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});
ma = brd.create('segment',[mBC,A],{strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.createElement('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.create('segment',[mCA,B],{strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.createElement('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.create('segment',[mAB,C],{strokeWidth:1,strokeColor:'#333333',dash:2});
i2 = brd.createElement('intersection',[ma,mc,0]);
i2 = brd.create('intersection',[ma,mc,0]);


i3 = brd.createElement('circumcirclemidpoint',[A,B,C]);
i3 = brd.create('circumcirclemidpoint',[A,B,C]);
c = brd.createElement('circumcircle',[A,B,C],{strokeColor:'#000000',dash:3,strokeWidth:1});
c = brd.create('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'});
euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'red'});
brd.unsuspendUpdate();
brd.unsuspendUpdate();
</jsxgraph>
</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();