X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=mgraph.h;h=e3079787033836ff8845816f94c5825a9a51afb5;hb=04d38304c34c5cac06e7fed4c20e3fe108330b7b;hp=acbe5c4b277b39a2c8b92aff3957c1978aae7f26;hpb=47850b1d988483f5939b5bdb4a3bd60604f6930c;p=moebius2.git diff --git a/mgraph.h b/mgraph.h index acbe5c4..e307978 100644 --- a/mgraph.h +++ b/mgraph.h @@ -4,43 +4,57 @@ /* * Vertices in strip are numbered as follows: * - * ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 __ - * Y-1 Y-1 0 0 0 0 0 + * | + * ___ X-2 ___ X-1 ___| 0 ___ 1 ___ 2 ___ 3 ___ 4 __ + * Y-1 Y-1 |0 0 0 0 0 * / \ / \ / \ / \ / \ / \ / \ - * / \ / \ / \ / \ / \ / \ / \ - * X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 ___ 4 - * Y-2 Y-2 Y-2 1 1 1 1 1 - * \ / \ / \ / \ / \ / \ / \ / + * / \ / \ /| \ / \ / \ / \ / \ + * X-3 ___ X-2 ___ X-1|___ 0 ___ 1 ___ 2 ___ 3 ___ 4 + * Y-2 Y-2 Y-2| 1 1 1 1 1 + * \ / \ / \| / \ / \ / \ / \ / * \ / \ / \ / \ / \ / \ / \ / - * ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 __ - * Y-3 Y-3 Y-3 2 2 2 2 - * - * . . . . . . . . . . . . . . . - * - * X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 ___ 3 - * 1 1 1 1 Y-2 Y-2 Y-2 Y-2 - * \ / \ / \ / \ / \ / \ / \ / - * \ / \ / \ / \ / \ / \ / \ / - * ___ X-4 ___ X-3 ___ X-2 ___ X-1 ___ 0 ___ 1 ___ 2 __ - * 0 0 0 0 Y-1 Y-1 Y-1 + * ___ X-2 ___ X-1 ___| 0 ___ 1 ___ 2 ___ 3 __ 4 ___ + * Y-3 Y-3 |2 2 2 2 2 + * / \ / \ / \ / \ / \ / \ / \ + * / \ / \ /| \ / \ / \ / \ / \ + * X-3 ___ X-2 ___ X-1|___ 0 ___ 1 ___ 2 ___ 3 ___ 4 + * Y-4 Y-4 Y-4| 3 3 3 3 3 + * | + * . . . . .| . . . . . . . . . . + * | + * ___ X-2 ___ X-1 ___| 0 ___ 1 ___ 2 ___ 3 ___ 4 ___ + * 2 2 |Y-3 Y-3 Y-3 Y-3 Y-3 + * / \ / \ / \ / \ / \ / \ / \ + * / \ / \ /| \ / \ / \ / \ / \ + * __ X-2 ___ X-1|___ 0 ___ 1 ___ 2 ___ 3 ___ 3 ___ 4 + * 1 1 | Y-2 Y-2 Y-2 Y-2 Y-2 Y-2 + * / \ / \ / \| / \ / \ / \ / \ / + * / \ / \ / \ / \ / \ / \ / \ / + * -3 ___ X-2 ___ X-1 ___| 0 ___ 1 ___ 2 ___ 3 ___ 4 ___ + * 0 0 0 |Y-1 Y-1 Y-1 Y-1 Y-1 + * | + * ^ join, where there is + * a discontinuity in numbering * * Node x,y for - * 0 <= x < X x = distance along - * 0 <= y < Y y = distance across + * 0 <= x < X = 2^XBITS x = distance along + * 0 <= y < Y = 2^YBITS-1 y = distance across * * Vertices are in reading order from diagram above ie x varies fastest. * - * Y must be even. The actual location opposite (0,0) is (X-(Y-1)/2,0), - * and likewise opposite (0,Y-1) is ((Y-1)/2,0). + * Note that though presentation above is equilateral triangles, this + * is not the case. It's actually a square lattice with half of the + * diagonals added. We can't straighten it out because at the join + * the diagonals point the other way! * * We label edges as follows: * - * e: \2 /1 - * \ / - * ___ 0 __ - * 3 1 0 - * / \ - * 4/ 5\ + * \2 /1 + * \ / + * ___ 0 __ + * 3 1 0 + * / \ + * 4/ 5\ */ #ifndef MGRAPH_H @@ -48,10 +62,10 @@ #include "common.h" -#define XBITS 3 +#define XBITS 6 /*3*/ #define X (1<