From 8fffb5ca9bec007d2c8d7e13a64bd2aef5005b0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Lehmann?= Date: Wed, 14 Sep 2005 13:39:32 +0000 Subject: [PATCH] add epsilon kwarg to trafo constructor git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@2428 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/trafo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyx/trafo.py b/pyx/trafo.py index 803209ec..8474ee32 100755 --- a/pyx/trafo.py +++ b/pyx/trafo.py @@ -56,6 +56,8 @@ def _mmatrix(angle): (-2*math.sin(phi)*math.cos(phi), math.sin(phi)*math.sin(phi)-math.cos(phi)*math.cos(phi) ) ) +class _marker: pass + # Exception class TrafoException(Exception): @@ -73,8 +75,10 @@ class trafo_pt(canvas.canvasitem, deformer.deformer): """ - def __init__(self, matrix=((1, 0), (0, 1)), vector=(0, 0)): - if abs(matrix[0][0]*matrix[1][1] - matrix[0][1]*matrix[1][0]) < _epsilon: + def __init__(self, matrix=((1, 0), (0, 1)), vector=(0, 0), epsilon=_marker): + if epsilon is _marker: + epsilon = _epsilon + if abs(matrix[0][0]*matrix[1][1] - matrix[0][1]*matrix[1][0]) < epsilon: raise TrafoException("transformation matrix must not be singular") else: self.matrix = matrix -- 2.11.4.GIT