chiark / gitweb /
debugging arrangements for helixish
[moebius3.git] / visual
1 #!/usr/bin/python
2
3 from __future__ import print_function
4
5 import signal
6 signal.signal(signal.SIGINT, signal.SIG_DFL)
7
8 from visual import *
9 from bezier import BezierSegment
10 import numpy as np
11 import sys
12
13 from moebius import *
14 from moedebug import *
15
16 nv = 40
17 nw = 40
18
19 class Visdebug():
20   def curve(vd, fn):
21     # fn(t) => 3-tuple, 3-list, or similar, for t \elem [0,1]
22     ps = [ fn(t) for t in np.linspace(0,1,11) ]
23     #dbg('Visdebug', ps)
24     curve(pos = ps)
25   def crashing(vd, msg):
26     print("CRASHING - VISDEBUG", msg, file=sys.stderr)
27     rate(1E-8)
28
29 dbg_file(sys.stderr)
30 vdbg_enable(Visdebug())
31
32 m = Moebius(nv, nw)
33
34 vs = range(0, nv+1)
35 ws = range(0, nw+1)
36
37 #ts = np.linspace(0, 1, 40)
38
39 #thetas = np.linspace(0, tau, 40)
40 #c0 = curve( color=color.red, pos = [ m.edge.point(th) for th in thetas ] )
41 #c1 = curve( color=color.blue, pos = [ m.midline.point(th) for th in thetas ] )
42
43 for v in vs:
44   c2 = curve( pos = [ m.point(v,w) for w in ws ] )
45
46 for w in ws:
47   c3 = curve( color=color.yellow, pos = [ m.point(v,w) for v in vs ] )
48
49
50 #for v in vs:
51 #  c4 = curve( color=color.blue,
52 #              pos = [ m.point_offset(v,w, 0.1) for w in ws ] )
53
54 #for w in ws:
55 #  c3 = curve( color=(1,0,1), pos = [ m.point_offset(v,w, -0.1) for v in vs ] )
56