Various code with Asymptote – fig0100

Category: Asymptote,MiscellaneousPh. Ivaldi @ 21 h 11 min

Figure 0001
(Compiled with Asymptote version 1.87svn-r4652)
    
size(10cm);

path g=box((-1,-1),(1,1));
pen [] col= new pen[]{gray,yellow};
real k=sqrt(10)/4;
transform T=scale(k)*rotate(degrees(acos(17/(16*k*sqrt(2)))));
int nb=10;

for (int i=0; i<nb; ++i) filldraw(T^i*g,col[i%2]);

Étiquettes : , ,


Various code with Asymptote – fig0200

Category: Asymptote,MiscellaneousPh. Ivaldi @ 22 h 11 min

Figure 0002
(Compiled with Asymptote version 1.87svn-r4652)
    
size(10cm);
path g=box((-1,-1),(1,1));
pen [] col= new pen[]{gray,yellow};

path pairToSquare(pair pt){ return pt -- I*pt -- -pt -- -I*pt --cycle; }

int nb=10;
for (int i=0; i<nb; ++i)
  {
    filldraw(g,col[i%2]);
    g=pairToSquare(relpoint(g,1/16));
  }

Étiquettes : , , ,


Various code with Asymptote – fig0300

Category: Asymptote,MiscellaneousPh. Ivaldi @ 23 h 11 min

Figure 0003
(Compiled with Asymptote version 1.87svn-r4652)
    
// On définit ce qu'est l'objet 'rectangle'
// On peut comparer ça à la définition d'une voiture:
// elle a des propriètés: la couleur, le nombre de portes...
// elle a aussi des actions (ou méthodes en info): ouvrir la porte, tourner le volant, avancer...
struct rectangle
{
  pair A,B,C,D; // Ce sont des propriétés (au sens informatique): ses sommets.
  path path(){return A--B--C--D--cycle;} // Ceci est une action du rectangle (renvoyer le chemin du rectangle)
};

// Le constructeur de l'objet (une action qui renvoie l'objet).
// Chaque fois que l'on va définir une variable 'X' de type 'rectangle'
// c'est le retour de l'action rectangle.init qui est affecté à X.
rectangle operator init() {return new rectangle;}

// La fonction rectangle  qui prend en argument le coin inférieur gauche
// et le coin supérieur droit retourne un rectangle.
// On notera comment l'on récupére une propriété ou une action d'un
// objet grâce au '.' en écrivant objet.propriété ou
// objet.action(les_paramètres).
rectangle rectangle(pair gb, pair dh)
{
  rectangle retour;
  retour.A=(dh.x,gb.y);
  retour.B=dh;
  retour.C=(gb.x,dh.y);
  retour.D=gb;
  return retour;
}

// On peut alors définir tous les opérateurs que l'on veut sur les
// rectangles.
// par exemple la multiplication d'un réal par un rectangle (x*rectangle):
rectangle operator *(real x, rectangle rectangle)
{
  rectangle retour;
  retour.A=rectangle.A+x*(rectangle.B-rectangle.A);
  retour.B=rectangle.B+x*(rectangle.C-rectangle.B);
  retour.C=rectangle.C+x*(rectangle.D-rectangle.C);
  retour.D=rectangle.D+x*(rectangle.A-rectangle.D);
  return retour;
}

// Ici, cette opération est commutative (rectangle*x=x*rectangle):
rectangle operator *(rectangle rectangle,real x){return x*rectangle;}

// On dit ici comment "Asymptote" doit convertir, si besoin est, un type 'rectangle'
// en 'path' puis en 'path[]' (tableau de 'path').
path operator cast(rectangle rectangle){return rectangle.path();}
path[] operator cast(rectangle rectangle){return rectangle.path();}
//Par exemple, dans le code:
/*
  rectangle SQ=rectangle((0,0), (1,1));
  draw(SQ);
*/
// 'draw' attend un type 'path' donc 'SQ' sera automatiquement converti.


// Maintenant on peut travailler avec cette structure
size(10cm);
rectangle SQ=rectangle((0,0), (1,1));
pen [] col= new pen[]{gray,yellow};

int nb=10;
for (int i=0; i<nb; ++i) {
  filldraw(SQ,col[i%2]);
  SQ=.25*SQ;
 }

Étiquettes :


Various code with Asymptote – fig0350

Category: Asymptote,MiscellaneousPh. Ivaldi @ 0 h 11 min

Figure 0004
(Compiled with Asymptote version 1.87svn-r4652)
    
