chiark
/
gitweb
/
~ian
/
moebius2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
keystrokes
[moebius2.git]
/
mgraph.h
diff --git
a/mgraph.h
b/mgraph.h
index a33014b3dfe345f27c91a76758ab1b708cfaa8ae..08704894f7ab41841f11f44937a981f26c588a75 100644
(file)
--- a/
mgraph.h
+++ b/
mgraph.h
@@
-4,16
+4,16
@@
/*
* Vertices in strip are numbered as follows:
*
/*
* 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-3 ___ X-2 ___ X-1 ___
0 ___ 1 ___ 2 ___ 3
__
+ * Y-3 Y-3 Y-3
2 2 2 2
*
* . . . . . . . . . . . . . . .
*
*
* . . . . . . . . . . . . . . .
*
@@
-33,20
+33,24
@@
* 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).
*
* 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).
*
- * We label edges as follows:
+ * 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!
*
*
- * \0 /1
- * \ /
- * ___ 0 __
- * 2 1 3
- * / \
- * 4/ 5\
+ * We label edges as follows: Or in the square view:
*
*
- * (This numbering permits the order-4 nodes at the strip's edge
- * to have a contiguous edge numbering 2..5 or 0..3.)
+ * \2 /1 2 1
+ * \ / | /
+ * ___ 0 __ |/
+ * 3 1 0 3--*--0
+ * / \ /|
+ * 4/ 5\ / |
+ * 4 5
*
*
- * When we iterate over edges, we iterate first over vertices and then
- * over edges 0 to 2, disregarding edges 3 to 5.
+ * (This makes the numbering
+ * discontinuity, at the join,
+ * vertical and thus tractable.)
*/
#ifndef MGRAPH_H
*/
#ifndef MGRAPH_H
@@
-54,9
+58,11
@@
#include "common.h"
#include "common.h"
-#define XBITS 4
+#define DIMBITS 5
+
+#define XBITS DIMBITS
#define X (1<<XBITS)
#define X (1<<XBITS)
-#define YBITS
4
+#define YBITS
DIMBITS
#define Y (1<<YBITS)
/* vertex number: 0000 | y | x
#define Y (1<<YBITS)
/* vertex number: 0000 | y | x
@@
-76,11
+82,8
@@
#define FOR_VERTEX(v) \
for ((v)=0; (v)<N; (v)++)
#define FOR_VERTEX(v) \
for ((v)=0; (v)<N; (v)++)
-#define VE_MIN(v) ((v) & YMASK ? 0 : 2)
-#define VE_MAX(v) (~(v) & YMASK ? V6 : 4)
-
#define FOR_VPEDGE(v,e) \
#define FOR_VPEDGE(v,e) \
- for ((e)=
VE_MIN(v); (e)<VE_MAX(v)
; (e)++)
+ for ((e)=
0; (e)<V6
; (e)++)
extern int edge_end2(unsigned v1, int e);
#define EDGE_END2 edge_end2
extern int edge_end2(unsigned v1, int e);
#define EDGE_END2 edge_end2