f.flush()
class BaseVisdebug():
- def line(vd, p0, p1):
- vd.curve(lambda t: p0 + t * (p1-p0))
- def arrow(vd, p, d):
- vd.line(p, p+d)
+ def line(vd, p0, p1, **kw):
+ vd.curve(lambda t: p0 + t * (p1-p0), **kw)
+ def arrow(vd, p, d, **kw):
+ vd.line(p, p+d, **kw)
class NullVisdebug():
def curve(*a, **kw): pass
def __init__(m, base, matrix):
m._b = base
m._matrix = matrix
- def curve(m, fn):
- m._b.curve(lambda t: moenp.augmatmultiply(m._matrix, fn(t)))
+ def curve(m, fn, **kw):
+ m._b.curve(lambda t: moenp.augmatmultiply(m._matrix, fn(t)), **kw)
def crashing(m, *a, **kw): m._b.crashing(*a, **kw)
_nullvis = NullVisdebug()
nw = 40
class Visdebug(BaseVisdebug):
- def curve(vd, fn):
+ def curve(vd, fn, colour=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=color.yellow)
+ curve(pos = ps, color=colour)
def crashing(vd, msg):
print("CRASHING - VISDEBUG", msg, file=sys.stderr)
rate(1E-8)