/* Copié depuis La police Pictchou */
// Il faut copiler ce document pour obtenir les fichiers main1.eps, main2.eps,..., main5.eps
eval(quote{
    size(1cm);
    defaultfilename='main1';
    currentpen += 0.5bp;
    currentpen += squarecap;
    currentpen += miterjoin;
    currentpen += linetype(" ",false);
    fill((773,1468)..controls (1032.33,1436) and (1162,1334.67)..(1162,1164)
         --(1220,1020)--(1220,934)--(1206,876)
         --(1235,789)--(1235,746)--(1220,674)
         --(1235,587)--(1235,572)..controls (1235,505.332) and (1114.67,385.332)..(874,212)
         ..controls (851.332,190) and (827.332,122.664)..(802,10)
         --(787,10)--(773,25)--(773,39)
         --(802,183)--(787,169)--(700,169)
         --(672,197)--(672,212)..controls (747.332,212) and (819.332,231.332)..(888,270)
         ..controls (820.664,308.664) and (787,390.332)..(787,515)
         ..controls (767.664,515) and (758,568)..(758,674)
         ..controls (746,674) and (731.664,726.664)..(715,832)
         ..controls (686.332,842) and (672,871)..(672,919)
         ..controls (695.332,994.332) and (767.332,1086)..(888,1194)
         --(917,1194)--(917,1179)--(773,977)
         ..controls (821,977) and (845,933.664)..(845,847)
         ..controls (1027.67,991) and (1119,1096.67)..(1119,1164)
         --(1119,1208)..controls (1072.33,1352) and (976,1424)..(830,1424)
         --(787,1424)..controls (592.332,1271.33) and (472.332,1160.67)..(427,1092)
         --(427,1064)..controls (494.332,969.332) and (528,902)..(528,862)
         --(528,804)--(498,775)..controls (481.332,874.332) and (443,975.332)..(383,1078)
         ..controls (338.332,1299.33) and (256.664,1410)..(138,1410)
         --(95,1396)--(95,1366)..controls (143,1366) and (167,1332.67)..(167,1266)
         --(167,1251)..controls (167,1231.67) and (152.332,1222)..(123,1222)
         --(181,905)--(167,905)--(181,890)
         --(167,717)--(167,630)--(153,616)
         ..controls (153,476.664) and (215.332,361.332)..(340,270)
         --(325,255)--(311,255)--(268,284)
         ..controls (234,143.332) and (200.332,66.332)..(167,53)
         --(153,97)..controls (201,202.332) and (225,279)..(225,327)
         ..controls (157,369.664) and (123,456.332)..(123,587)
         --(138,962)..controls (138,1036.67) and (94.6641,1166.67)..(8,1352)
         --(8,1381)..controls (8,1406.33) and (46.332,1425.67)..(123,1439)
         --(167,1439)..controls (269.664,1439) and (346.664,1347.33)..(398,1164)
         --(412,1164)--cycle^^(51,1352)..controls (63,1280) and (82.332,1241.67)..(109,1237)
         --(138,1280)--(66,1352)--cycle^^(888,818)
         --(903,746)--(903,688)--(917,688)
         ..controls (1090.33,802.664) and (1177,894)..(1177,962)
         --(1177,1006)--(1162,1078)--(1148,1078)
         --cycle^^(730,948)--(730,919)--(715,919)
         ..controls (737.664,861) and (757,832)..(773,832)
         --(802,832)--(802,905)--(758,948)
         --cycle^^(1162,847)..controls (1162,813.664) and (1080.33,746.332)..(917,645)
         --(932,544)--(932,515)--(946,515)
         ..controls (1090,593) and (1176.67,674.664)..(1206,760)
         --(1206,775)..controls (1199.33,823) and (1184.67,847)..(1162,847)
         --cycle^^(773,789)..controls (773,715) and (792,671.664)..(830,659)
         --(860,659)--(874,746)--(860,789)
         --cycle^^(802,616)..controls (818,530) and (837.332,487)..(860,487)
         --(888,515)--(888,602)--(874,616)
         --(874,630)--cycle^^(960,457)--(975,357)
         --(1192,530)--(1192,630)--cycle^^(845,443)
         --(845,414)..controls (851,356) and (865.332,327)..(888,327)
         --(903,327)..controls (925,327) and (939.332,351.332)..(946,400)
         ..controls (936.664,438) and (917.332,457)..(888,457)
         --cycle);
  });

