from moebius import *
-nu = 40
+nv = 40
+nw = 40
-m = MoebiusHalf(nu)
+m = Moebius(nv, nw)
-ts = np.linspace(0, 1, 40)
+vs = range(0, nv+1)
+ws = range(0, nw+1)
-thetas = np.linspace(0, tau, 40)
+#ts = np.linspace(0, 1, 40)
-c0 = curve( color=color.red, pos = [ m.edge.point(th) for th in thetas ] )
-c1 = curve( color=color.blue, pos = [ m.midline.point(th) for th in thetas ] )
+#thetas = np.linspace(0, tau, 40)
+#c0 = curve( color=color.red, pos = [ m.edge.point(th) for th in thetas ] )
+#c1 = curve( color=color.blue, pos = [ m.midline.point(th) for th in thetas ] )
-for iu in range(0, nu):
- c2 = curve( pos = [ m.point(iu, t) for t in ts ] )
+for v in vs:
+ c2 = curve( pos = [ m.point(v,w) for w in ws ] )
-for t in ts:
- c3 = curve( color=color.yellow, pos = [ m.point(iu, t)
- for iu in range(0, nu/2+1) ] )
+for w in ws:
+ c3 = curve( color=color.yellow, pos = [ m.point(v,w) for v in vs ] )
0 is the edge, 1 is the midline
'''
return m._beziers[iu].point_at_t(t)
+
+class Moebius(MoebiusHalf):
+ def __init__(m, nv, nw):
+ '''
+ 0 <= v <= nw along the extent, v=0 is the flat traverse
+ 0 <= w <= nv across the traverse nw must be even
+ the top is both v=0, w=0 v=nv, w=nw
+ '''
+ assert(nw % 1 == 0)
+ m.nv = nv
+ m.nw = nw
+ m.nt = nw/2
+ m._t_vals = np.linspace(0, 1, m.nt+1)
+ MoebiusHalf.__init__(m, nu=nv*2)
+
+ def _vw2tiu_kw(m, v, w):
+ if w <= m.nt:
+ it = w
+ iu = v
+ else:
+ it = m.nw - w
+ iu = m.nv + v
+ print('v,w=%d,%d => it,iu=%d,%d' % (v,w,it,iu),
+ file=sys.stderr)
+ return { 't': m._t_vals[it], 'iu': iu }
+
+ def point(m, v, w):
+ return MoebiusHalf.point(m, **m._vw2tiu_kw(v,w))