Tangram: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) (New page: <html> <a href="javascript:solveit()">Click here to solve it</a> </html> <jsxgraph width="680" height="580"> function solveit() { t=400; f1.setProperty('sha...) |
A WASSERMANN (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 48: | Line 48: | ||
var board = JXG.JSXGraph.initBoard(' | var board = JXG.JSXGraph.initBoard('jxgbox', {showNavigation:false, showCopyright:true, originX: 0, originY: 670, unitX: 30, unitY: 30}); | ||
var p1 = board. | var p1 = board.create('point',[11,5],{visible:false}); | ||
var p2 = board. | var p2 = board.create('point',[11,15],{visible:false}); | ||
var p3 = board. | var p3 = board.create('point',[21,15],{visible:false}); | ||
var p4 = board. | var p4 = board.create('point',[21,5],{visible:false}); | ||
var f = board. | var f = board.create('polygon',[p1,p2,p3,p4],{fillcolor:'none'}); | ||
for(i=0; i<f.borders.length; i++) { | for(i=0; i<f.borders.length; i++) { | ||
f.borders[i].setProperty('strokeColor:black'); | f.borders[i].setProperty('strokeColor:black'); | ||
Line 61: | Line 61: | ||
// First polygon | // First polygon | ||
var p11 = board. | var p11 = board.create('point',[16,16],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c11 = board. | var c11 = board.create('circle',[p11,5],{visible:false}); | ||
var p12 = board. | var p12 = board.create('glider',[21,16,c11],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p13 = board. | var p13 = board.create('point',[function() {return -p12.Y()+p11.Y()+p12.X()},function() {return -p11.X()+p12.X()+p12.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f1 = board. | var f1 = board.create('polygon',[p11,p12,p13],{fillcolor:'#99FF00',visible:true,shadow:true}); | ||
for(i=0; i<f1.borders.length; i++) { | for(i=0; i<f1.borders.length; i++) { | ||
f1.borders[i].setProperty('strokeColor:black'); | f1.borders[i].setProperty('strokeColor:black'); | ||
Line 71: | Line 71: | ||
// Second polygon | // Second polygon | ||
var p21 = board. | var p21 = board.create('point',[11,16],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c21 = board. | var c21 = board.create('circle',[p21,5/2.0*Math.sqrt(2)],{visible:false}); | ||
var p22 = board. | var p22 = board.create('glider',[11.0+5/2.0*Math.sqrt(2),16,c21],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p23 = board. | var p23 = board.create('point',[function() {return -p22.Y()+p21.Y()+p22.X()},function() {return -p21.X()+p22.X()+p22.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f2 = board. | var f2 = board.create('polygon',[p21,p22,p23],{fillcolor:'#0099CC',visible:true,shadow:true}); | ||
for(i=0; i<f2.borders.length; i++) { | for(i=0; i<f2.borders.length; i++) { | ||
f2.borders[i].setProperty('strokeColor:black'); | f2.borders[i].setProperty('strokeColor:black'); | ||
Line 82: | Line 82: | ||
// Third polygon | // Third polygon | ||
var p31 = board. | var p31 = board.create('point',[11+5/2.0*Math.sqrt(2),21],{face:'circle',fillColor:'blue',strokeColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c31 = board. | var c31 = board.create('circle',[p31,5/2.0*Math.sqrt(2)],{visible:false}); | ||
var p32 = board. | var p32 = board.create('glider',[11,21,c31],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p33 = board. | var p33 = board.create('point',[function() {return -p32.Y()+p31.Y()+p32.X()},function() {return -p31.X()+p32.X()+p32.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f3 = board. | var f3 = board.create('polygon',[p31,p32,p33],{fillcolor:'#FFFF00',visible:true,shadow:true}); | ||
for(i=0; i<f3.borders.length; i++) { | for(i=0; i<f3.borders.length; i++) { | ||
f3.borders[i].setProperty('strokeColor:black'); | f3.borders[i].setProperty('strokeColor:black'); | ||
Line 92: | Line 92: | ||
// Fourth polygon | // Fourth polygon | ||
var p41 = board. | var p41 = board.create('point',[1,5],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c41 = board. | var c41 = board.create('circle',[p41,5*Math.sqrt(2)],{visible:false}); | ||
var p42 = board. | var p42 = board.create('glider',[1+5*Math.sqrt(2),5,c41],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p43 = board. | var p43 = board.create('point',[function() {return -p42.Y()+p41.Y()+p42.X()},function() {return -p41.X()+p42.X()+p42.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f4 = board. | var f4 = board.create('polygon',[p41,p42,p43],{fillcolor:'#FFCCFF',visible:true,shadow:true}); | ||
for(i=0; i<f4.borders.length; i++) { | for(i=0; i<f4.borders.length; i++) { | ||
f4.borders[i].setProperty('strokeColor:black'); | f4.borders[i].setProperty('strokeColor:black'); | ||
Line 102: | Line 102: | ||
// Fifth polygon | // Fifth polygon | ||
var p51 = board. | var p51 = board.create('point',[1+5*Math.sqrt(2),13.5],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c51 = board. | var c51 = board.create('circle',[p51,5*Math.sqrt(2)],{visible:false}); | ||
var p52 = board. | var p52 = board.create('glider',[1,13.5,c51],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p53 = board. | var p53 = board.create('point',[function() {return -p52.Y()+p51.Y()+p52.X()},function() {return -p51.X()+p52.X()+p52.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f5 = board. | var f5 = board.create('polygon',[p51,p52,p53],{fillcolor:'#996699',visible:true,shadow:true}); | ||
for(i=0; i<f5.borders.length; i++) { | for(i=0; i<f5.borders.length; i++) { | ||
f5.borders[i].setProperty('strokeColor:black'); | f5.borders[i].setProperty('strokeColor:black'); | ||
Line 112: | Line 112: | ||
// Sixth polygon | // Sixth polygon | ||
var p61 = board. | var p61 = board.create('point',[1,15],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c61 = board. | var c61 = board.create('circle',[p61,5/2*Math.sqrt(2)],{visible:false}); | ||
var p62 = board. | var p62 = board.create('glider',[1+5/2*Math.sqrt(2),15,c61],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p63 = board. | var p63 = board.create('point',[function() {return -p62.Y()+p61.Y()+p62.X()},function() {return -p61.X()+p62.X()+p62.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var p64 = board. | var p64 = board.create('point',[function() {return -p62.Y()+p61.Y()+p61.X()},function() {return -p61.X()+p62.X()+p61.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f6 = board. | var f6 = board.create('polygon',[p61,p62,p63,p64],{fillcolor:'#EE0000',visible:true,shadow:true}); | ||
for(i=0; i<f6.borders.length; i++) { | for(i=0; i<f6.borders.length; i++) { | ||
f6.borders[i].setProperty('strokeColor:black'); | f6.borders[i].setProperty('strokeColor:black'); | ||
Line 123: | Line 123: | ||
// Seventh polygon | // Seventh polygon | ||
var p71 = board. | var p71 = board.create('point',[6,14.5],{face:'circle',fillColor:'blue',strokeColor:'blue',withLabel:false,visible:true}); | ||
var c71 = board. | var c71 = board.create('circle',[p71,5/2*Math.sqrt(2)],{visible:false}); | ||
var p72 = board. | var p72 = board.create('glider',[8.5,17,c71],{face:'plus',strokeColor:'blue',withLabel:false,visible:true}); | ||
var p73 = board. | var p73 = board.create('point',[function() {return p72.X()-p71.X()-p72.Y()+p71.Y()+p72.X()},function() {return p72.X()-p71.X()+p72.Y()-p71.Y()+p72.Y()}],{face:'circle',fillColor:'blue',withLabel:false,visible:false}); | ||
var p74 = board. | var p74 = board.create('point',[function() {return p72.X()-p71.X()-p72.Y()+p71.Y()+p71.X()},function() {return p72.X()-p71.X()+p72.Y()-p71.Y()+p71.Y()}],{face:'rectangle',fillColor:'blue',withLabel:false,visible:false}); | ||
var f7 = board. | var f7 = board.create('polygon',[p71,p72,p73,p74],{fillcolor:'#FFCC33',visible:true,shadow:true}); | ||
for(i=0; i<f7.borders.length; i++) { | for(i=0; i<f7.borders.length; i++) { | ||
f7.borders[i].setProperty('strokeColor:black'); | f7.borders[i].setProperty('strokeColor:black'); | ||
} | } | ||
</jsxgraph> | |||
===External links=== | |||
* [http://en.wikipedia.org/wiki/Tangram Tangram - Wikipedia entry] | |||
[[Category: Examples]] |