eval(quote{
    size(1cm);
    defaultfilename='main2';
    currentpen += 0.5bp;
    currentpen += squarecap;
    currentpen += miterjoin;
    currentpen += linetype(" ",false);
    fill((768,1854)..controls (819.332,1854) and (850.664,1804.67)..(862,1706)
         ..controls (846.664,1473.33) and (833.332,1357)..(822,1357)
         --(836,1343)--(809,1074)--(809,1061)
         --(822,1061)..controls (877.332,1183) and (917.664,1245.67)..(943,1249)
         ..controls (1057,1249) and (1164.67,1190.67)..(1266,1074)
         ..controls (1304.67,1052) and (1354,980.332)..(1414,859)
         ..controls (1458.67,836.332) and (1481,800.332)..(1481,751)
         ..controls (1481,641) and (1387,448.332)..(1199,173)
         ..controls (1139,173) and (1103,119.332)..(1091,12)
         --(1078,12)..controls (1078,92.6641) and (1055.33,133)..(1010,133)
         ..controls (974.664,133) and (957,146.332)..(957,173)
         --(970,187)--(1051,160)..controls (1151.67,160) and (1227.67,240.664)..(1279,402)
         --(1279,415)..controls (1249.67,415) and (1214,455.332)..(1172,536)
         ..controls (1134,536) and (1093.67,563)..(1051,617)
         ..controls (961,631) and (916,662.332)..(916,711)
         ..controls (954.664,935) and (990.664,1047)..(1024,1047)
         --(1037,1047)--(970,778)..controls (1028.67,778) and (1073.67,764.664)..(1105,738)
         --(1118,738)..controls (1172,908) and (1199,1024.67)..(1199,1088)
         ..controls (1173,1139.33) and (1096.67,1179.67)..(970,1209)
         ..controls (940.664,1197) and (887,1116.33)..(809,967)
         --(795,967)--(755,994)--(822,1733)
         ..controls (822,1787) and (804,1818.33)..(768,1827)
         ..controls (693.332,1827) and (612.664,1486.33)..(526,805)
         --(607,751)--(607,725)--(594,725)
         ..controls (502,743) and (421.332,796.664)..(352,886)
         ..controls (297.332,948.664) and (234.332,980)..(163,980)
         --(123,980)--(83,940)--(83,926)
         ..controls (132.332,926) and (177,894.664)..(217,832)
         --(190,792)..controls (235.332,745.332) and (320.664,606.332)..(446,375)
         --(634,241)--(620,227)--(607,227)
         --(594,241)--(580,241)..controls (553.332,106.332) and (531,39)..(513,39)
         --(486,39)--(540,227)--(352,415)
         ..controls (298.664,605.664) and (182,762.664)..(2,886)
         ..controls (40.6641,975.332) and (90,1020)..(150,1020)
         --(163,1020)..controls (248.332,1020) and (351.664,957.332)..(473,832)
         --(486,832)..controls (574.664,1513.33) and (655.332,1854)..(728,1854)
         --cycle^^(1252,1047)--(1145,698)--(1252,630)
         ..controls (1273.33,630) and (1305,715.332)..(1347,886)
         ..controls (1317.67,982) and (1286,1035.67)..(1252,1047)
         --cycle^^(56,899)--(163,819)--(163,832)
         ..controls (140.332,876.664) and (104.664,899)..(56,899)
         --cycle^^(1373,832)..controls (1373,789.332) and (1346.33,708.664)..(1293,590)
         --(1373,536)--(1387,536)--(1454,738)
         ..controls (1436,794) and (1413.67,825.332)..(1387,832)
         --cycle^^(970,751)--(957,738)..controls (975,684) and (992.664,657)..(1010,657)
         --(1064,657)--(1105,698)--cycle^^(1131,671)
         --(1105,630)..controls (1121.67,585.332) and (1157.33,563)..(1212,563)
         --(1226,563)--(1226,577)..controls (1226,605.664) and (1194.33,637)..(1131,671)
         --cycle^^(1266,563)--(1239,509)..controls (1253.67,464.332) and (1280.67,442)..(1320,442)
         --(1347,483)--(1347,496)..controls (1332.33,532) and (1305.33,554.332)..(1266,563)
         --cycle);
  });

