PIPRIME.FR BLOG

Live fully to honor life

Tag Margin -- Asymptote Gallery

đź”—generalities-fig088

Figure generalities 088 Generated with Asymptote

Show generalities/fig0880.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Defaultpen | #Point/Dot | #Transform/scale/shift/rotate | #Arrows/Bars | #Margin

size(0,0);
pair A=(0,0), B=(4cm,0);
path line=A--B;
transform TD=shift(0,-cm);
transform TR=shift(2.5cm,0);

defaultpen(linewidth(3bp));

draw("$AB$",line,.8red,Arrows(3mm));  
draw("$A$",A,N); draw("$B$",B,N);

draw("$AB$",TD*line,.8red,Arrows(3mm),PenMargins);  
draw("$A$",TD*A,N); draw("$B$",TD*B,N);

draw("$AB$",TD^2*line,.8red,Arrows(3mm),DotMargins);  
dot("$A$",TD^2*A,dotfactor*NW); dot("$B$",TD^2*B,dotfactor*NE);

margin BigMargins=Margin(2,2);
draw("$AB$",TD^3*line,.8red,Arrows(3mm),BigMargins);  
draw("$A$",TD^3*A,N); draw("$B$",TD^3*B,N);

đź”—generalities-fig089

Figure generalities 089 Generated with Asymptote

Show generalities/fig0890.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Deferred drawing | #Arrows/Bars | #Labelmargin | #Margin | #Picture

//From documentation of Asymptote
size(6cm, 0);

void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0, pen p=currentpen)
{
  real d=3mm;
  guide g=A--B;
  transform T=shift(-n*d*unit(B-A)*I);
  pic.add(new void(frame f, transform t) {
    picture opic;
    guide G=T*t*g;
    draw(opic, G, p, Arrows(NoFill), Bars, PenMargins);
    label(opic, L, midpoint(G), UnFill(1));
    add(f, opic.fit());
  });
  pic.addBox(min(g), max(g), T*min(p), T*max(p));
}

pair A=(0, 0), B=(3, 3);

dot(A);
dot(B);
distance(A, B, Label("$\ell$", Rotate(dir(A--B))), 1);

đź”—generalities-fig166

Figure generalities 166 Generated with Asymptote

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

size(10cm,0);

path apath=(0,0)..(1,1)..(2,.5){dir(0)};
real l=arclength(apath);
real step=l/15;

path arcpath(path apath, real t1, real t2)
{
  return subpath(apath, arctime(apath,t1), arctime(apath,t2));
}

for(real i=0; i<l-step; i+=step)
  draw(arcpath(apath,i,i+step),4bp+(i/l*red+(l-i)/l*blue),PenMargins);
draw(apath);

0%