5 * Vertices in strip are numbered as follows:
7 * ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 __
9 * / \ / \ / \ / \ / \ / \ / \
10 * / \ / \ / \ / \ / \ / \ / \
11 * X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4
12 * Y-2 Y-2 Y-2 1 1 1 1 1
13 * \ / \ / \ / \ / \ / \ / \ /
14 * \ / \ / \ / \ / \ / \ / \ /
15 * ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 __
18 * . . . . . . . . . . . . . . .
20 * X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3
21 * 1 1 1 1 Y-2 Y-2 Y-2 Y-2
22 * \ / \ / \ / \ / \ / \ / \ /
23 * \ / \ / \ / \ / \ / \ / \ /
24 * ___ X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 __
28 * 0 <= x < X x = distance along
29 * 0 <= y < Y y = distance across
31 * Vertices are in reading order from diagram above ie x varies fastest.
33 * Y must be even. The actual location opposite (0,0) is (X-(Y-1)/2,0),
34 * and likewise opposite (0,Y-1) is ((Y-1)/2,0).
36 * We label edges as follows:
45 * (This numbering permits the order-4 nodes at the strip's edge
46 * to have a contiguous edge numbering 2..5 or 0..3.)
48 * When we iterate over edges, we iterate first over vertices and then
49 * over edges 0 to 2, disregarding edges 3 to 5.
60 /* vertex number: 0000 | y | x
67 #define Y1 (1 << YSHIFT)
68 #define YMASK (Y-1 << YSHIFT)
74 #define FOR_VERTEX(v) \
75 for ((v)=0; (v)<N; (v)++)
77 #define VE_MIN(v) ((v) & YMASK ? 0 : 2)
78 #define VE_MAX(v) (~(v) & YMASK ? V6 : 4)
80 #define FOR_VPEDGE(v,e) \
81 for ((e)=VE_MIN(v); (e)<VE_MAX(v); (e)++)
83 extern int edge_end2(unsigned v1, int e);
84 #define EDGE_END2 edge_end2
86 #define FOR_VEDGE_X(v1,e,v2,init,otherwise) \
87 FOR_VPEDGE((v1),(e)) \
88 if (((v2)= EDGE_END2((v1),(e)), \
90 (v2)) < 0) { otherwise } else
92 #define NOTHING ((void)0)
94 #define FOR_VEDGE(v1,e,v2) \
95 FOR_VEDGE_X(v1,e,v2,NOTHING,NOTHING)
97 #define FOR_EDGE(v1,e,v2) \
99 FOR_VEDGE((v1),(e),(v2))
101 #define FOR_COORD(k) \
102 for ((k)=0; (k)<D3; (k)++)
104 #define K FOR_COORD(k)
106 typedef double Vertices[N][D3];