chiark / gitweb /
bugfixes to view-cyclicly
[moebius2.git] / half.h
1 /*
2  * During the actual optimisation we constrain it to be symmetrical.
3  * That means we have half as many vertices.  We process the vertices
4  * with X >=0.
5  *
6  * We conventionally suffix all of our variables, macros, constants,
7  * etc., with `h', to represent the double-prime ".
8  *
9  * Vertices with x==0 are special as they lie on the symmetry axis:
10  * all but one of the coordinates are fixed.  We do not offer those
11  * coordinates to our optimisation algorithm.
12  *
13  * We provide to the rest of the program just:
14  *    NH                   number of vertices"
15  *    VH2V(v)              maps a v" to the representative vertex number v
16  *    FOR_VERTEX_H(vh,v)   iterates over v", computing each v
17  *    DIM                  dimensionality of coordinate space
18  *    [un]map_dimensions   maps double[DIM] to Vertices and back
19  */
20
21 #ifndef HALF_H
22 #define HALF_H
23
24 #include "mgraph.h"
25
26 #define NH (N/2)
27 #define VH2V(v) ((v<<1) & YMASK | v & (XMASK>>1))
28 #define FOR_VERTEX_H(vh,v) \
29   for ((vh)=0; (v)= VH2V((vh)), (vh) < NH; (vh)++)
30
31 #define HALF_DEGRADED_NVERTICES ((Y+1)/2)
32 #define DIM (NH*D3 + HALF_DEGRADED_NVERTICES*(1-D3) + ((Y+1)/2)*D3)
33
34 void unmap_dimensions(double metavertex[DIM], const struct Vertices *in);
35 void map_dimensions(const double metavertex[DIM], Vertices out);
36 void pmap_dimensions(const struct Vertices *vs);
37
38 #endif /*HALF_H*/