From 711673417a32652e0f8d3ad23d85a9c482f2eed6 Mon Sep 17 00:00:00 2001 From: Michael Schindler Date: Tue, 27 Sep 2005 08:36:57 +0000 Subject: [PATCH] move sign function into helper git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@2489 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/connector.py | 3 +-- pyx/helper.py | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyx/connector.py b/pyx/connector.py index b1544a74..0c105b84 100644 --- a/pyx/connector.py +++ b/pyx/connector.py @@ -30,7 +30,6 @@ except ImportError: # fallback implementation for Python 2.1 and below def radians(x): return x*pi/180 def degrees(x): return x*180/pi -from deformer import sign1 ######################### @@ -137,7 +136,7 @@ class arc_pt(connector_pt): [path.normsubpath([path.normline_pt(*(self.box1.center+self.box2.center))], closed=0)]) else: radius = abs(0.5 * (bulge + 0.25 * distance**2 / bulge)) - centerdist = sign1(bulge) * (radius - abs(bulge)) + centerdist = helper.sign(bulge) * (radius - abs(bulge)) center = (0.5 * (self.box1.center[0] + self.box2.center[0]) - tangent[1]*centerdist, 0.5 * (self.box1.center[1] + self.box2.center[1]) + tangent[0]*centerdist) angle1 = atan2(self.box1.center[1] - center[1], self.box1.center[0] - center[0]) diff --git a/pyx/helper.py b/pyx/helper.py index 0ef8f6cc..7a62b19c 100644 --- a/pyx/helper.py +++ b/pyx/helper.py @@ -3,7 +3,8 @@ # # # Copyright (C) 2002-2004 Jörg Lehmann -# Copyright (C) 2002-2004 André Wobst +# Copyright (C) 2002-2005 André Wobst +# Copyright (C) 2005 Michael Schindler # # This file is part of PyX (http://pyx.sourceforge.net/). # @@ -22,6 +23,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +def sign(x): + return (x >= 0) and 1 or -1 + # XXX fallback for Numeric (eigenvalue computation) to be implemented along # know algorithms (like from numerical recipes) -- 2.11.4.GIT