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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
input umrand
def wood(expr W) =
beginchar(incr nextchar,charsize#,charsize#,0cm#);
pickup pencircle scaled penwid;
xscal:=1;
u:=w/10; v:=h/20; ab:=0;
x0=x1=0+ab;
x2=x3=x4=x5=x6=u+ab;
x7=x8=x9=x10=x11=x12=2u+ab;
x13=x14=x15=3u+ab;
x16=x17=x18=x19=4u+ab;
x20=x21=x22=5u+ab;
x23=x24=x25=6u+ab;
x26=7u+ab; x27=8u+ab;
x28=x29=10u+ab;
y2=20v; y0=19v; y3=16v;
y7=y16=15v; y13=y20=14v;
y8=13v; y21=12v;
y9=y17=y23=y27=y28=11v;
y4=y14=y26=10v;
y18=y24=y29=9v;
y5=8v; y10=y19=y25=7v;
y15=y22=6v;
y11=5v; y12=3v; y1=v; y6=0v;
def WoodRotation(expr w,p) =
CenterRotation(w,
p if abs(abs(sind(w))-abs(cosd(w))) < eps:
shifted (2u,0)
fi)
enddef;
draw WoodRotation(W,z2--z0--z1--z6--z5--z15);
draw WoodRotation(W,z10--z12--z22--z19--z11);
draw WoodRotation(W,z0--z16--z8--z7--z13);
draw WoodRotation(W,z7--z3--z4--z9--z8);
draw WoodRotation(W,z4--z19--z18--z9--z20--z21--z14);
draw WoodRotation(W,z17--z18);
draw WoodRotation(W,z21--z22--z25--z24--z23--z21);
draw WoodRotation(W,z23--z26--z24);
draw WoodRotation(W,z20--z27--z26);
draw WoodRotation(W,z2--z28--z25);
draw WoodRotation(W,z28--z29--z6);
testbox; endchar;
enddef;
nextchar:=-1; % -1: we start first char width incr(-1) = 0!
wood(0);
end;
|