chiark / gitweb /
helixish: remember to transform back from findcurve basis (!)
[moebius3.git] / helixish.py
index b1eac1ce34bab6881bd4f2cfb49205816a7e9466..27485eac5e965293e7311976f39466fef807ca08 100644 (file)
@@ -161,6 +161,7 @@ class HelixishCurve():
         def railway_ST(C, start, end, railway_r):
           delta = atan2(*(end - C)[0:2]) - atan2(*(start - C)[0:2])
           dbg('railway_ST C', C, 'start', start, 'end', end, 'delta', delta)
+          if delta < 0: delta += tau
           s = delta * railway_r
           dbg('railway_ST delta', delta, 'r', railway_r, 's', s)
           return s
@@ -168,8 +169,6 @@ class HelixishCurve():
         try_s = railway_ST(railway_CP, [0,0], railway_midpt, railway_r)
         try_t = railway_ST(railway_CP, railway_midpt, q_plane[0:2], railway_r)
         dbg('try_s, _t', try_s, try_t)
-        if try_s < 0 or try_t < 0:
-          continue
 
         try_st = try_s + try_t
         if best_st is None or try_st < best_st:
@@ -253,6 +252,7 @@ class HelixishCurve():
     findcurve_subproc.stdin.flush()
 
     hc.func = symbolic.get_python()
+    hc.findcurve_basis = findcurve_basis
     commentary = ''
 
     while True:
@@ -288,4 +288,5 @@ class HelixishCurve():
       ours[1] = sqrt(dist - hc.threshold)
     asmat = hc.func(*ours)
     p = asmat[:,0]
+    p = augmatmultiply(hc.findcurve_basis, p)
     return p