PIPRIME.FR BLOG

Live fully to honor life

Tag Fill/Unfill -- Asymptote Gallery

đź”—animations-fig015

Show animations/fig0160.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Animation
Tags : #Morphing | #Fill/Unfill | #Pen | #Animation

import graph_settings;
import animate;
size(16cm);

pair[] interp(pair[] a1, pair[] a2, real k)
{
  if(a1.length != a2.length) abort("interp: arrays have differents length.");
  pair[] g;
  int l=a1.length;
  g=sequence(new pair(int j){
      return interp(a1[j], a2[j], k);
    }, l);
  return g;
}

path morphing(pair[] a1, pair[] a2, real k, interpolate join=operator --)
{
  if(a1.length != a2.length) abort("morphing: arrays have differents length.");
  return join(...interp(a1, a2, k));
}

pair[] nodes(path g, int n)
{
  int np=round(n/length(g));
  n=np == 0 ? n : np*length(g);
  return sequence(new pair(int i){return point(g, length(g)*i/n);}, n);
}

animation A;

int nbpt=4;
pair[] A1=nodes(unitsquare, nbpt);
path g=(0, 0)--(1, 0)--(0, 1)--(1, 1)--cycle;
pair[] A2=shift(2, 1)*rotate(25)*nodes(g, nbpt);
interpolate join=operator ..;
// interpolate join=operator --;


int n=40;
real step=1/n;
pen p1=0.8*red, p2=0.8*blue;

filldraw(join(morphing(A1, A2, 0, join), cycle), p1);
filldraw(join(morphing(A1, A2, 1, join), cycle), p2);

for (int i=0; i <= n; ++i) {
  save();
  filldraw(join(morphing(A1, A2, i*step, join), cycle), opacity(0.5)+interp(p1, p2, i*step));
  A.add();
  restore();
}

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

đź”—animations-fig016

Show animations/fig0170.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Animation
Tags : #Morphing | #Fill/Unfill | #Pen | #Animation

import graph;
import animate;
size(15cm);

pair[] interp(pair[] a1, pair[] a2, real k)
{
  if(a1.length != a2.length) abort("interp: arrays have differents length.");
  pair[] g;
  int l=a1.length;
  g=sequence(new pair(int j){
      return interp(a1[j],a2[j],k);
    },l);
  return g;
}

path morphing(pair[] a1, pair[] a2, real k, interpolate join=operator --)
{
  if(a1.length != a2.length) abort("morphing: arrays have differents length.");
  return join(...interp(a1, a2, k));
}

pair[] nodes(path g, int n)
{
  int np=round(n/length(g));
  n=np == 0 ? n : np*length(g);
  return sequence(new pair(int i){return point(g, length(g)*i/n);}, n);
}

animation A;

real f(real t){ return exp(cos(t))-2*cos(4*t)+sin(t/12)^5;}
path gf=polargraph(f,0,12*pi,1000);

int nbpt=1000;
pair[] A1=nodes(scale(5.5)*unitcircle,nbpt);
pair[] A2=shift(0,0)*nodes(gf,nbpt);
interpolate join=operator --;


int n=50;
real step=1/n;
pen p1=0.8*red, p2=0.8*blue;

for (int i=0; i <= n; ++i) {
  save();
  filldraw(join(morphing(A1,A2,1,join),cycle),
           evenodd+p2);
  filldraw(join(morphing(A1,A2,i*step,join),cycle),
           evenodd+interp(p1,p2,i*step));
  A.add();
  restore();
}

int l = A.pictures.length;
for (int i=1; i <= l; ++i) {
  A.add(A.pictures[l-i]);
}

A.movie(BBox(3mm, 3bp+miterjoin+black, FillDraw(lightyellow)));

đź”—generalities-fig039

Figure generalities 039 Generated with Asymptote

Show generalities/fig0390.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

path line=(0,0)--(5cm,0);

