X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=visual;h=f0b9b49be253e60d5fc15507f11a86cdde57475a;hb=db59c229b019128b1c4d46bcc9ad61f06e7f2be9;hp=95125e8fd99556ce99f86b6fdbb75c6c0dea5c97;hpb=9d9f45e555bf79d3ec25c67263335d9267512edd;p=moebius3.git diff --git a/visual b/visual index 95125e8..f0b9b49 100755 --- a/visual +++ b/visual @@ -10,16 +10,31 @@ from bezier import BezierSegment import numpy as np import sys +scene.width = 1200 +scene.height = 1200 +scene.fov = 1E-3 + from moebius import * from moedebug import * nv = 40 nw = 40 -class Visdebug(): - def curve(vd, fn): +class Visdebug(BaseVisdebug): + def curve(vd, fn, color=color.yellow): # 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, color=color) + def circle(vd, c, axis, **kw): + ring(pos=c, axis=axis, radius=np.linalg.norm(axis), thickness=0.005, **kw) + def arrow(vd, p, d, **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) + vd.circle(p, np.asarray(d) * 0.25, color=bodge_color, **kw) def crashing(vd, msg): print("CRASHING - VISDEBUG", msg, file=sys.stderr) rate(1E-8) @@ -39,16 +54,16 @@ ws = range(0, nw+1) #c1 = curve( color=color.blue, pos = [ m.midline.point(th) for th in thetas ] ) for v in vs: - c2 = curve( pos = [ m.point(v,w) for w in ws ] ) + c2 = curve( color=color.blue, pos = [ m.point(v,w) for w in ws ] ) -for w in ws: - c3 = curve( color=color.yellow, pos = [ m.point(v,w) for v in vs ] ) +#for w in ws: +# c3 = curve( color=color.blue, pos = [ m.point(v,w) for v in vs ] ) -for v in vs: - c4 = curve( color=color.blue, - pos = [ m.point_offset(v,w, 0.1) for w in ws ] ) +#for v in vs: +# c4 = curve( color=color.blue, +# pos = [ m.point_offset(v,w, 0.1) for w in ws ] ) -for w in ws: - c3 = curve( color=(1,0,1), pos = [ m.point_offset(v,w, -0.1) for v in vs ] ) +#for w in ws: +# c3 = curve( color=(1,0,1), pos = [ m.point_offset(v,w, -0.1) for v in vs ] )