From bae7c377014524d0adea4238f824209fdd6f1e48 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Nov 2017 23:12:08 +0000 Subject: [PATCH] rename ix_foo to ifoo Signed-off-by: Ian Jackson --- check.py | 12 ++++++------ moebius.py | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/check.py b/check.py index 226825c..5994aaf 100644 --- 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) ] ) diff --git a/moebius.py b/moebius.py index ad0f2e0..de56980 100644 --- a/moebius.py +++ b/moebius.py @@ -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) -- 2.30.2