Asymptote Generalities – fig0190

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 16 h 39 min

Figure 0019
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);
pair A,B,C;
A=(0,0);B=(1,0);C=(2,0);
draw(A,8bp+black);
draw(B,8bp+blue);
draw(C,linewidth(8bp));


Étiquettes : , ,


Asymptote Generalities – fig0200

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 17 h 39 min

Figure 0020
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(cm);
pair A=(0,0), B=(1,0), C=(0,1);
path trig;
trig=A--B--C--cycle;
draw(trig);
dot(trig,linewidth(4bp));
dot(shift(3,0)*trig,red+4bp);

Étiquettes : , , , , ,


Asymptote Generalities – fig0230

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 20 h 39 min

Figure 0023
(Compiled with Asymptote version 2.14svn-r5318)
    
size(2cm,0);
pair A=(0,0), B=(1,0), C=(0,1);
draw(A--B--C--cycle);
draw(A--B,linewidth(4bp));

Étiquettes : , ,


Asymptote Generalities – fig0240

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 21 h 39 min

Figure 0024
(Compiled with Asymptote version 2.14svn-r5318)
    
size(2cm,0);
pair A=(0,0), B=(1,0), C=(0,1);
draw(A--B--C--cycle);
draw(A--B,(red+green));

Étiquettes : , ,


Asymptote Generalities – fig0250

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 22 h 39 min

Figure 0025
(Compiled with Asymptote version 2.14svn-r5318)
    
size(2cm,0);
pair A=(0,0), B=(1,0), C=(0,1);

draw(A--B,.8white+6bp);
draw(A--C,.6white+6bp);
draw(B--C,.4white+6bp);

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

Étiquettes : , ,


Asymptote Generalities – fig0260

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 23 h 39 min

Figure 0026
(Compiled with Asymptote version 2.14svn-r5318)
    
size(4cm,0);

path p1=(0,0)--(1,1);
path p2=(2,0)--(3,1);

draw(p1,linewidth(5mm));
draw(p2,linewidth(5mm));
draw(p1--p2,3mm+.8blue);
draw(reverse(p1)--p2,1mm+.8red);

Étiquettes : , ,


Asymptote Generalities – fig0280

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 1 h 39 min

Figure 0028
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(cm);
path line=(0,0)--(6,0);

draw(line,solid);
draw(shift(0,-1)*line,dotted);
draw(shift(0,-2)*line,dashed);
draw(shift(0,-3)*line,longdashed);
draw(shift(0,-4)*line,dashdotted);
draw(shift(0,-5)*line,longdashdotted);

Étiquettes : ,


Asymptote Generalities – fig0290

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 2 h 39 min

Figure 0029
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(1cm);
path line=(0,0)--(6,0);
pen my_pen=linetype("24 8 8 8");

draw(line,linetype("24 8 8 8"));
draw(shift(0,-1)*line,my_pen+.8red);
draw(shift(0,-2)*line,my_pen+.7green+4bp);
draw(shift(0,-3)*line,linetype("24 8 8 8",false)+.7blue+4bp);
draw(shift(0,-4)*line,linetype("24 8 8 8",true,false)+4bp);
draw(shift(0,-5)*line,linetype("24 8 8 8",false,false)+.5red+blue+4bp);

Étiquettes : ,


Asymptote Generalities – fig0470

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 20 h 39 min

Figure 0047
(Compiled with Asymptote version 2.14svn-r5318)
    
path line=(0,0)--(5cm,0);
transform T=shift(0,-cm);

draw(line,linewidth(1mm),Bars);
draw(T^2*line,Bars(5mm));
draw(T^3*line,linewidth(1mm),Bars(5mm));
draw(T^4*line,dotted+red,Bars);

Étiquettes : , ,


Asymptote using three.asy – fig0050

Category: Asymptote,Examples 3D,three.asyPh. Ivaldi @ 18 h 50 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
import three; import math;
size(8cm,0);
currentprojection=obliqueX;

real h=2;
triple A =(0,0,h), B=(h,0,0), C=(0,h,0), D=(0,0,0);
triple Ip=midpoint(A--C), J=midpoint(A--B);
triple K=shift((0,0,-0.25*h))*A;

