From ccc9ee6ae19c6a404b3408f3b73a820cc3660e83 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 24 Jul 2018 15:07:02 -0700 Subject: [PATCH] added clipping to work around floating point error in Arc._parameterize() --- svgpathtools/path.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svgpathtools/path.py b/svgpathtools/path.py index 96783fd..5f4453f 100644 --- a/svgpathtools/path.py +++ b/svgpathtools/path.py @@ -1380,8 +1380,8 @@ class Arc(object): det_uv = u1.real*u2.imag - u1.imag*u2.real acosand = u1.real*u2.real + u1.imag*u2.imag - if acosand > 1 or acosand < -1: - acosand = round(acosand) + acosand = np.clip(acosand.real, -1, 1) + np.clip(acosand.imag, -1, 1) + if det_uv > 0: self.delta = degrees(acos(acosand)) elif det_uv < 0: