From d098b61b3a478ecfff63be5891b82ca01d1e0af1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Dec 2017 11:42:33 +0000 Subject: [PATCH] helixish: debugging output, some bodges re color handling weirdness 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 --- moedebug.py | 2 +- visual | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/moedebug.py b/moedebug.py index 94eaa58..2269831 100644 --- a/moedebug.py +++ b/moedebug.py @@ -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 9f98ad7..27c22eb 100755 --- 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) -- 2.30.2