triple M=interp(K,J,intersect(K,J,normal(new triple[]{B,C,D}),D));
triple Np=interp(K,Ip,intersect(K,Ip,normal(new triple[]{B,C,D}),D));

dot("$A$", A, align=Z);  dot("$B$", B, align=S);
dot("$C$", C, align=S);  dot("$D$", D, align=W);
dot("$I$", Ip, align=N); dot("$J$", J, align=W);
dot("$K$", K, align=NE); dot("$M$", M, align=SE);
dot("$N$", Np, align=S);

draw(A--B--C--cycle^^B--M^^C--Np^^J--M^^Ip--Np);
draw(A--D--C^^D--B^^J--K^^K--Ip, dashed);

Étiquettes : , , , ,


Asymptote using three.asy – fig0080

Category: Asymptote,Examples 3D,three.asyPh. Ivaldi @ 21 h 50 min

Figure 0008
(Compiled with Asymptote version 2.14svn-r5318)
    
import bsp;

typedef path3[] shape;

shape operator *(transform3 T, shape p){
  shape os;
  for(path3 g:p) os.push(T*g);
  return os;
}


path3 path(triple[] T){
  path3 P;
  for(triple i:T) P=P--i;
  return P;
}

void addshapes(face[] F, shape[] shp, pen drawpen=currentpen, pen fillpen=white)
{
  for(int i=0; i < shp.length; ++i)
    for(int j=0; j < shp[i].length; ++j) {
      path3 g=shp[i][j];
      picture pic=F.push(g);
      if(fillpen != nullpen) filldraw(pic,project(g),fillpen, drawpen);
      else draw(pic,project(g),drawpen);
      // filldraw(pic,g,currentlight.intensity(F[F.length-1].point)*fillpen, drawpen);
    }
}

shape cylinder(real R=1, real H=1, int n=18){
  shape Cyl;
  triple[] CTop;
  triple[] CBot;
  for(int i=0; i <= n; ++i)
    CBot.push((R*cos(2pi*i/n), R*sin(2pi*i/n),0));
  CTop = CBot+(0,0,H);
  for(int i=0; i < n; ++i)
    Cyl.push(CBot[i]--CBot[i+1]--CTop[i+1]--CTop[i]--cycle);

  path3 P=path(CBot)--cycle;
  Cyl.push(P);
  Cyl.push(shift(H*Z)*P);

  return Cyl;
}


size(10cm,0);

currentprojection=orthographic(1,1,1);

shape cyl1 = cylinder(R=1, H=2);

shape[] group={cyl1};

face[] hidden, visible;
addshapes(hidden, group, drawpen=linewidth(bp));
addshapes(visible, group, drawpen=dotted, fillpen=nullpen);
add(hidden);
add(visible);

shipout(format="pdf");

Étiquettes : , , ,


Asymptote using solids.asy – fig0030

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 4 h 56 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
// Author: John Bowman.
size(6cm,0);
import solids;
currentprojection=orthographic(0,10,5);

nslice=4*nslice;

revolution r=sphere(O,1);
draw(surface(r), lightgrey+opacity(0.75));

skeleton s;
r.transverse(s,reltime(r.g,0.6));
r.transverse(s,reltime(r.g,0.5));
draw(s.transverse.back,linetype("8 8",8));
draw(s.transverse.front);

r.longitudinal(s);
draw(s.longitudinal.front);
draw(s.longitudinal.back,linetype("8 8",8));

Étiquettes : , , , , , ,


Official Asymptote example – linetype

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 5 h 57 min

Figure 0125
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
void testline(real y) {
  draw((0,y)--(100,y),currentpen+solid);
  draw((0,y-10)--(100,y-10),currentpen+dotted);
  draw((0,y-20)--(100,y-20),currentpen+dashed);
  draw((0,y-30)--(100,y-30),currentpen+longdashed);
  draw((0,y-40)--(100,y-40),currentpen+dashdotted);
  draw((0,y-50)--(100,y-50),currentpen+longdashdotted);
  draw((0,y-60)--(100,y-60),currentpen+Dotted);
} 

currentpen=linewidth(0.5);
testline(100);


Étiquettes : , ,