chiark / gitweb /
rename ix_foo to ifoo
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Nov 2017 23:12:08 +0000 (23:12 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Nov 2017 23:12:08 +0000 (23:12 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
check.py
moebius.py

index 226825cb305cac352823542c4a5377f938f6aed3..5994aafc728969e0e4cd8dc4384a2604592f3e9e 100644 (file)
--- a/check.py
+++ b/check.py
@@ -8,9 +8,9 @@ import numpy as np
 
 from moebius import *
 
-n_u = 40
+nu = 40
 
-m = MoebiusHalf(n_u)
+m = MoebiusHalf(nu)
 
 ts = np.linspace(0, 1, 40)
 
@@ -19,9 +19,9 @@ 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 ix_u in range(0, n_u):
-  c2 = curve( pos = [ m.point(ix_u, t) for t in ts ] )
+for iu in range(0, nu):
+  c2 = curve( pos = [ m.point(iu, t) for t in ts ] )
 
 for t in ts:
-  c3 = curve( color=color.yellow, pos = [ m.point(ix_u, t)
-                                          for ix_u in range(0, n_u/2+1) ] )
+  c3 = curve( color=color.yellow, pos = [ m.point(iu, t)
+                                          for iu in range(0, nu/2+1) ] )
index ad0f2e042ce0f5ba8e4d1150ea428a45dd792b81..de569809d798ce360f114fd5d6e5099ae519fc5b 100644 (file)
@@ -60,6 +60,7 @@ class MoebiusHalf:
     '''
     m.edge    = Twirler(origin,  unit_z, unit_x, -2, tau/2)
     m.midline = Twirler(-unit_z, unit_z, unit_y, -0.5, 0)
+    m.nu      = nu
     m._beziers = [ m._bezier(u) for u in np.linspace(0, 1, nu+1) ]
   def _bezier(m,u):
     theta = u * tau
@@ -69,13 +70,13 @@ class MoebiusHalf:
     cp[3] =               m.midline.point(theta*2)
     cp[2] = cp[3] + np.linalg.norm(cp[3]) * m.midline.dirn (theta*2)
     return BezierSegment(cp)
-  def point(m, ix_u, t):
+  def point(m, iu, t):
     '''
-    0 <= ix_u <= nu   meaning 0 <= u <= 1
+    0 <= iu <= nu     meaning 0 <= u <= 1
                       along the extent
                        0 and 1 are both the top half of the flat traverse
                        0.5        is the bottom half of the flat traverse
     0 <=  t   <= 1    across the half-traverse
                        0 is the edge, 1 is the midline
     '''
-    return m._beziers[ix_u].point_at_t(t)
+    return m._beziers[iu].point_at_t(t)