chiark / gitweb /
visdebug works now
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 27 Nov 2017 12:40:46 +0000 (12:40 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 27 Nov 2017 12:40:46 +0000 (12:40 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
helixish.py
symbolic.py
visual

index 910e3de1e2d8c42b465f0ae05f13bfc889a39272..eebe120b60e7aff2d1762058852938883168e9ef 100644 (file)
@@ -166,6 +166,8 @@ class HelixishCurve():
     print(*findcurve_input, file=findcurve_subproc.stdin)
     findcurve_subproc.stdin.flush()
 
+    hc.func = symbolic.get_python()
+
     while True:
       l = findcurve_subproc.stdout.readline()
       l = l.rstrip()
@@ -174,17 +176,19 @@ class HelixishCurve():
       l = eval(l)
       if l is None: break
 
-    hc.findcurve_result = l[0:5]
-    hc.func = symbolic.get_python(something)
-    hc.threshold = l[0]**2
-    hc.total_dist = hc.threshold + l[1]**2
+      hc.findcurve_result = l[0:6]
+      hc.threshold = l[0]**2
+      hc.total_dist = hc.threshold + l[1]**2
+      vdbg().curve( hc.point_at_t )
 
   def point_at_t(hc, normalised_parameter):
     dist = normalised_parameter * hc.total_dist
-    ours = [p for p in findcurve_result]
+    ours = list(hc.findcurve_result)
     if dist <= hc.threshold:
       ours[0] = sqrt(dist)
       ours[1] = 0
     else:
       ours[1] = sqrt(dist - hc.threshold)
-    return hc.func(*ours)
+    asmat = hc.func(*ours)
+    p = asmat[:,0]
+    return p
index 1c90bcacf28fbdfc0ab749954aacde18ac63dd88..ede36c4985289a1bc6282ed1ce3c334a6e224333 100644 (file)
@@ -3,11 +3,11 @@ from __future__ import print_function
 
 from sympy import *
 import itertools
+from sympy.utilities.lambdify import lambdify, implemented_function
+import numpy as np
 
 from moedebug import *
 
-from sympy.utilities.lambdify import lambdify, implemented_function
-
 r, theta, s, la, mu, kappa = symbols('r theta s lambda mu kappa')
 
 # start      original formulation
diff --git a/visual b/visual
index 95125e8fd99556ce99f86b6fdbb75c6c0dea5c97..89125319a990a76c8166ab87770e53316217035c 100755 (executable)
--- a/visual
+++ b/visual
@@ -19,7 +19,9 @@ nw = 40
 class Visdebug():
   def curve(vd, fn):
     # fn(t) => 3-tuple, 3-list, or similar, for t \elem [0,1]
-    curve(pos = [ list(fn(t)) for t in np.linspace(0,1,11) ])
+    ps = [ fn(t) for t in np.linspace(0,1,11) ]
+    dbg('Visdebug', ps)
+    curve(pos = ps)
   def crashing(vd, msg):
     print("CRASHING - VISDEBUG", msg, file=sys.stderr)
     rate(1E-8)