chiark / gitweb /
helixish: attempt at the whole thing
[moebius3.git] / moebius.py
index 4294d864140ca032b5fe44077be33d30c618da69..e5a81acad9d0d458bbc823769b5cea55176e0801 100644 (file)
@@ -5,6 +5,7 @@ import numpy as np
 from numpy import cos, sin
 
 from bezier import BezierSegment
+from helixish import HelixishCurve
 from moenp import *
 
 import sys
@@ -80,8 +81,10 @@ class MoebiusHalf:
     m.nu      = nu
     m._thetas = [ u * tau for u in np.linspace(0, 1, nu+1) ]
     m._cp2b = BezierSegment([ (c,) for c in [0.33,0.33, 1.50]])
-    m._beziers = [ m._bezier(theta) for theta in m._thetas ]
-  def _bezier(m, theta):
+    m._beziers = [ m._bezier(theta, HelixishCurve) for theta in m._thetas ]
+    #check = int(nu/3)
+    #m._beziers[check] = m._bezier(m._thetas[check], HelixishCurve)
+  def _bezier(m, theta, constructor=DoubleCubicBezier):
     cp = [None] * 4
     cp[0] =               m.edge   .point(theta)
     cp[3] =               m.midline.point(theta*2)
@@ -93,7 +96,7 @@ class MoebiusHalf:
     #      file=sys.stderr)
     cp[1] = cp[0] + cp1scale * m.edge   .dirn (theta)
     cp[2] = cp[3] + cp2scale * m.midline.dirn (theta*2)
-    return DoubleCubicBezier(cp)
+    return constructor(cp)
   def point(m, iu, t):
     '''
     0 <= iu <= nu     meaning 0 <= u <= 1