From 8b8d9fe68f7e317a50dfc1f3b2dd887fc18a2feb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Tue, 19 Oct 2004 12:50:26 +0000 Subject: [PATCH] - deformer fixes to properly build a new normpath git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1882 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/deformer.py | 7 ++++--- pyx/path.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pyx/deformer.py b/pyx/deformer.py index eb96adfe..e653c4c6 100644 --- a/pyx/deformer.py +++ b/pyx/deformer.py @@ -341,12 +341,13 @@ class cycloid(deformer): # {{{ # Build the path from the pointlist # containing (control x 2, base x 2, control x 2) if skipfirst > subpath.epsilon: - cycloidpath = path.normpath([subpath.split([params[0]])[0]]) - cycloidpath.append(path.curveto_pt(*(points[0][4:6] + points[1][0:4]))) + newpath = subpath.split([params[0]])[0] + newpath.append(path.normcurve(*(points[0][2:6] + points[1][0:4]))) + cycloidpath = path.normpath([newpath]) else: cycloidpath = path.normpath([path.normsubpath([path.normcurve(*(points[0][2:6] + points[1][0:4]))], 0)]) for i in range(1, len(points)-1): - cycloidpath.append(path.curveto_pt(*(points[i][4:6] + points[i+1][0:4]))) + cycloidpath.normsubpaths[-1].append(path.normcurve(*(points[i][2:6] + points[i+1][0:4]))) if skiplast > subpath.epsilon: cycloidpath.join(path.normpath([subpath.split([params[-1]])[-1]])) diff --git a/pyx/path.py b/pyx/path.py index 2a7588aa..dafac3a3 100755 --- a/pyx/path.py +++ b/pyx/path.py @@ -1849,6 +1849,10 @@ class normsubpath: self.normsubpathitems = [] self.closed = 0 + # a test (might be temporary) + for anormsubpathitem in normsubpathitems: + assert isinstance(anormsubpathitem, normsubpathitem), "only list of normsubpathitem instances allowed" + self.extend(normsubpathitems) if closed: @@ -1917,7 +1921,7 @@ class normsubpath: def append(self, anormsubpathitem): assert isinstance(anormsubpathitem, normsubpathitem), "only normsubpathitem instances allowed" - + if self.closed: raise PathException("Cannot append to closed normsubpath") @@ -2376,11 +2380,14 @@ class normpath(base.canvasitem): raise PathException("subpath index out of range") return normsubpath, normsubpath.arclentoparam(arclen) - def append(self, normsubpath): - self.normsubpaths.append(normsubpath) + def append(self, anormsubpath): + assert isinstance(anormsubpath, normsubpath), "only list of normsubpath instance allowed" + self.normsubpaths.append(anormsubpath) def extend(self, normsubpaths): - self.subpaths.extend(normsubpaths) + for anormsubpath in normsubpaths: + assert isinstance(anormsubpath, normsubpath), "only list of normsubpath instance allowed" + self.normsubpaths.extend(normsubpaths) def arclen_pt(self): """returns total arc length of normpath in pts""" -- 2.11.4.GIT