* -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: Or in the square view:
+ * We label edges as follows:
*
- * \2 /1 2 1
- * \ / | /
- * ___ 0 __ |/
- * 3 1 0 3--*--0
- * / \ /|
- * 4/ 5\ / |
- * 4 5
- *
- * (This makes the numbering
- * discontinuity, at the join,
- * vertical and thus tractable.)
+ * \2 /1
+ * \ /
+ * ___ 0 __
+ * 3 1 0
+ * / \
+ * 4/ 5\
*/
#ifndef MGRAPH_H
#include "common.h"
-#define DIMBITS 4
-
-#define XBITS DIMBITS
+#define XBITS 3
#define X (1<<XBITS)
-#define YBITS DIMBITS
+#define YBITS 3
#define Y ((1<<YBITS) - 1)
/* vertex number: 0000 | y | x