L-System with Asymptote – fig0010

Category: Asymptote,L-SystemPh. Ivaldi @ 19 h 40 min

Figure 0001
(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)));

Étiquettes : ,


L-System with Asymptote – fig0020

Category: Asymptote,L-SystemPh. Ivaldi @ 20 h 40 min

Figure 0002
(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)));


Étiquettes : ,


L-System with Asymptote – fig0030

Category: Asymptote,L-SystemPh. Ivaldi @ 21 h 40 min

Figure 0003
(Compiled with Asymptote version 1.84svn-r4619)
    
/* Source */
import Lsystem;
size(10cm,0);

Lsystem SierpinskiCarpet=
  Lsystem("F+F+F+F",
          new string[][]{{"F","FF+F+F+F+FF"}},
          La=90, Lai=0);
SierpinskiCarpet.iterate(4);
draw(SierpinskiCarpet.paths(), bp+0.2*green);

shipout(bbox(Fill(paleyellow)));

Étiquettes : ,


L-System with Asymptote – fig0040

Category: Asymptote,L-SystemPh. Ivaldi @ 22 h 40 min

Figure 0004
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;

size(8cm,0);
Lsystem Koch=Lsystem("+F--F--F",
                     new string[][]{{"F","F+F--F+F"}},
                     La=60, Lai=0);
Koch.iterate(4);
filldraw(Koch.paths()[0]&cycle, paleyellow, 1bp+black);
shipout(bbox(2mm, Fill(lightyellow)));

Étiquettes : ,


L-System with Asymptote – fig0050

Category: Asymptote,L-SystemPh. Ivaldi @ 23 h 40 min

Figure 0005
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;

size(8cm,0);
Lsystem Koch=Lsystem("+F+F+F+F+F",
                     new string[][]{{"F","F-F++F-F"}},
                     La=72);
Koch.iterate(4);
filldraw(Koch.paths()[0]&cycle, paleyellow, 1bp+black);
shipout(bbox(2mm, Fill(lightyellow)));

Étiquettes : ,


L-System with Asymptote – fig0060

Category: Asymptote,L-SystemPh. Ivaldi @ 0 h 40 min

Figure 0006
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;

size(8cm,0);
Lsystem Koch=Lsystem("-F--F--F",
                     new string[][]{{"F","F-F++F-F"}},
                     La=60);
Koch.iterate(4);
filldraw(Koch.paths()[0]&cycle, paleyellow, 1bp+black);
shipout(bbox(2mm, Fill(lightyellow)));

Étiquettes : ,


L-System with Asymptote – fig0070

Category: Asymptote,L-SystemPh. Ivaldi @ 1 h 40 min

Figure 0007
(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)));

Étiquettes : ,


L-System with Asymptote – fig0080

Category: Asymptote,L-SystemPh. Ivaldi @ 2 h 40 min

Figure 0008
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;
size(8cm,0);

Lsystem HilbertCurve=Lsystem("X",
                             new string[][]{{"X","-YF+XFX+FY-"},{"Y","+XF-YFY-FX+"}},
                             La=90, Lai=0);
HilbertCurve.iterate(6);
draw(HilbertCurve.paths(), linewidth(1bp));

shipout(bbox(Fill(lightgrey)));

Étiquettes : ,


L-System with Asymptote – fig0090

Category: Asymptote,L-SystemPh. Ivaldi @ 3 h 40 min

Figure 0009
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;
size(8cm,0);

Lsystem Fass=Lsystem("-L",
                     new string[][]{{"L","LFLF+RFR+FLFL-FRF-LFL-FR+F+RF-LFL-FRFRFR+"},
                                    {"R","-LFLFLF+RFR+FL-F-LF+RFR+FLF+RFRF-LFL-FRFR"}},
                     La=90);
Fass.iterate(3);
draw(Fass.paths(), linewidth(1bp));

shipout(bbox(Fill(lightgrey)));

Étiquettes : ,


L-System with Asymptote – fig0100

Category: Asymptote,L-SystemPh. Ivaldi @ 4 h 40 min

Figure 0010
(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)));

Étiquettes : ,


L-System with Asymptote – fig0110

Category: Asymptote,L-SystemPh. Ivaldi @ 5 h 40 min

Figure 0011
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;
size(8cm,0);

string[][] rules={{"F","FF"},
                  {"H","+F+FH++FFH++F+FF+FH++FFH++F+F-"}};

Lsystem H=Lsystem("+H",rules, La=90);
H.iterate(5);
draw(H.paths(), white);

shipout(bbox(3mm, Fill(black)));

Étiquettes : ,


L-System with Asymptote – fig0120

Category: Asymptote,L-SystemPh. Ivaldi @ 6 h 40 min

Figure 0012
(Compiled with Asymptote version 1.84svn-r4619)
    
/*Source*/
import Lsystem;
size(10cm,0);

