From b64294064ff6f75437038d2805b69ac9e8cf798c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Thu, 26 Apr 2018 21:57:51 +0200 Subject: [PATCH 1/2] typo fix in comment trivial typo fix --- pyqtgraph/SRTTransform3D.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/SRTTransform3D.py b/pyqtgraph/SRTTransform3D.py index 9b54843b..3c4edcc8 100644 --- a/pyqtgraph/SRTTransform3D.py +++ b/pyqtgraph/SRTTransform3D.py @@ -113,7 +113,7 @@ class SRTTransform3D(Transform3D): def setFromMatrix(self, m): """ - Set this transform mased on the elements of *m* + Set this transform based on the elements of *m* The input matrix must be affine AND have no shear, otherwise the conversion will most likely fail. """ From 436fcccf8273c463e06862cbeae8c221ee57da9d Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Fri, 27 Apr 2018 19:07:22 -0700 Subject: [PATCH 2/2] Avoid overflow in Point.length by using trig functions or returning inf --- pyqtgraph/Point.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/Point.py b/pyqtgraph/Point.py index 4d04f01c..3fb43cac 100644 --- a/pyqtgraph/Point.py +++ b/pyqtgraph/Point.py @@ -105,7 +105,13 @@ class Point(QtCore.QPointF): def length(self): """Returns the vector length of this Point.""" - return (self[0]**2 + self[1]**2) ** 0.5 + try: + return (self[0]**2 + self[1]**2) ** 0.5 + except OverflowError: + try: + return self[1] / np.sin(np.arctan2(self[1], self[0])) + except OverflowError: + return np.inf def norm(self): """Returns a vector in the same direction with unit length."""