Page 1 sur 1

Le tangram-oeuf

Posté : dim. 14 oct. 2012, 15:10
par mumblee
Une variante du code de OG (ce n'est pas le même oeuf !)

Ce code, sûrement pas parfait, doit être plus facilement recyclable puisque les dix pièces sont définies individuellement. Il y a aussi quelques commentaires dans le code.

Je compte m'en servir pour donner un modèle de figure à obtenir en sixième. Si j'y parviens, je posterai à la suite.

Figure asymptote 9f00f438ab55f1b8f449e46c0def151c
*** Pour masquer/découvrir le code Asymptote qui a permis de créer la figure, il faut cliquer dessus. ;-) ***

CODE ASYMPTOTE de la figure ci-dessus : Tout sélectionner
  1. import geometry;
  2. unitsize(2mm);
  3.  
  4. // Définition des sommets, segments et arcs
  5. point pO=origin;
  6. circle cc1=circle(pO,10);
  7. point pA=angpoint(cc1,0), pB=rotate(180,pO)*pA, pC=rotate(90,pO)*pA, pD=rotate(180,pO)*pC;
  8. arc a1=arc(cc1,pB,pA);
  9. circle c1=circle(pA,length(pB-pA)), c2=circle(pB,length(pB-pA));
  10. point pF=intersectionpoints(c1,line(pA,false,pC))[0], pG=intersectionpoints(c2,line(pB,false,pC))[0];
  11. arc a2=arc(c1,pF,pB), a3=arc(c2,pA,pG);
  12. circle cc2=circle(pC,length(pF-pC));
  13. arc a4=arc(cc2,pG,pF);
  14. circle cc3=circle(pD,length(pF-pC));
  15. point pE=intersectionpoints(cc3,line(pC,false,pD,false))[0], pI=intersectionpoints(a4,line(pO,false,pC))[0];
  16. circle c3=circle(pE,length(pD-pE));
  17. point pH=intersectionpoints(c3,line(pA,false,pB,false))[0], pK=intersectionpoints(c3,line(pA,false,pB,false))[1];
  18.  
  19. // Définition des pièces comme chemins fermés
  20. //
  21. // t triangle
  22. // tc triangle curviligne
  23. // qc quadrilatère curviligne
  24. path t1=pO--pA--pC--cycle, t2=pO--pC--pB--cycle, t3=pO--pE--pK--cycle, t4=pO--pH--pE--cycle,
  25. tc1=pC--pA--a3--pG--cycle, tc2=pC--pG--arc(cc2,pG,pI)--pI--cycle,
  26. tc3=pC--pI--arc(cc2,pI,pF)--pF--cycle, tc4=pC--pF--a2--pB--cycle,
  27. qc1=pH--pB--arc(cc1,pB,pD)--pD--pE--cycle, qc2=pE--pD--arc(cc1,pD,pA)--pA--pK--cycle;
  28.  
  29. // Tracé et coloriage des dix pièces
  30. filldraw(t1,lightgreen,black);
  31. filldraw(t2,lightred,black);
  32. filldraw(t3,fuchsia+white,black);
  33. filldraw(t4,mediumgray,black);
  34. filldraw(tc1,lightblue,black);
  35. filldraw(tc2,orange+white,black);
  36. filldraw(tc3,lightcyan,black);
  37. filldraw(tc4,lightyellow,black);
  38. filldraw(qc1,lightolive,black);
  39. filldraw(qc2,0.5*cyan,black);
  40.  
  41. // // Tracé des traits de construction
  42. draw(cc1,dotted);
  43. draw(line(pA,false,pC),dotted);
  44. draw(line(pB,false,pC),dotted);
  45. draw(cc2,dotted);
  46. draw(cc3,dotted);
  47. draw(c3,dotted);
  48.  
  49. // // Tracé des dix pièces par arcs et segments
  50. draw(a1);
  51. draw(line(pA,false,pB,false));
  52. draw(line(pO,false,pI,false));
  53. draw(line(pA,false,pF,false));
  54. draw(line(pB,false,pG,false));
  55. draw(a2);
  56. draw(a3);
  57. draw(a4);
  58. draw(line(pO,false,pD,false));
  59. draw(line(pE,false,pH,false));
  60. draw(line(pE,false,pK,false));
  61.  
  62. // Noms des sommets des pièces
  63. label("$O$",pO,NE);
  64. label("$A$",pA,align=unit(pA-pO));
  65. label("$B$",pB,align=unit(pB-pO));
  66. label("$C$",pC,E);
  67. label("$D$",pD,align=unit(pD-pO));
  68. label("$E$",pE,SE);
  69. label("$F$",pF,align=unit(pF-pC));
  70. label("$G$",pG,align=unit(pG-pC));
  71. label("$H$",pH,align=unit(pH-pE));
  72. label("$K$",pK,align=unit(pK-pE));
  73. label("$I$",pI,align=unit(pI-pO));

