From: Ian Jackson Date: Sat, 7 Apr 2018 21:59:26 +0000 (+0100) Subject: curveopt: wip X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=bb1dd12744b7dbd40f5b71f43cdcc83decb0c335;p=moebius3.git curveopt: wip Signed-off-by: Ian Jackson --- diff --git a/curveopt.py b/curveopt.py index ab02a82..b0e725c 100644 --- a/curveopt.py +++ b/curveopt.py @@ -4,8 +4,10 @@ from __future__ import print_function import numpy as np from numpy import cos, sin +import six import sys import subprocess +import math from moedebug import * from moenp import * @@ -40,7 +42,7 @@ class OptimisedCurve(): try: subproc = findcurve_subprocs[nt] except KeyError: - cl = ['./findcurve', '%d' % nt, '%.18g' % findcurve_epsilon] + cl = ['./findcurve', '%d' % (nt+1), '%.18g' % findcurve_epsilon] dbg('STARTING FINDCURVE %s' % cl) subproc = subprocess.Popen( cl, @@ -84,7 +86,21 @@ class OptimisedCurve(): findcurve_result = l - oc._result = np.reshape(findcurve_result, (3,-1)) + oc.nt = nt + oc._result = np.reshape(findcurve_result, (-1,3), 'C') + dbg(repr(oc._result)) + + vdbg().curve( oc.point_at_t ) def point_at_it(oc, it): + dbg(repr((it,))) return oc._result[it] + + def point_at_t(oc, t): + itd = t * oc.nt + it0 = int(math.floor(itd)) + it1 = int(math.ceil(itd)) + p0 = oc.point_at_it(it0) + p1 = oc.point_at_it(it1) + return p0 + (p1-p0) * (itd-it0) +