eval(quote{
    size(1cm);
    defaultfilename='main3';
    currentpen += 0.5bp;
    currentpen += squarecap;
    currentpen += miterjoin;
    currentpen += linetype(" ",false);
    fill((1012,1850)..controls (1079.33,1850) and (1127.33,1811.33)..(1156,1734)
         --(1041,1171)--(1055,1171)--(1098,1200)
         --(1142,1200)..controls (1203.33,1200) and (1275.67,1147)..(1359,1041)
         ..controls (1407,1041) and (1440.67,992.664)..(1460,896)
         ..controls (1363.33,579.332) and (1247.67,338.332)..(1113,173)
         --(1113,159)--(1127,14)--(1113,0)
         --(1098,0)--(1070,116)--(1070,173)
         --(968,159)--(954,173)--(954,188)
         ..controls (954.664,201.332) and (1012.33,230.332)..(1127,275)
         ..controls (1177.67,330.332) and (1226,426.664)..(1272,564)
         ..controls (1202,564) and (1149,592.664)..(1113,650)
         ..controls (1076.33,650) and (1018.33,679)..(939,737)
         ..controls (939,811.664) and (987.332,917.664)..(1084,1055)
         --(1113,1026)--(1041,867)--(1055,867)
         --(1156,809)--(1171,809)..controls (1228.33,913) and (1257,990.332)..(1257,1041)
         --(1257,1113)--(1171,1156)--(1127,1156)
         --(1012,1012)--(983,1012)--(983,1026)
         --(1098,1749)--(1041,1807)--(1026,1807)
         ..controls (975.332,1807) and (903,1546.67)..(809,1026)
         --(752,997)..controls (693.332,997) and (649.664,1161)..(621,1489)
         ..controls (583,1631) and (549.332,1708)..(520,1720)
         ..controls (482,1705.33) and (463,1691)..(463,1677)
         --(463,1633)..controls (487,1095.67) and (515.664,821)..(549,809)
         --(607,766)--(578,737)--(231,925)
         --(130,939)--(72,896)..controls (161.332,876.664) and (209.664,852.664)..(217,824)
         --(202,723)..controls (298.664,648.332) and (366.332,566.332)..(405,477)
         ..controls (494.332,319) and (566.332,227.332)..(621,202)
         --(723,217)--(737,202)--(737,188)
         ..controls (731,159.332) and (692.332,145)..(621,145)
         --(578,159)..controls (568.664,53) and (549.332,0)..(520,0)
         --(506,14)--(491,14)..controls (520.332,64.6641) and (535,122.664)..(535,188)
         ..controls (313.664,573.332) and (145,766)..(29,766)
         --(0,809)--(0,838)..controls (0,934.664) and (57.6641,983)..(173,983)
         ..controls (266.332,967) and (358,918.664)..(448,838)
         --(477,838)..controls (438.332,1167.33) and (419,1432.33)..(419,1633)
         --(419,1705)..controls (419,1724.33) and (448,1743.67)..(506,1763)
         ..controls (609.332,1763) and (681.664,1536.67)..(723,1084)
         --(737,1070)--(737,1055)--(766,1055)
         ..controls (860.664,1565.67) and (928,1821)..(968,1821)
         --cycle^^(1315,1026)--(1214,766)..controls (1245.33,766) and (1288.67,737)..(1344,679)
         --(1416,911)--(1416,925)..controls (1386,983.664) and (1352.33,1017.33)..(1315,1026)
         --cycle^^(58,853)--(43,838)--(43,824)
         --(159,752)--(173,766)--(173,824)
         --cycle^^(1012,824)--(997,809)--(997,766)
         ..controls (1013,727.332) and (1046.67,708)..(1098,708)
         ..controls (1112.67,708) and (1127.33,727.332)..(1142,766)
         ..controls (1098,803.332) and (1054.67,822.664)..(1012,824)
         --cycle^^(1171,694)..controls (1171,636) and (1199.67,607)..(1257,607)
         --(1286,607)--(1286,621)..controls (1286,673) and (1267,707)..(1229,723)
         --(1200,723)--cycle);
  });