Re: Le tangram-oeuf

Posté : dim. 14 oct. 2012, 16:39
par mumblee
Un cygne. On reprend la même base et on joue sur les transformations affines ; c'est pas de tout repos. Dire qu'on trouve des catalogues de 560 motifs sur le net...

Figure asymptote b73cb9a84993ff6d82f7837c1843bb0b
*** Pour masquer/découvrir le code Asymptote qui a permis de créer la figure, il faut cliquer dessus. ;-) ***

CODE ASYMPTOTE de la figure ci-dessus : Tout sélectionner
  1. import geometry;
  2. unitsize(2mm);
  3.  
  4. // Définition des sommets, segments et arcs
  5. point pO=origin;
  6. circle cc1=circle(pO,10);
  7. point pA=angpoint(cc1,0), pB=rotate(180,pO)*pA, pC=rotate(90,pO)*pA, pD=rotate(180,pO)*pC;
  8. arc a1=arc(cc1,pB,pA);
  9. circle c1=circle(pA,length(pB-pA)), c2=circle(pB,length(pB-pA));
  10. point pF=intersectionpoints(c1,line(pA,false,pC))[0], pG=intersectionpoints(c2,line(pB,false,pC))[0];
  11. arc a2=arc(c1,pF,pB), a3=arc(c2,pA,pG);
  12. circle cc2=circle(pC,length(pF-pC));
  13. arc a4=arc(cc2,pG,pF);
  14. circle cc3=circle(pD,length(pF-pC));
  15. point pE=intersectionpoints(cc3,line(pC,false,pD,false))[0], pI=intersectionpoints(a4,line(pO,false,pC))[0];
  16. circle c3=circle(pE,length(pD-pE));
  17. point pH=intersectionpoints(c3,line(pA,false,pB,false))[0], pK=intersectionpoints(c3,line(pA,false,pB,false))[1];
  18.  
  19. // Définition des pièces comme chemins fermés
  20. //
  21. // t triangle
  22. // tc triangle curviligne
  23. // qc quadrilatère curviligne
  24. path t1=pO--pA--pC--cycle, t2=pO--pC--pB--cycle, t3=pO--pE--pK--cycle, t4=pO--pH--pE--cycle,
  25. tc1=pC--pA--a3--pG--cycle, tc2=pC--pG--arc(cc2,pG,pI)--pI--cycle,
  26. tc3=pC--pI--arc(cc2,pI,pF)--pF--cycle, tc4=pC--pF--a2--pB--cycle,
  27. qc1=pH--pB--arc(cc1,pB,pD)--pD--pE--cycle, qc2=pE--pD--arc(cc1,pD,pA)--pA--pK--cycle;
  28.  
  29. // Tracé et coloriage des dix pièces
  30. filldraw(rotate(-90,pO)*t1,gray,lightgray);
  31. filldraw(shift((1-1/sqrt(2))*(pA-pO))*rotate(135,pO)*shift(pO-(pB+pC)/2)*t2,gray,lightgray);
  32. filldraw(shift((pF-pI)+(rotate(45,pB)*pC-pB)+(pB-pO))*rotate(-45,pO)*t3,gray,lightgray);
  33. filldraw(t4,gray,lightgray);
  34. filldraw(shift(pA-pC)*rotate(-90,pC)*tc1,gray,lightgray);
  35. filldraw(rotate(-90,pA)*shift(pA-pC)*tc2,gray,lightgray);
  36. filldraw(shift(pC-pI)*rotate(-45,rotate(45,pB)*pC)*rotate(45,pB)*tc3,gray,lightgray);
  37. filldraw(shift(pB-pC)*rotate(-135,pC)*tc4,gray,lightgray);
  38. filldraw(qc1,gray,lightgray);
  39. filldraw(shift(pA-pO+rotate(135,pO)*(pE-pK))*rotate(135,pO)*shift(pO-pE)*qc2,gray,lightgray);

Re: Le tangram-oeuf

Posté : ven. 19 oct. 2012, 19:18
par GM
mumblee a écrit :Dire qu'on trouve des catalogues de 560 motifs sur le net...

... que voilà.

-----

Suite à la correction du bogue relatif à la fonction arc, j'ai décommenté les lignes problématiques qui avaient été mises en commentaire.

Re: Le tangram-oeuf

Posté : sam. 20 oct. 2012, 11:35
par mumblee
Merci Gaëtan.