draw(line,Arrow(20bp,filltype=NoFill));
draw(shift(0,-cm)*line,Arrow(20bp,filltype=FillDraw(.8red)));
draw(shift(0,-2cm)*line,Arrow(20bp,filltype=Fill(.8red)));
draw(shift(0,-3cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đź”—generalities-fig040

Figure generalities 040 Generated with Asymptote

Show generalities/fig0400.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

DefaultHead=HookHead;
path line=(0,0)--(5cm,0);

draw(line,Arrow(20bp,filltype=NoFill));
draw(shift(0,-cm)*line,Arrow(20bp,filltype=FillDraw(.8red)));
draw(shift(0,-2cm)*line,Arrow(20bp,filltype=Fill(.8red)));
draw(shift(0,-3cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đź”—generalities-fig041

Figure generalities 041 Generated with Asymptote

Show generalities/fig0410.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

DefaultHead=TeXHead;
path line=(0,0)--(5cm,0);

draw(line,Arrow(10bp,filltype=NoFill));
draw(shift(0,-2cm)*line,Arrow(10bp,filltype=FillDraw(.8red)));
draw(shift(0,-4cm)*line,Arrow(10bp,filltype=Fill(.8red)));
draw(shift(0,-6cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đź”—generalities-fig043

Figure generalities 043 Generated with Asymptote

Show generalities/fig0430.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position | #Fill/Unfill

size(5cm,0);
path line=(0,0)--(5,0);

draw(line,Arrow(20bp,position=.75));
draw(shift(0,-2)*line,Arrow(20bp,40,.75,filltype=NoFill));

position pos=BeginPoint;
pos.position=.75;
draw(shift(0,-4)*line,BeginArrow(20bp,pos));
draw(shift(0,-6)*line,BeginArrow(20bp,40,pos,filltype=NoFill));

đź”—generalities-fig045

Figure generalities 045 Generated with Asymptote

Show generalities/fig0450.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position | #Fill/Unfill

size(8cm,0);

path g = (0,0)--(1,0);
draw(g,Arrow(Relative(0.75)));
add(arrow(reverse(g), invisible, FillDraw(green,red), Relative(0.75)));

đź”—generalities-fig049

Figure generalities 049 Generated with Asymptote

Show generalities/fig0490.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

fill((0,0)--(0,6cm)--(6cm,0)--cycle, gray);

đź”—generalities-fig050

Figure generalities 050 Generated with Asymptote

Show generalities/fig0500.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

filldraw((0,0)--(0,6cm)--(6cm,0)--cycle,gray);

đź”—generalities-fig051

Figure generalities 051 Generated with Asymptote

Show generalities/fig0510.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

filldraw((0,0)--(0,6cm)--(6cm,0)--cycle, fillpen=gray, drawpen=linewidth(1mm) + 0.8 * red);

đź”—generalities-fig052

Figure generalities 052 Generated with Asymptote

Show generalities/fig0520.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Array | #Path

pen[][] p={{rgb(black)}, {rgb(.8red)}};

latticeshade((0,0)--(0,6cm)--(6cm,0)--cycle, p);

đź”—generalities-fig053

Figure generalities 053 Generated with Asymptote

Show generalities/fig0530.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Array

pen[][] p={{rgb(black),rgb(black)}, {rgb(red),rgb(green)}};

latticeshade((0,0)--(0,6cm)--(6cm,0)--cycle,p);

đź”—generalities-fig054

Figure generalities 054 Generated with Asymptote

Show generalities/fig0540.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading

size(8cm,0);

pen[][] p={{rgb(white),rgb(grey),rgb(black)},
    {red,green,blue},
    {cyan,magenta,yellow}};

latticeshade(unitsquare,p);

đź”—generalities-fig055

Figure generalities 055 Generated with Asymptote

Show generalities/fig0550.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading

size(8cm,0);
import palette;

real[][] v={{1,2},{3,4}};
pen[] Palette=Rainbow();

latticeshade(box((0,0),(1,1)),palette(v,Palette));

đź”—generalities-fig056

Figure generalities 056 Generated with Asymptote

Show generalities/fig0560.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Circle

size(8cm,0);

pair A=(0.35,0.35), B=(0.6,0.6);

radialshade(unitsquare,black,A,0.15,lightgrey,B,.6);

dot(A,.8red);
dot(B,blue+grey);
draw(shift(A)*scale(.15)*unitcircle,dashed+.8red);
draw(shift(B)*scale(.6)*unitcircle,dashed+blue+grey);
clip(unitsquare);

đź”—generalities-fig057

Figure generalities 057 Generated with Asymptote

Show generalities/fig0570.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Transform/scale/shift/rotate | #Direction

size(8cm,0);

transform t=xscale(1.25);
pen p1=blue, p2=yellow;
pair pa=t*dir(135), pb=t*dir(-45);

axialshade(t*unitcircle,p1,pa,p2,pb);
draw(pa--pb, dashed);

đź”—generalities-fig058

Figure generalities 058 Generated with Asymptote

Show generalities/fig0580.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Fill/Unfill | #Shading | #Arc | #Loop/for/while | #Transform/scale/shift/rotate

// Author: John Bowman
size(10cm,0);

real r=1;
real R=3.8;

int step=30;
path p=arc(0,r,0,step);
path P=arc(0,R,step,0);
for(int h=0; h < 360; h += step) {
  transform t=rotate(90-h);
  tensorshade(t*p--t*P--cycle,
              new pen[] {white,white,hsv(h-step,1,1),hsv(h,1,1)});
}

for(int h=0; h < 360; h += 30) {
  pair v=R*dir(90-h);
  draw(Label(string(h)+"$^\circ$",EndPoint),(v--1.05v));
}

draw(circle(0,r));
draw(circle(0,R));

đź”—generalities-fig059

Figure generalities 059 Generated with Asymptote

Show generalities/fig0590.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Shading | #Tex/latex features | #Texpath | #Fill/Unfill | #Array

size(16cm,0);

path[] P=texpath("$\displaystyle\int_{-\infty}^{+\infty}e^{-\alpha x^2}\,dx=
\sqrt{\frac{\pi}{\alpha}}$");
pair m=min(P), M=max(P);

axialshade(P,yellow,m,red,(m.x,M.y));
draw(P,0.5*blue);
shipout(bbox(3mm,Fill));

đź”—generalities-fig060

Figure generalities 060 Generated with Asymptote

Show generalities/fig0600.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Path

size(8cm,0);

pair A, B, C, D;
A=(0,0); B=(1,0);
C=(1,1); D=(0,1);
fill(A--C--B--D--cycle,grey);

đź”—generalities-fig061

Figure generalities 061 Generated with Asymptote

Show generalities/fig0610.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Path

size(8cm,0);

pair A, B, C, D;
A=(0,0); B=(1,0);
C=(1,1); D=(0,1);
filldraw(A--C--B--D--cycle,grey);

đź”—generalities-fig062

Figure generalities 062 Generated with Asymptote

Show generalities/fig0620.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Opacity | #Fill/Unfill | #Circle | #Transform/scale/shift/rotate

size(10cm, 0);

path cle=unitcircle;

draw((-1.5, 0)--(2.5, 0), linewidth(10mm));
filldraw(cle, red+opacity(.5));
filldraw(shift((1, 0))*cle, blue+opacity(.5));

shipout(format="pdf");

đź”—generalities-fig076

Figure generalities 076 Generated with Asymptote

Show generalities/fig0760.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Transform/scale/shift/rotate | #Fill/Unfill

frame f;
label(f,"\textbf{Hello}",yellow,Fill(black));
add(scale(5)*rotate(45)*f);

đź”—generalities-fig077

Figure generalities 077 Generated with Asymptote

Show generalities/fig0770.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Transform/scale/shift/rotate | #Fill/Unfill

frame f;
filldraw(scale(5cm)*unitsquare, black);
label(f,"Hello", 0.8*red, Fill(white));
add(rotate(45) * scale(5) * f, (2.5cm,2.5cm));

đź”—generalities-fig083

Figure generalities 083 Generated with Asymptote

Show generalities/fig0830.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Align | #Basealign | #Fill/Unfill | #Position | #Transform/scale/shift/rotate

size(0,0);
path line=(0,0)--(6cm,0);
transform T=shift(0,-cm);

draw(Label("A",align=Center,filltype=UnFill), line);
draw(Label("B",UnFill), T*line, Center);
draw(Label("C",align=Center,position=Relative(.75),UnFill), T^2*line);
draw(Label("D",position=Relative(.25),UnFill), align=Center, T^3*line);

đź”—generalities-fig102

Figure generalities 102 Generated with Asymptote

Show generalities/fig1020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc

size(6cm,0);

real a=360/6;
for (int i = -1; i < 5; ++i)
  fill(arc((0,0),1,i*a,(i+1)*a)--cycle,grey);

đź”—generalities-fig103

Figure generalities 103 Generated with Asymptote

Show generalities/fig1030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc

size(6cm,0);

real n=7, a=360/n;
for (int i = 0; i < n; ++i)
  filldraw((0,0)--arc((0,0),1,i*a,(i+1)*a)--cycle, i/n*blue + (1-i/n)*green + grey);

đź”—generalities-fig104

Figure generalities 104 Generated with Asymptote

Show generalities/fig1040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc | #Label | #Number format | #Align

size(6cm,0);

real a=360/6;
for (int i = -1; i < 5; ++i)
  draw(Label(format("%i",i+1)),arc((0,0),10,i*a,(i+1)*a)--cycle,grey);

đź”—generalities-fig108

Figure generalities 108 Generated with Asymptote

Show generalities/fig1090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Picture

size(6cm,0);

pair A=0, B=(1,0), C=(.7,1);

void fillangle(picture pic=currentpicture,
	       pair O=0, pair A, pair B,
	       real radius=10,
	       pen p=grey)
{
  picture tpic;
  int n=sgn(radius);
  real a1=degrees(shift(-O)*A,false);
  real a2=degrees(shift(-O)*B,false);
  fill(tpic,(0,0)--arc((0,0), -radius, max(a1,a2), min(a1,a2),true)--cycle, p=p);
  add(pic,tpic,O);
}

draw(A--B--C--cycle);

real r1=15, r2=20;
fillangle(A,B,C,r1,.8red);
fillangle(A,B,C,-r2);
fillangle(B,A,C,r1,.8red);
fillangle(B,A,C,-r2);
fillangle(C,B,A,r1,.8red);
fillangle(C,B,A,-r2);

đź”—generalities-fig122

Figure generalities 122 Generated with Asymptote

Show generalities/fig1230.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Fill/Unfill

//From documentation of Asymptote
size(0,6cm);
guide center = (0,1){W}..tension 0.8..(0,0){(1,-.5)}..tension 0.8..{W}(0,-1); 

draw((0,1)..(-1,0)..(0,-1));
filldraw(center{E}..{N}(1,0)..{W}cycle);
unfill(circle((0,0.5),0.125));
fill(circle((0,-0.5),0.125));

đź”—generalities-fig156

Figure generalities 156 Generated with Asymptote

Show generalities/fig1570.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Array | #Loop/for/while | #Fill/Unfill | #Shading

size(0,0);

pair [] P, Q, R, S;
real u=2cm;

for (int i=0; i<=4; ++i)
  P[i] = rotate(i*360/5)*(0,-u);

P[5] = P[0];
for (int i=0; i<=4; ++i)
  Q[i] = 3*midpoint(P[i]--P[i+1]);

Q[5] = Q[0];
for (int i=0; i<=4; ++i)
  R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );

R[5] = R[0];
for (int i=0; i<=5; ++i)
  S[i] = 1.5*Q[i];

fill(shift(-abs(S[0]),-abs(S[0]))*scale(2*abs(S[0]))*unitsquare,.2grey);

radialshade(scale(abs(S[0]))*unitcircle,lightgrey,(0,0),abs(S[0]),
            black,(0,0),abs(.85*midpoint(S[0]--S[1])));

P[6]=P[1];
for (int i=0; i<=4; ++i)
  {
    radialshade(S[i]--Q[i]--R[i]--Q[i+1]--S[i+1]--cycle,
                lightgrey,(0,0),abs(R[i]),
                black,(0,0),abs(S[i]));
    radialshade(R[i]--Q[i+1]--R[i+1]--P[i+2]--P[i+1]--cycle,
                .8red,(0,0),sqrt(1-(2-2cos(pi/5))/4)*u,
                black,(0,0),abs(Q[i+1]));
  }

for (real i=1; i>0; i-=.05)
  fill(rotate(90*(1-i))*scale(i)*(P[0]--P[1]--P[2]--P[3]--P[4]--cycle),
       (1-i)*red);

pen p=linewidth(1pt);
for (int i=0; i<=4; ++i)
  {
    draw(P[i]   -- P[i+1],p);
    draw(P[i+1] -- R[i],p);
    draw(Q[i]   -- R[i],p);
    draw(R[i]   -- Q[i+1],p);
    draw(Q[i]   -- S[i],p);
    draw(S[i]   -- S[i+1],p);
  }

shipout(bbox(0,black+4mm));

đź”—generalities-fig175

Figure generalities 175 Generated with Asymptote

Show generalities/fig1760.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Graph | #Direction | #Path | #Fill/Unfill | #Shipout

import graph;
size(8cm,0);

path a = polargraph(new real(real t){return t;}, 0, 3pi, operator ..);
path b = polargraph(new real(real t){return 2t;}, 0, 3.75pi, operator ..);

real sharp=40;
path c=relpoint(a,1){relpoint(a,1)-postcontrol(a,length(a)-1)}..{dir(sharp)}relpoint(b,1);

fill(a..c..reverse(b)&cycle,0.8*red);
shipout(bbox(2mm, Fill(0.15*blue)));

đź”—generalities-fig189

Figure generalities 189 Generated with Asymptote

Show generalities/fig1910.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Buildcycle | #Transform/scale/shift/rotate | #Circle | #Fill/Unfill

size(8cm,0);

path a,b,c;
a = shift(1,0)*scale(2)*unitcircle;
b = rotate(120)*a;
c = rotate(120)*b;

fill(a, red);
fill(b, green);
fill(c, blue);
fill(buildcycle(a,b), red + green);
fill(buildcycle(b,c), green + blue);
fill(buildcycle(c,a), blue + red);
fill(buildcycle(a,b,c), white);

draw(a^^b^^c);

đź”—generalities-fig190

Figure generalities 190 Generated with Asymptote

Show generalities/fig1920.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Fill/Unfill

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;

filldraw(pt1^^pt2,yellow+.9white);

đź”—opacity-fig018

Figure opacity 018 Generated with Asymptote

Show opacity/fig0180.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity | #Layer | #Label | #Fill/Unfill | #Shipout | #Bbox | #Shading

size(4cm,0);
dotfactor*=5;

dot(scale(2)*"A",(0.5,1),5N);

layer();

dot(scale(2)*"B",(1.5,1),5N);
filldraw(scale(2)*unitsquare, lightgray+opacity(.5));

shipout(bbox(5mm,black,RadialShade(lightblue,darkblue)), "pdf");

đź”—opacity-fig019

Figure opacity 019 Generated with Asymptote

Show opacity/fig0190.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Opacity
Tags : #Opacity | #Fill/Unfill | #Shading

size(10cm,0);
transform T=rotate(10)*xscale(1.1);
path c1=T*unitcircle, c2=T*scale(5)*unitcircle;
real l1=length(c1), l2=length(c2);

fill(scale(8)*shift(-0.5,-0.5)*unitsquare,blue);
int n=500;
real step=1/n;
for (int i=0; i < n; ++i) {
  real t=i*step;
  path g1=subpath(c1,t*l1,(t+step)*l1);
  path g2=subpath(c2,t*l2,(t+step)*l2);
  pair A=(relpoint(c1,t)+relpoint(c2,t))/2;
  pair B=(relpoint(c1,t+step)+relpoint(c2,t+step))/2;
  path sector=g1--reverse(g2)--cycle;
  pen trans=opacity(((2-(2*i/n)^1.5))/2);
  axialshade(sector,trans+i/n*white,A,trans+(i+1)/n*white,B);
}
shipout(bbox(lightblue+white,Fill),format="pdf");

đź”—three-fig009

Figure three 009 Generated with Asymptote

Show three/fig0090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Plan | #Transform (3D) | #Projection (3D) | #Fill/Unfill | #Path3 | #Triple

size(10cm,0);
import three;

currentprojection=obliqueX;

triple v1=(4,0,0),
       v2=(0,6,0),
       p0=(-2,-3,0);
path3 pl1=plane(v1,v2,p0);

path ph=transform(v1,v2,p0,currentprojection)*((0,-2){W}..(0,2){W}..cycle);
filldraw(project(pl1)^^ph,evenodd+lightgrey);

đź”—tiling-fig007

Figure tiling 007 Generated with Asymptote

Author: Guillaume Connan.

Show tiling/fig0070.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Surveys | Tiling
Tags : #Tiling | #Transform | #Shipout | #Fill/Unfill

size(10cm,0);

void zigzag(int k)
{
  real t=180/k;
  pair o=(0,0), m=dir(t),
    n=rotate(180-2*t,m)*o,
    b=rotate(4*t-180,n)*m,
    c=rotate(180-6*t,b)*n,
    nn=reflect(o,b)*n;

  path lo=m--n--b--nn--cycle,
    p=o--m--n--b--c--cycle,
    pp=reflect(o,b)*p;

  for (int i=0; i <= k; ++i){
    filldraw(rotate(2*t*i,o)*p,.5*(red+blue));
    filldraw(rotate(2*t*i,o)*pp,0.25(red+blue));
    filldraw(rotate(2*t*i,o)*lo,(red+blue));
  }
}

zigzag(25);
shipout(bbox(3mm,2mm+miterjoin+black,FillDraw(0.5*blue)));

đź”—various-fig001

Figure various 001 Generated with Asymptote

Show various/fig0100.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Miscellaneous
Tags : #Loop/for/while | #Transform | #Fill/Unfill

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]);

đź”—various-fig002

Figure various 002 Generated with Asymptote

Show various/fig0200.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Miscellaneous
Tags : #Loop/for/while | #Fill/Unfill | #Basis | #Function (creating)

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));
  }

0%