FIX: Newer versions of AsciiDoc renamed some files
[freefoam.git] / doc / UserGuide / images / tut_plateHole_block.asy
blobb9051a63df25220d3bea10af36ec435a368952dd
1 import graph;
3 usepackage("units");
4 settings.render = -2;
5 size(10cm);
7 // side length
8 real s = 2;
9 // radius of hole
10 real R = 0.5;
12 // 45 deg points on arcs for reuse
13 pair arcp1 = rotate(45)*(R,0);
14 pair arcp2 = rotate(45)*(2*R,0);
16 // index axes
17 path base_ax = (R/2,0)--(0,0)--(0,R/2);
18 path[] ax = {
19   shift(arcp1)*rotate(45)*base_ax,
20   shift((R,0))*base_ax,
21   shift((2*R,0))*base_ax,
22   shift(arcp2)*base_ax,
23   shift((0,2*R))*base_ax
26 // label positions for index axes
27 pair[][] idx_pos = {
28   {rotate(45)*2*SW, rotate(45)*2*SE},
29   {1.2*SW, 1.2*SE},
30   {1.2*SW, 1.2*SE},
31   {1.2*SW, 1.2*SE},
32   {1.2*SW, 1.2*SE},
35 // draw index axes
36 draw(arc((0,0), R, 0, 90), black);
37 draw(arc((0,0), 2*R, 0, 90), black);
38 draw(arcp1--arcp2, black);
39 draw((0,R)--(0,s)--(s,s)--(s,0)--(R,0), black);
40 draw(arcp2--(s,arcp2.y), black);
41 draw(arcp2--(arcp2.x,s), black);
43 // label index axes
44 for(int i=0; i<ax.length; ++i) {
45   draw(ax[i], black, Arrows);
46   label("$i_1$", point(ax[i],0), idx_pos[i][0]);
47   label("$i_2$", point(ax[i],2), idx_pos[i][1]);
50 // label blocks
51 pair[] label_pos = {
52   rotate(3/4*90)*(1.5*R,0),
53   rotate(1/4*90)*(1.5*R,0),
54   ((2*R+s), arcp2.y)/2,
55   (arcp2+(s,s))/2,
56   ((0,2*R)+(arcp2.x,s))/2
58 for(int i=0; i < label_pos.length; ++i) {
59   label(format("$%d$", i), label_pos[i]);
60   draw(circle(label_pos[i], 0.07), black);
63 // put crosses on arcs
64 label("$\times$", rotate(-22.5)*arcp1);
65 label("$\times$", rotate(22.5)*arcp1);
66 label("$\times$", rotate(-22.5)*arcp2);
67 label("$\times$", rotate(22.5)*arcp2);
69 // label corners
70 pair[][] corners = {
71   {(R,0), S},
72   {(2*R,0), S},
73   {(s,0), S},
74   {(s,arcp2.y), E},
75   {arcp2, 2*W},
76   {arcp1, SW},
77   {(s,s), NE},
78   {(arcp2.x,s), N},
79   {(0,s), NW},
80   {(0,2*R), W},
81   {(0,R), W}
84 for(int i=0; i<corners.length; ++i) {
85   label(format("$%d$",i), corners[i][0], corners[i][1]);
88 // label patches
89 label("down", (corners[0][0]+corners[1][0])/2, 5*S);
90 label("down", (corners[1][0]+corners[2][0])/2, S);
91 label("right", (corners[2][0]+corners[3][0])/2, E);
92 label("right", (corners[3][0]+corners[6][0])/2, E);
93 label("up", (corners[6][0]+corners[7][0])/2, N);
94 label("up", (corners[7][0]+corners[8][0])/2, N);
95 label("left", (corners[8][0]+corners[9][0])/2, W);
96 label("left", (corners[9][0]+corners[10][0])/2, W);
97 label("hole", arcp1, 4*SW);
99 // draw coordinate axes
100 draw(base_ax, black, Arrows);
101 label("$x$", point(base_ax,0), 2*SW);
102 label("$y$", point(base_ax,2), 2*SE);