Difference between revisions of "Euler line"

From JSXGraph Wiki
Jump to: navigation, search
Line 3: Line 3:
  
 
brd.suspendUpdate();
 
brd.suspendUpdate();
A = brd.createElement('point',[1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
A = brd.create('point',[1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
B = brd.createElement('point',[-1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
B = brd.create('point',[-1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
C = brd.createElement('point',[0.2,1.5],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
C = brd.create('point',[0.2,1.5],{strokeColor:'#901B77',fillColor:'#CA147A'});
pol = brd.createElement('polygon',[A,B,C], {fillColor:'#FFFF0050'});
+
pol = brd.create('polygon',[A,B,C], {fillColor:'#FFFF0050'});
 
for(i=0;i<=2;i++) {
 
for(i=0;i<=2;i++) {
 
     pol.borders[i].setProperty('strokeColor:#009256');
 
     pol.borders[i].setProperty('strokeColor:#009256');
 
}
 
}
  
pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2, name:['','H_c']});
+
pABC = brd.create('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']});
+
pBCA = brd.create('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']});
+
pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,dash:2, name:['','H_b']});
 
pABC[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pABC[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pBCA[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pBCA[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pCAB[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'});
+
i1 = brd.create('intersection',[pABC[0],pCAB[0],0],{strokeColor:'#009256',fillColor:'#65B72E',name:'H'});
 
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
 
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
 
pBCA[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});
 
pCAB[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
  
mAB = brd.createElement('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
+
mAB = brd.create('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
mBC = brd.createElement('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
+
mBC = brd.create('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
mCA = brd.createElement('midpoint',[C,A],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_b'});
+
mCA = brd.create('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});
+
ma = brd.create('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});
+
mb = brd.create('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});
+
mc = brd.create('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'});
+
i2 = brd.create('intersection',[ma,mc,0],{strokeColor:'#009256',fillColor:'#65B72E',name:'S'});
  
i3 = brd.createElement('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
+
i3 = brd.create('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
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[0].setProperty('visible:false');
 
c[0].setProperty('visible:false');
 
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});
 
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});
  
euler = brd.createElement('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
+
euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
 
brd.unsuspendUpdate();
 
brd.unsuspendUpdate();
  
Line 47: Line 47:
  
 
brd.suspendUpdate();
 
brd.suspendUpdate();
A = brd.createElement('point',[1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
A = brd.create('point',[1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
B = brd.createElement('point',[-1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
B = brd.create('point',[-1,0],{strokeColor:'#901B77',fillColor:'#CA147A'});
C = brd.createElement('point',[0.2,1.5],{strokeColor:'#901B77',fillColor:'#CA147A'});
+
C = brd.create('point',[0.2,1.5],{strokeColor:'#901B77',fillColor:'#CA147A'});
pol = brd.createElement('polygon',[A,B,C], {fillColor:'#FFFF0050'});
+
pol = brd.create('polygon',[A,B,C], {fillColor:'#FFFF0050'});
 
for(i=0;i<=2;i++) {
 
for(i=0;i<=2;i++) {
 
     pol.borders[i].setProperty('strokeColor:#009256');
 
     pol.borders[i].setProperty('strokeColor:#009256');
 
}
 
}
  
pABC = brd.createElement('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2, name:['','H_c']});
+
pABC = brd.create('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']});
+
pBCA = brd.create('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']});
+
pCAB = brd.create('perpendicular',[pol.borders[2],B],{strokeWidth:1,dash:2, name:['','H_b']});
 
pABC[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pABC[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pBCA[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pBCA[1].setProperty('strokeColor:#901B77','fillColor:#CA147A');
 
pCAB[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'});
+
i1 = brd.create('intersection',[pABC[0],pCAB[0],0],{strokeColor:'#009256',fillColor:'#65B72E',name:'H'});
 
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
 
pABC[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
 
pBCA[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});
 
pCAB[0].setProperty({strokeColor:'#000000',dash:1,strokeWidth:1});
  
mAB = brd.createElement('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
+
mAB = brd.create('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
mBC = brd.createElement('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
+
mBC = brd.create('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
mCA = brd.createElement('midpoint',[C,A],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_b'});
+
mCA = brd.create('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});
+
ma = brd.create('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});
+
mb = brd.create('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});
+
mc = brd.create('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'});
+
i2 = brd.create('intersection',[ma,mc,0],{strokeColor:'#009256',fillColor:'#65B72E',name:'S'});
  
i3 = brd.createElement('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
+
i3 = brd.create('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
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[0].setProperty('visible:false');
 
c[0].setProperty('visible:false');
 
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});
 
c[1].setProperty({strokeColor:'#000000',dash:3,strokeWidth:1});
  
euler = brd.createElement('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
+
euler = brd.create('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
 
brd.unsuspendUpdate();
 
brd.unsuspendUpdate();
 
 
</jsxgraph></source>
 
</jsxgraph></source>
  
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Geometry]]
 
[[Category:Geometry]]

Revision as of 16:34, 12 March 2010

The JavaScript code

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

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

pABC = brd.create('perpendicular',[pol.borders[0],C],{strokeWidth:1,dash:2, name:['','H_c']});
pBCA = brd.create('perpendicular',[pol.borders[1],A],{strokeWidth:1,dash:2, name:['','H_a']});
pCAB = brd.create('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.create('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.create('midpoint',[A,B],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_c'});
mBC = brd.create('midpoint',[B,C],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_a'});
mCA = brd.create('midpoint',[C,A],{strokeColor:'#901B77',fillColor:'#CA147A',name:'M_b'});
ma = brd.create('line',[mBC,A],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
mb = brd.create('line',[mCA,B],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
mc = brd.create('line',[mAB,C],{straightFirst:false,straightLast:false,strokeWidth:1,strokeColor:'#333333',dash:2});
i2 = brd.create('intersection',[ma,mc,0],{strokeColor:'#009256',fillColor:'#65B72E',name:'S'});

i3 = brd.create('circumcirclemidpoint',[A,B,C],{strokeColor:'#009256',fillColor:'#65B72E',name:'U'});
c = brd.create('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.create('line',[i1,i3],{strokeWidth:2,strokeColor:'#901B77'});
brd.unsuspendUpdate();
</jsxgraph>