string[][] rules=new string[][]{{"F",""},{"X","-FX++FY-"},{"Y","+FX--FY+"}};
Lsystem dragon=Lsystem("X",rules, La=45, Lai=0);
dragon.iterate(12);
draw(dragon.paths(), white);

shipout(bbox(3mm, Fill(black)));

Étiquettes : ,


L-System with Asymptote – fig0130

Category: Asymptote,L-SystemPh. Ivaldi @ 7 h 40 min

Figure 0013
(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)));

Étiquettes : ,


L-System with Asymptote – fig0140

Category: Asymptote,L-SystemPh. Ivaldi @ 8 h 40 min

Figure 0014
(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)));

Étiquettes : ,


L-System with Asymptote – fig0150

Category: Asymptote,L-SystemPh. Ivaldi @ 9 h 40 min

Figure 0015
(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)));

Étiquettes : ,


L-System with Asymptote – fig0160

Category: Asymptote,L-SystemPh. Ivaldi @ 10 h 40 min

Figure 0016
(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)));

Étiquettes : ,


L-System with Asymptote – fig0170

Category: Asymptote,L-SystemPh. Ivaldi @ 11 h 40 min

Figure 0017
(Compiled with Asymptote version 1.84svn-r4619)
    
/* Source */
import Lsystem;
size(8cm,0);

string[][] rules={
  {"F", "F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF"},
  {"f", "ffffff"}
};

Lsystem oer=Lsystem("F+F+F+F",rules,La=91);

oer.iterate(2);
draw(oer.paths(), bp+0.8*yellow);
shipout(bbox(2mm, Fill(black)));

Étiquettes : ,


L-System with Asymptote – fig0180

Category: Asymptote,L-SystemPh. Ivaldi @ 12 h 40 min

Figure 0018
(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)));

Étiquettes : ,


L-System with Asymptote – fig0190

Category: Asymptote,L-SystemPh. Ivaldi @ 13 h 40 min

Figure 0019
(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)));

Étiquettes : ,


L-System with Asymptote – fig0200

Category: Asymptote,L-SystemPh. Ivaldi @ 14 h 40 min

Figure 0020
(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))));

Étiquettes : ,


L-System with Asymptote – fig0210

Category: Asymptote,L-SystemPh. Ivaldi @ 15 h 40 min

Figure 0021
(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))));

Étiquettes : ,


L-System with Asymptote – fig0220

Category: Asymptote,L-SystemPh. Ivaldi @ 16 h 40 min

Figure 0022
(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))));

Étiquettes : ,


L-System with Asymptote – fig0230

Category: Asymptote,L-SystemPh. Ivaldi @ 17 h 40 min

Figure 0023
(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)));

Étiquettes : ,


L-System with Asymptote – fig0240

Category: Asymptote,L-SystemPh. Ivaldi @ 18 h 40 min

Figure 0024
(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)));

Étiquettes : ,


Animation with Asymptote – fig0140

Category: Animation,AsymptotePh. Ivaldi @ 21 h 20 min

Figure 0014
(Compiled with Asymptote version 1.86svn-r4626)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
/*Inspiration*/
import Lsystem;
import animate;
animation A;
settings.tex="pdflatex";
settings.outformat="pdf";

size(10cm,0);

string[][] rules={{"A","[+BFA][-BFA][^BFA][&BFA]"}, {"B", "'(0.7071)"}};
Lsystem3 plant=Lsystem3("A", rules, La=45);
plant.iterate(5);
tree3 g=plant.tree3();

for (int angle=0; angle < 360; angle += 5) {
  currentprojection=orthographic(rotate(angle,Z)*(10,10,6));
  save();
  for (int i : g.keys)
    draw((path3)g[i], linewidth(bp)+(g[i].depth > 3 ? brown : 0.8*green));
  A.add();
  restore();
}

A.movie();

Étiquettes : ,


Animation with Asymptote – fig0150

Category: Animation,AsymptotePh. Ivaldi @ 22 h 20 min

Figure 0015
(Compiled with Asymptote version 1.86svn-r4626)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
/*Inspiration*/
import Lsystem;
import animate;

settings.tex="pdflatex";
settings.outformat="pdf";

animation A;
size(10cm,0);

string[][] rules={{"X","^<XF^<XFX-F^>>XFX&F+>>XFX-F>X->"}};
Lsystem3 HilbertCurve3D=Lsystem3("X", rules, La=90, Lai=0);
HilbertCurve3D.iterate(3);

path3[] g=HilbertCurve3D.paths3();
triple M=(max(g)+min(g))/2;
currentprojection=currentprojection=orthographic((10,10,6));

for (int angle=0; angle < 360; angle += 2) {
  save();
  draw(rotate(angle,M,M+Z)*g[0], linewidth(bp)+0.9*yellow);
  A.add();
  restore();
}

A.movie(BBox(3mm, Fill(black)));

Étiquettes : , ,