From 51d896929e52d935d00b81bec7e56e80ec854708 Mon Sep 17 00:00:00 2001 From: Michael Schwarz Date: Fri, 7 Aug 2015 02:01:08 +0200 Subject: Inkscape export: Fix elliptical arcs not being closed. --- support/inkscape/cubicsuperpath.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/support/inkscape/cubicsuperpath.py b/support/inkscape/cubicsuperpath.py index 925efdb..861b9da 100755 --- a/support/inkscape/cubicsuperpath.py +++ b/support/inkscape/cubicsuperpath.py @@ -87,15 +87,20 @@ def ArcToPath(p1,params): pt=[O[0]+cos(angle) ,O[1]+sin(angle) ] v2=[O[0]+cos(angle)- v *sin(angle),O[1]+sin(angle)+ v *cos(angle)] p.append([v1,pt,v2]) - p[ 0][0]=p[ 0][1][:] - p[-1][2]=p[-1][1][:] mat=matprod((rotmat(teta),[[rx,0],[0,ry]],rotmat(-teta))) for pts in p: applymat(mat, pts[0]) applymat(mat, pts[1]) applymat(mat, pts[2]) - return(p) + + # Use exact coordinates for the endpoints. This prevents small drifts when relative coordinates are used and guarantees that a path ending with a z command closes perfectly. + p[0][0] = p1[:] + p[0][1] = p1[:] + p[-1][1] = [x2, y2] + p[-1][2] = [x2, y2] + + return p def CubicSuperPath(simplepath): csp = [] -- cgit