eval(quote{
    size(1cm);
    defaultfilename='main4';
    currentpen += 0.5bp;
    currentpen += squarecap;
    currentpen += miterjoin;
    currentpen += linetype(" ",false);
    fill((522,1850)--(552,1850)..controls (624.664,1850) and (664.332,1700.67)..(671,1402)
         --(656,1402)--(671,1358)--(686,1059)
         --(716,1059)..controls (815.332,1517) and (905,1746)..(985,1746)
         --(1029,1746)..controls (1069,1729.33) and (1089,1694.33)..(1089,1641)
         ..controls (1089,1534.33) and (1044.33,1340.33)..(955,1059)
         --(940,955)..controls (978,977) and (1067.33,1136)..(1208,1432)
         --(1298,1462)..controls (1348,1448) and (1373,1413.33)..(1373,1358)
         --(1373,1313)..controls (1373,1284.33) and (1303.33,1140)..(1164,880)
         ..controls (1146.67,848) and (1126.67,709)..(1104,463)
         ..controls (1054,321) and (1004.33,226.332)..(955,179)
         --(940,119)--(955,104)--(955,15)
         --(925,15)..controls (905,15) and (895,54.6641)..(895,134)
         --(880,119)--(791,119)--(761,149)
         ..controls (969.664,189.664) and (1074,393.664)..(1074,761)
         ..controls (1074,825) and (1153.67,994)..(1313,1268)
         --(1328,1373)--(1313,1417)--(1283,1417)
         ..controls (1213.67,1332.33) and (1114.33,1168.33)..(985,925)
         --(925,925)--(880,970)..controls (989.332,1331.33) and (1044,1570)..(1044,1686)
         --(1029,1701)--(985,1701)..controls (944.332,1695) and (864.664,1476)..(746,1044)
         ..controls (746,1004.67) and (731,985)..(701,985)
         --(671,985)..controls (641.664,985) and (617,1238.67)..(597,1746)
         --(537,1805)--(492,1805)--(448,1760)
         --(448,1641)..controls (448,1478.33) and (462.664,1319.33)..(492,1164)
         ..controls (532,1164) and (567,1109.33)..(597,1000)
         ..controls (544.332,850.664) and (484.664,776)..(418,776)
         --(418,761)--(463,701)--(463,671)
         --(433,671)--(313,791)--(313,806)
         ..controls (405.664,806) and (485.332,865.664)..(552,985)
         --(537,1044)..controls (469.664,994.664) and (420,970)..(388,970)
         --(343,1000)..controls (154.332,968) and (60,873.332)..(60,716)
         --(60,627)..controls (94.6641,510.332) and (184,356)..(328,164)
         ..controls (398,150.664) and (433,135.664)..(433,119)
         --(433,90)--(358,104)--(343,104)
         --(343,30)--(313,0)..controls (293,0) and (278.332,54.6641)..(269,164)
         ..controls (99.6641,397.332) and (15,541.664)..(15,597)
         ..controls (15,782.332) and (40,901.664)..(90,955)
         --(0,1581)--(0,1596)..controls (0,1655.33) and (30,1695.33)..(90,1716)
         ..controls (170.664,1716) and (240,1546.67)..(298,1208)
         ..controls (312,1208) and (327,1163.33)..(343,1074)
         --(358,1074)--(433,1134)--(403,1731)
         ..controls (410.332,1810.33) and (450,1850)..(522,1850)
         --cycle^^(45,1522)..controls (91.6641,1164) and (131.332,985)..(164,985)
         --(298,1044)..controls (196,1452) and (131.332,1656)..(104,1656)
         --(90,1656)..controls (60,1656) and (45,1611.33)..(45,1522)
         --cycle^^(388,1044)--(403,1029)--(403,1015)
         ..controls (447.664,1031) and (482.332,1060.67)..(507,1104)
         --(477,1104)--cycle);
  });

