chiark / gitweb /
helixish: debugging output, some bodges re color handling weirdness
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Dec 2017 11:42:33 +0000 (11:42 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Dec 2017 11:42:33 +0000 (11:42 +0000)
It seems that ring() ignores the color if it is in kw, but not
if it is a separate parameter.  WTF.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
moedebug.py
visual

index 94eaa58153c646519282641299c45dd0e60a7658..226983177c6416770eda221da7bb9c8b9eae969e 100644 (file)
@@ -26,7 +26,7 @@ class BaseVisdebug():
   def basis(vd, basis, hue=(1,1,1)):
     for ax in range(0,3):
       vd.arrow(basis[0:3,3], basis[0:3,ax],
-               colour= [ c * (1.0 - ax*0.2) for c in hue ])
+               color= tuple([ c * (1.0 - ax*0.2) for c in hue ]))
 
 class NullVisdebug():
   def curve(*a, **kw): pass
diff --git a/visual b/visual
index 9f98ad72d86593af8270806e17558119f27db9ef..27c22eb234d7392fa972045b74d86b5902224616 100755 (executable)
--- a/visual
+++ b/visual
@@ -21,14 +21,18 @@ nv = 40
 nw = 40
 
 class Visdebug(BaseVisdebug):
-  def curve(vd, fn, colour=color.yellow):
+  def curve(vd, fn, color=color.yellow):
     # fn(t) => 3-tuple, 3-list, or similar, for t \elem [0,1]
     ps = [ fn(t) for t in np.linspace(0,1,11) ]
     #dbg('Visdebug', ps)
-    curve(pos = ps, color=colour)
+    curve(pos = ps, color=color)
   def arrow(vd, p, d, **kw):
-    vd.line(p, p+d, **kw)
-    ring(pos=p, axis=d, radius=0.25, thickness=0.005, **kw)
+    print('arrow %s' % repr(kw), file=sys.stderr)
+    bodge_color = kw.get('color', (1,0,0))
+    try: del kw['color']
+    except KeyError: pass
+    vd.line(p, p+d, color=bodge_color, **kw)
+    ring(pos=p, axis=d, radius=0.25, thickness=0.005, color=bodge_color, **kw)
   def crashing(vd, msg):
     print("CRASHING - VISDEBUG", msg, file=sys.stderr)
     rate(1E-8)