|
|
|
Figure 0001: fig0010.asy (Compiled with Asymptote version 1.86svn-r4626) |
import Lsystem;
size(10cm);
string[][] rules={{"F","FF"}, {"X","--FXF++FXF++FXF--"}};
Lsystem Sierpinski=Lsystem("FXF--FF--FF", rules, La=60, Lai=0);
Sierpinski.iterate(5);
draw(Sierpinski.paths(), bp+0.2*green);
shipout(bbox(Fill(paleyellow)));
|
|
|
Figure 0002: fig0020.asy (Compiled with Asymptote version 1.84svn-r4619) |
import Lsystem;
size(10cm,0);
Lsystem SierpinskiCurve=
Lsystem("YF",
new string[][]{{"X","YF+XF+Y"},{"Y","XF-YF-X"}},
La=60, Lai=0);
SierpinskiCurve.iterate(7);
draw(SierpinskiCurve.paths(), bp+0.2*green);
shipout(bbox(Fill(paleyellow)));
|
|
|
Figure 0003: fig0030.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0004: fig0040.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0005: fig0050.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0006: fig0060.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0007: fig0070.asy (Compiled with Asymptote version 1.84svn-r4619) |
// Quadratic Koch Island
import Lsystem;
size(10cm,0);
string[][] rules={{"F","F-F+F+FFF-F-F+F"}};
Lsystem QuadraticKochIsland=Lsystem("F+F+F+F", rules, La=90, Lai=0);
QuadraticKochIsland.iterate(3);
draw(QuadraticKochIsland.paths(), bp+0.9*yellow);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0008: fig0080.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0009: fig0090.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0010: fig0100.asy (Compiled with Asymptote version 1.84svn-r4619) |
/*An animation of the 3D Hilbert curve may be found HERE*/
import Lsystem;
size(10cm,0);
currentprojection=currentprojection=orthographic((10,5,6));
string[][] rules={{"X","^<XF^<XFX-F^>>XFX&F+>>XFX-F>X->"}};
Lsystem3 HilbertCurve3D=Lsystem3("X", rules, La=90);
HilbertCurve3D.iterate(3);
// !! Use a lot of memory !!
/* path3[] g=HilbertCurve3D.paths3();
draw(g[0], linewidth(bp)+0.9*yellow);
*/
HilbertCurve3D.drawpaths3(linewidth(bp)+0.9*yellow);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0011: fig0110.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0012: fig0120.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0013: fig0130.asy (Compiled with Asymptote version 1.84svn-r4619) |
import Lsystem;
size(12cm,0);
string[][] rules={{"F","-F+F-F-F+F+FF-F+F+FF+F-F-FF+FF-FF+F+F-FF-F-F+FF-F-F+F+F-F+"}};
Lsystem segment32Curve= Lsystem("F+F+F+F", rules, La=90, Lai=45);
segment32Curve.iterate(2);
filldraw(segment32Curve.paths()[0]&cycle, 0.8*yellow, blue);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0014: fig0140.asy (Compiled with Asymptote version 1.84svn-r4619) |
// Peano Gosper curve
import Lsystem;
size(8cm,0);
Lsystem PeanoGosperCurve=
Lsystem("FX",
new string[][]{{"X","X+YF++YF-FX--FXFX-YF+"},{"Y","-FX+YFYF++YF+FX--FX-Y"}},
La=60, Lai=0);
PeanoGosperCurve.iterate(4);
draw(PeanoGosperCurve.paths(), bp+0.9*yellow);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0015: fig0150.asy (Compiled with Asymptote version 1.84svn-r4619) |
import Lsystem;
size(8cm,0);
string[][] rules={{"X","XF-F+F-XF+F+XF-F+F-X"}};
Lsystem squareCurve= Lsystem("F+XF+F+XF", rules, La=90, Lai=45);
squareCurve.iterate(5);
filldraw(squareCurve.paths()[0]&cycle, grey, 1bp+0.9*yellow);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0016: fig0160.asy (Compiled with Asymptote version 1.84svn-r4619) |
import Lsystem;
size(8cm,0);
string[][] rules={{"L","+R-F-R+"}, {"R","-L+F+L-"}};
Lsystem squareCurve= Lsystem("L--F--L--F", rules, La=45, Lai=45);
squareCurve.iterate(9);
filldraw(squareCurve.paths()[0]&cycle, grey, 1bp+0.9*yellow);
shipout(bbox(3mm, Fill(black)));
|
|
|
Figure 0017: fig0170.asy (Compiled with Asymptote version 1.84svn-r4619) |
|
|
|
Figure 0018: fig0180.asy (Compiled with Asymptote version 1.84svn-r4619) |
import Lsystem;
size(10cm,0);
string[][] rules={
{"F", ""},
{"P", "--FR++++FS--FU"},
{"Q", "FT++FR----FS++"},
{"R", "++FP----FQ++FT"},
{"S", "FU--FP++++FQ--"},
{"T", "+FU--FP+"},
{"U", "-FQ++FT-"}
};
Lsystem pentive=Lsystem("Q", rules, La=36, Lai=180);
pentive.iterate(8);
draw(pentive.paths(), 0.8*yellow);
shipout(bbox(2mm, Fill(black)));
|
|
|
Figure 0019: fig0190.asy (Compiled with Asymptote version 1.84svn-r4619) |
/* Source */
import Lsystem;
size(8cm,0);
string[][] rules={
{"A", "X+X+X+X+X+X+"},
{"X", "[F+F+F+F[---X-Y]+++++F++++++++F-F-F-F]"},
{"Y", "[F+F+F+F[---Y]+++++F++++++++F-F-F-F]"}
};
Lsystem spiral=Lsystem("AAAA",rules,La=15);
spiral.iterate(6);
draw(spiral.paths(), 0.9*green);
shipout(bbox(2mm, Fill(black)));
|
|
|
Figure 0020: fig0200.asy (Compiled with Asymptote version 1.84svn-r4619) |
/* Pavage P3 de Penrose
Drawing the Penrose tiling P3 */
import Lsystem;
size(8cm,0);
string[][] rules={
{"6","8F++9F----7F[-8F----6F]++"},
{"7","+8F--9F[---6F--7F]+"},
{"8","-6F++7F[+++8F++9F]-"},
{"9","--8F++++6F[+9F++++7F]--7F"},
{"F",""}
};
Lsystem Penrose=Lsystem("[7]++[7]++[7]++[7]++[7]", rules, La=36);
Penrose.iterate(4);
draw(Penrose.paths(), linewidth(bp));
shipout(bbox(2mm, FillDraw(lightyellow,linewidth(1mm))));
|
|
|
Figure 0021: fig0210.asy (Compiled with Asymptote version 1.84svn-r4619) |
/* Pavage de Penrose
Source */
import Lsystem;
size(8cm,0);
string[][] rules={
{"W", "YF++ZF----XF[-YF----WF]++"},
{"X", "+YF--ZF[---WF--XF]+"},
{"Y", "-WF++XF[+++YF++ZF]-"},
{"Z", "--YF++++WF[+ZF++++XF]--XF"},
{"F", ""}
};
Lsystem Penrose=Lsystem("++ZF----XF-YF----WF",rules,La=36);
Penrose.iterate(4);
draw(Penrose.paths(), linewidth(bp));
shipout(bbox(2mm, FillDraw(lightyellow,linewidth(1mm))));
|
|
|
Figure 0022: fig0220.asy (Compiled with Asymptote version 1.84svn-r4619) |
/* Double pavage de Penrose
Source */
import Lsystem;
size(8cm,0);
string[][] rules={
{"W", "YF++ZF----XF[-YF----WF]++"},
{"X", "+YF--ZF[---WF--XF]+"},
{"Y", "-WF++XF[+++YF++ZF]-"},
{"Z", "--YF++++WF[+ZF++++XF]--XF"},
{"F", ""}
};
Lsystem Penrose=Lsystem("[X][Y]++[X][Y]++[X][Y]++[X][Y]++[X][Y]",rules,La=36);
Penrose.iterate(3);
draw(Penrose.paths(), linewidth(bp));
shipout(bbox(2mm, FillDraw(lightyellow,linewidth(1mm))));
|
|
|
Figure 0023: fig0230.asy (Compiled with Asymptote version 1.86svn-r4626) |
/*Inspirtaion*/
import Lsystem;
size(10cm,10cm);
settings.outformat="pdf"; // for opacity
string[][] rules=new string[][]{{"F", "FF-[-F+F+F]+[+F-F-F]"}};
Lsystem plant=Lsystem("F", rules, La=22.5, Lai=90);
plant.iterate(5);
path[] g=plant.paths();
tree g=plant.tree();
for (int i:g.keys) {
if((g[i].depth == 0)) draw(g[i].g, yellow);
}
for (int i:g.keys) {
if((g[i].depth > 0 )) draw(g[i].g, green+opacity(0.5));
}
for (int i:g.keys) {
if((g[i].depth > 15)) draw(g[i].g, brown+opacity(0.3));
}
shipout(bbox(Fill(paleyellow)));
|
|
|
Figure 0024: fig0240.asy (Compiled with Asymptote version 1.84svn-r4619) |
/*Inspirtaion*/
import Lsystem;
size(10cm,10cm);
settings.outformat="pdf"; // for opacity
string[][] rules=new string[][]{{"F", "FF"},{"X", "F-[[X]+X]+F[+FX]-X"}};
Lsystem plant=Lsystem("X", rules, La=22.5, Lai=90);
plant.iterate(8);
path[] g=plant.paths();
tree g=plant.tree();
for (int i:g.keys) {
if((g[i].depth <= 2 )) draw(g[i].g, yellow);
}
for (int i:g.keys) {
if((g[i].depth > 2 ) && (g[i].depth <= 10 )) draw(g[i].g, green+opacity(0.5));
}
for (int i:g.keys) {
if((g[i].depth > 11)) draw(g[i].g, brown+opacity(0.3));
}
shipout(bbox(Fill(paleyellow)));
Dernière modification/Last modified: Sun Sep 20 18:48:54 CEST 2009
Philippe Ivaldi