From 6002d409143a6726899a4de15c3a6b279a6b1d71 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 27 Sep 2019 10:07:38 +0200 Subject: Directory reorg: Put renderer into its own subdir --- support/pogojig/inkscape/cubicsuperpath.py | 174 ----------------------------- 1 file changed, 174 deletions(-) delete mode 100644 support/pogojig/inkscape/cubicsuperpath.py (limited to 'support/pogojig/inkscape/cubicsuperpath.py') diff --git a/support/pogojig/inkscape/cubicsuperpath.py b/support/pogojig/inkscape/cubicsuperpath.py deleted file mode 100644 index a594660..0000000 --- a/support/pogojig/inkscape/cubicsuperpath.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python -""" -cubicsuperpath.py - -Copyright (C) 2005 Aaron Spike, aaron@ekips.org - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -""" -from . import simplepath -from math import * - -def matprod(mlist): - prod=mlist[0] - for m in mlist[1:]: - a00=prod[0][0]*m[0][0]+prod[0][1]*m[1][0] - a01=prod[0][0]*m[0][1]+prod[0][1]*m[1][1] - a10=prod[1][0]*m[0][0]+prod[1][1]*m[1][0] - a11=prod[1][0]*m[0][1]+prod[1][1]*m[1][1] - prod=[[a00,a01],[a10,a11]] - return prod -def rotmat(teta): - return [[cos(teta),-sin(teta)],[sin(teta),cos(teta)]] -def applymat(mat, pt): - x=mat[0][0]*pt[0]+mat[0][1]*pt[1] - y=mat[1][0]*pt[0]+mat[1][1]*pt[1] - pt[0]=x - pt[1]=y -def norm(pt): - return sqrt(pt[0]*pt[0]+pt[1]*pt[1]) - -def ArcToPath(p1,params): - A=p1[:] - rx,ry,teta,longflag,sweepflag,x2,y2=params[:] - teta = teta*pi/180.0 - B=[x2,y2] - if rx==0 or ry==0 or A==B: - return([[A[:],A[:],A[:]],[B[:],B[:],B[:]]]) - mat=matprod((rotmat(teta),[[1/rx,0],[0,1/ry]],rotmat(-teta))) - applymat(mat, A) - applymat(mat, B) - k=[-(B[1]-A[1]),B[0]-A[0]] - d=k[0]*k[0]+k[1]*k[1] - k[0]/=sqrt(d) - k[1]/=sqrt(d) - d=sqrt(max(0,1-d/4)) - if longflag==sweepflag: - d*=-1 - O=[(B[0]+A[0])/2+d*k[0],(B[1]+A[1])/2+d*k[1]] - OA=[A[0]-O[0],A[1]-O[1]] - OB=[B[0]-O[0],B[1]-O[1]] - start=acos(OA[0]/norm(OA)) - if OA[1]<0: - start*=-1 - end=acos(OB[0]/norm(OB)) - if OB[1]<0: - end*=-1 - - if sweepflag and start>end: - end +=2*pi - if (not sweepflag) and start