From: Ian Jackson Date: Sat, 4 Nov 2017 20:57:24 +0000 (+0000) Subject: bugfixes X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=849be6fa8ac8198c85aafcae8ed51b112339b0ad;p=moebius3.git bugfixes Signed-off-by: Ian Jackson --- diff --git a/check.py b/check.py index 21c33d1..b0374dc 100644 --- a/check.py +++ b/check.py @@ -1,13 +1,23 @@ + +import signal +signal.signal(signal.SIGINT, signal.SIG_DFL) + from visual import * from bezier import BezierSegment -from moebius import Moebius import numpy as np +from moebius import * + n_u = 10 m = Moebius(10) ts = arange(0, 1, 0.1) -for ix_u in range(0, n_u+1): - curve( pos = [ m.point(ix_u, t) for t in ts ] ) +thetas = arange(0, tau, 20) + +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 ] ) diff --git a/moebius.py b/moebius.py index 7240248..ea762a9 100644 --- a/moebius.py +++ b/moebius.py @@ -1,9 +1,13 @@ +from __future__ import print_function + import numpy as np from numpy import cos, sin from bezier import BezierSegment +import sys + tau = np.pi * 2 origin = np.array((0,0,0)) @@ -22,6 +26,7 @@ class ParametricCircle: def radius(pc, theta): return pc._r0 * cos(theta) + pc._r1 * sin(theta) def point(pc, theta): + print('point %s %f' % (pc, theta), file=sys.stderr) return pc._c + pc.radius(theta) class Twirler(ParametricCircle):