summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples/clockarray.asy
blob: be7fd899a0e54151bc54ed9e27d4a9ef64203016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
int nx=3;
int ny=4;
real xmargin=1cm;
real ymargin=xmargin;

size(settings.paperwidth,settings.paperheight);

picture pic;
real width=settings.paperwidth/nx-xmargin;
real height=settings.paperheight/ny-ymargin;
if(width <= 0 || height <= 0) abort("margin too big");
size(pic,width,height);

pen p=linewidth(0.5mm);
draw(pic,unitcircle,p);

real h=0.08;
real m=0.05;

for(int hour=1; hour <= 12; ++hour) {
  pair z=dir((12-hour+3)*30);
  label(pic,string(hour),z,z);
  draw(pic,z--(1-h)*z,p);
}

for(int minutes=0; minutes < 60; ++minutes) {
  pair z=dir(6*minutes);
  draw(pic,z--(1-m)*z);
}

dot(pic,(0,0));

frame f=pic.fit();
pair size=size(f)+(xmargin,ymargin);

for(int i=0; i < nx; ++i)
  for(int j=0; j < ny; ++j)
    add(shift(realmult(size,(i,j)))*f);