summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/dimension.asy
blob: 1244ba84e68c3bdc9a4dbb8183b5025a40c4863d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
size(12cm,0); 
 
void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0,
              pen p=currentpen) 
{
  real d=3mm;
  path g=A--B;
  transform T=shift(-n*d*unit(B-A)*I);
  pic.add(new void(frame f, transform t) {
      picture opic;
      path G=T*t*g;
      draw(opic,Label(L,Center,UnFill(1)),G,p,Arrows(NoFill),Bars,PenMargins); 
      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,"$\ell$",1);