chiark / gitweb /
better with more bendingness costs
[moebius2.git] / mgraph.c
index 46c7533827b1445c2498773106301e2898a94f47..1e9cef0786e16c3fc6cafa464dfa4e67cb1922e8 100644 (file)
--- a/mgraph.c
+++ b/mgraph.c
@@ -8,7 +8,7 @@ static const unsigned dx[2][V6]= {{  +1,   0,  -1,  -1,  -1,   0  },
                                  {  +1,  +1,   0,  -1,   0,  +1  }},
                       dy[V6]=     {   0, -Y1, -Y1,   0, +Y1, +Y1  };
 
-int edge_end2(unsigned v1, int e) {
+static int edge_end2(unsigned v1, int e) {
   unsigned x, y;
 
   y= (v1 & ~XMASK) + dy[e];
@@ -25,6 +25,15 @@ int edge_end2(unsigned v1, int e) {
   return x | y;
 }
 
+short edge_end2_memo[N][V6];
+
+void mgraph_prepare(void) {
+  int v, e;
+  FOR_VERTEX(v, INNER)
+    FOR_VPEDGE(e)
+      edge_end2_memo[v][e]= edge_end2(v,e);
+}
+
 static const unsigned reverse[2][V6]= {{ 3, 4, 5, 0, 1, 2 },
                                       { 3, 2, 1, 0, 5, 4 }};