eval(quote{
    size(1cm);
    defaultfilename='main5';
    currentpen += 0.5bp;
    currentpen += squarecap;
    currentpen += miterjoin;
    currentpen += linetype(" ",false);
    fill((1029,1850)..controls (1053.67,1850) and (1077,1826.67)..(1099,1780)
         --(1015,1002)--(1029,988)--(1043,988)
         ..controls (1093.67,1063.33) and (1182,1285.67)..(1308,1655)
         --(1349,1683)--(1433,1683)..controls (1469.67,1667.67) and (1488,1635.33)..(1488,1586)
         --(1488,1530)--(1308,1002)--(1308,960)
         ..controls (1345.33,990.664) and (1433.33,1125)..(1572,1363)
         --(1655,1405)..controls (1711,1385.67) and (1739,1348.67)..(1739,1294)
         ..controls (1698.33,1187.33) and (1605.67,1020.33)..(1461,793)
         ..controls (1369,357) and (1276,139)..(1182,139)
         ..controls (1172.67,46.332) and (1159,0)..(1141,0)
         --(1113,0)--(1113,111)--(1043,111)
         --(1015,139)--(1015,153)--(1099,153)
         ..controls (1247,227.664) and (1321,334.332)..(1321,473)
         ..controls (1335.67,476.332) and (1363.67,587.664)..(1405,807)
         ..controls (1590.33,1080.33) and (1683,1251.67)..(1683,1321)
         --(1683,1335)--(1669,1349)--(1669,1363)
         ..controls (1618.33,1347) and (1511.67,1198.67)..(1349,918)
         --(1335,904)--(1280,904)..controls (1261.33,904) and (1252,918)..(1252,946)
         --(1447,1586)--(1447,1600)--(1405,1641)
         --(1405,1655)..controls (1359.67,1655) and (1262.33,1432.67)..(1113,988)
         --(1043,932)--(1015,932)--(974,974)
         --(974,1002)--(1057,1767)--(1043,1808)
         --(1015,1808)..controls (945,1808) and (880.332,1543.67)..(821,1015)
         --(779,988)--(751,988)..controls (718.332,988) and (690.664,1219.67)..(668,1683)
         ..controls (649.332,1683) and (640,1697)..(640,1725)
         --(626,1739)--(584,1739)..controls (547.332,1719.67) and (529,1696.33)..(529,1669)
         --(542,1349)--(529,1335)--(529,1321)
         --(542,1266)--(542,1238)--(529,1238)
         --(542,1168)--(542,960)--(556,821)
         --(542,821)--(556,807)--(556,695)
         ..controls (593.332,695) and (621.332,676.664)..(640,640)
         --(612,612)..controls (606,640) and (569,654)..(501,654)
         ..controls (361.664,811.332) and (245.664,890)..(153,890)
         --(83,862)--(83,835)..controls (146.332,835) and (193,797.664)..(223,723)
         --(209,682)..controls (255.664,632.664) and (339,493.332)..(459,264)
         ..controls (521,199.332) and (586,167)..(654,167)
         --(695,181)--(709,167)--(709,153)
         --(682,125)--(598,125)--(584,28)
         --(556,28)--(529,56)--(529,97)
         --(542,111)--(403,264)..controls (261,541.332) and (154.332,694.332)..(83,723)
         ..controls (45,735.664) and (17.332,759)..(0,793)
         ..controls (32,885.664) and (97,932)..(195,932)
         ..controls (281,918.664) and (383,849)..(501,723)
         --(501,1029)--(487,1099)--(501,1099)
         --(487,1113)--(487,1224)--(501,1238)
         --(487,1252)--(501,1391)--(487,1461)
         --(501,1461)--(487,1474)--(487,1711)
         ..controls (510.332,1757) and (547.332,1780)..(598,1780)
         ..controls (690.664,1780) and (737,1622.67)..(737,1308)
         --(751,1224)--(737,1210)--(737,1196)
         --(765,1043)..controls (787.664,1043) and (824.664,1261)..(876,1697)
         ..controls (911.332,1799) and (962.332,1850)..(1029,1850)
         --cycle^^(70,807)--(70,793)--(167,723)
         --(167,737)..controls (161.664,759) and (129.332,782.332)..(70,807)
         --cycle);
  });

for (int n=1; n < 11; ++n) {
  picture pic;
  label(pic,graphic("main"+(string)(n < 6 ? n : 5)+".eps"),(n < 6 ? -3.5cm : 0,0));
  if(n > 5)
    label(pic, reflect(N,S)*graphic("main"+(string)(n-5)+".eps"), (1cm,0));
  add(pic, (4*(n%6),-2*floor(n/6))*1cm);
}

Étiquettes :


Various code with Asymptote – fig0360

Category: Asymptote,MiscellaneousPh. Ivaldi @ 1 h 11 min

Figure 0005
(Compiled with Asymptote version 1.87svn-r4652)
    
// Carte à points 1.
import carteApoints;
settings.outformat="pdf";

add(scale(0.5)*carteApoints(1).fit()); //fig0360.pdf

shipout(bbox(2mm));

Étiquettes :


Various code with Asymptote – fig0370

Category: Asymptote,MiscellaneousPh. Ivaldi @ 2 h 11 min

Figure 0006
(Compiled with Asymptote version 1.87svn-r4652)
    
// Carte à points 2.
import carteApoints;
settings.outformat="pdf";

add(scale(0.5)*carteApoints(8).fit()); //fig0370.pdf

shipout(bbox(2mm));

Étiquettes :


Various code with Asymptote – fig0400

Category: Asymptote,MiscellaneousPh. Ivaldi @ 3 h 11 min

Figure 0007
(Compiled with Asymptote version 1.87svn-r4652)
    
// Toutes les cartes à points dans un seul pdf: fig0400.pdf
import carteApoints;
import animation;
settings.outformat="pdf";

animation A;

real sc=1/3;
for (int i=1; i < 10; i += 2) {
  picture pic;
  add(pic,scale(sc)*bbox(carteApoints(i),3mm));
  add(pic,shift((0,2.8*min(pic).y))*scale(sc)*bbox(carteApoints(i+1),3mm));
  A.add(pic);
}

A.movie();

Étiquettes :


Various code with Asymptote – fig0405

Category: Asymptote,MiscellaneousPh. Ivaldi @ 4 h 11 min

Figure 0008
(Compiled with Asymptote version 1.87svn-r4652)
    
// PDF version of this picture: fig0405.pdf
import labelpath;

size(17cm,0);
usepackage("mathrsfs, amsfonts,amsmath,amssymb");
picture pic, pic1, pic2, pic3;
real u=1, Y=pi+0.2;
path cle=scale(u)*unitcircle;
path arcg=arc((0,0),1.5*u,115,155);

void addtick(picture pic=currentpicture, Label L, pair z, pair dir=E, pen p=currentpen)
{
  transform R=rotate(degrees(dir));
  real width=1.5mm;
  Label L=L.copy();
  L.position(z);
  L.align(NoAlign,E);
  L.align.dir=R*L.align.dir*1.3*width/mm;
  L.p(p);
  pic.add(new void(frame f, transform t) {
      path g=(-width,0)--(width,0);
      picture opic;
      draw(opic,shift(t*z)*R*g,p);
      add(f,opic.fit());
    });
  add(pic,L);
}

path roll(picture pic=currentpicture, real x, int nb=50)
{
  real stp=x/(nb-1);
  return operator --(...
                     sequence(new guide(int t){
                         real tt=t*stp;
                         return shift(expi(tt))*((x-tt)*(-sin(tt),cos(tt)));
                       },nb));
}

labelpath("\tiny Sens direct",reverse(arcg));
draw(arcg, Arrow());
draw(Label("$\mathscr{C}$",Relative(0.625)), cle,bp+grey);

dot("$O$", (0,0), S);
dot("$0$", point(cle,0));
dot("$I$", point(cle,0), 2*W);
dot("$J$", point(cle,1), 2*S);
dot("$K$", point(cle,2), 2*W);
dot("$L$", point(cle,3), 2*N);

draw("$1$",(0,0)--point(cle,2),Arrows);

pic.add(currentpicture);// Save the common picture.

// Starting picture 1
pair yM=(u,Y*u), ym=(u,-Y*u);
draw(ym--yM, linewidth(bp), Arrow(TeXHead));
arrow("\underline{Axe des réels}",(u,-0.75*Y*u),W,1cm);

real x=2.2, y=-1.25;
addtick(Label("$1$", align=E),(u,1));
addtick(Label("$2$", align=E),(u,2));
addtick(Label("$-1$", align=E),(u,-1));
addtick(Label("$x$", align=E),(u,x));
addtick(Label("$y$", align=E),(u,y));

pic1.add(currentpicture);
erase();

// Starting picture 2
add(pic);
real t=x+0.1;

draw((u,0)--yM, bp+grey, Arrow(TeXHead));
path tg=arc((0,0),u,0,degrees(t));
draw(tg,linewidth(bp));
addtick(Label("$1$", align=E),u*(cos(1),sin(1)),dir(degrees(1.0)));
addtick(Label("$1$", align=E),(u,1), grey);

addtick(Label("$2$", align=E),(u,2),grey);
addtick(Label("$\frac{\pi}{2}$", align=E),(u,pi/2),grey);
addtick(Label("$\pi$", align=E),(u,pi),grey);
addtick(Label("$-1$", align=E),(u,-1));
addtick(Label("$x$", align=E),(u,x), grey);
addtick(Label("$x$", align=E),u*(cos(x),sin(x)),dir(degrees(x)));
addtick(Label("$y$", align=E),(u,-x));

dot("$M$", u*expi(x), -2*u*expi(x));

draw(Label("+",Relative(0.5)), roll(x), dotted, Arrow(Relative(0.5)));
draw(roll(1), dotted);
draw(Label("+",Relative(0.5)), roll(pi/2), dotted, Arrow(Relative(0.5)));
draw(Label("+",Relative(0.5)), roll(pi,100), dotted, Arrow(Relative(0.5)));

path g=u*expi(t)--shift(u*expi(t))*((Y-t)*u*expi(pi/2+t));
draw(g,linewidth(bp), Arrow(TeXHead));
addtick(Label("$\pi$", align=E),arcpoint(g,(pi-t)*u),expi(t));

pic3.add(currentpicture);
draw(ym--(u,0), linewidth(bp));
pic2.add(currentpicture);
erase();

// Starting picture 3

draw(ym--(u,0), linewidth(bp)+grey);
path tg=arc((0,0),u,0,degrees(-t));
draw(tg,linewidth(bp));
addtick(Label("$-1$", align=E),u*(cos(-1),sin(-1)),dir(degrees(-1.0)));
addtick(Label("$-1$", align=E),(u,-1), grey);

addtick(Label("$-2$", align=E),(u,-2),grey);
addtick(Label("$-\frac{\pi}{2}$", align=E),(u,-pi/2),grey);
addtick(Label("$-\pi$", align=E),(u,-pi),grey);

dot("$N$", u*expi(-x), -2*u*expi(-x));

g=roll(-x);
draw(Label("$-$",align=2*I*dir(g,0.5),Relative(0.5)), g, dotted, Arrow(NoFill,Relative(0.5)));
g=roll(-1);
draw(g, dotted);
g=roll(-pi/2);
draw(Label("$-$",align=2*I*dir(g,0.5),Relative(0.5)), g, dotted, Arrow(NoFill,Relative(0.5)));
g=roll(-pi,100);
draw(Label("$-$",align=2*I*dir(g,0.5),Relative(0.5)), g, dotted, Arrow(NoFill,Relative(0.5)));

g=u*expi(-t)--shift(u*expi(-t))*((Y-t)*u*expi(-pi/2-t));
draw(g, linewidth(bp), Arrow(TeXHead));
addtick(Label("$-\pi$", align=E),arcpoint(g,(pi-t)*u),expi(-t));


////////////////////////////////////////////////////////////
pic3.add(currentpicture);
erase();

add(pic1);
add(shift(4*u,0)*pic2);
add(shift(8*u,0)*pic3);
shipout(format="pdf");


Various code with Asymptote – fig0410

Category: Asymptote,MiscellaneousPh. Ivaldi @ 5 h 11 min

Figure 0009
(Compiled with Asymptote version 1.87svn-r4652)
    
size(10cm);
path cle=unitcircle;

path roll(picture pic=currentpicture, real x, int nb=50)
{
  real stp=x/(nb-1);
  return operator --(...
                     sequence(new guide(int t){
                         real tt=t*stp;
                         return shift(expi(tt))*((x-tt)*(-sin(tt),cos(tt)));
                       },nb));
}

real y=4*pi;
pair yM=(1,y), ym=(1,-y);

int nb=100;
real stp=2*y/nb;

path[] g;
for (int i=1; i <= nb; ++i) {
  real t=-y+i*stp;
  g.push(roll(-y+i*stp/2,50+round(20*i*stp))--reverse(roll(y-i*stp/2,50+round(20*i*stp)))--cycle);
}

pen p1=blue, p2=0.9*red;
fill(g,p1);
fill(g,fillrule(1)+p2);
unfill(cle);
draw(cle,white);
shipout(rotate(-90)*bbox(Fill(lightyellow)));


Various code with Asymptote – fig0420

Category: Asymptote,MiscellaneousPh. Ivaldi @ 6 h 11 min

Figure 0010
(Compiled with Asymptote version 1.87svn-r4652)
    
import stats;

path ell(pair O, real a, real b, int t=1)
{
  path g=ellipse(O,a,b);
  return subpath(g, t > 0 ? -1 : 1, t > 0 ? 1 : 3);
}

size(10cm,0);

real a=1, b=1.75, d=0.1, dl=1.5;
pen p1=1.5bp+white, p2=1.5bp+black;
pen fp=grey;
int n=8, nm=floor(n/2);
real step=1/n;


for (int line=0; line < 7; ++line) {
  pair p=(0,0);
  picture pic;
  transform Sh=shift(line*(0,-2.5*b));
  for (int i=0; i <= nm; ++i) {
    real t=cos(i*step);
    real t=0.75-i*step;
    real na=a*(0.25+0.75*t);
    path g1=ell(p,na,b,1);
    path g2=ell(p,na,b,-1);
    fill(pic, g1--g2--cycle, fp);
    label(pic,(string)round(unitrand()),p,white);
    draw(pic, g1, p1);
    draw(pic, g2, p2);
    if(i != 0) {
      transform T=shift(-2p);
      label(pic,(string)round(unitrand()),T*p,white);
      fill(pic, T*(g1--g2--cycle), fp);
      draw(pic, T*g1, p1);
      draw(pic, T*g2, p2);
    }
    if(i != nm) p += na+d+dl*t;
  }
  add(Sh*pic);
  pair M=(p.x,0);
  picture pic2=reflect(M,M+N)*pic;
  add(Sh*pic2);
  add(Sh*reflect(3*M,3*M+N)*pic2);
}

shipout(bbox(1mm,Fill(lightgrey)));