summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1dcdfe8)
raw | patch | inline | side by side (parent: 1dcdfe8)
author | acspike <acspike@users.sourceforge.net> | |
Sun, 1 Apr 2007 21:33:25 +0000 (21:33 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Sun, 1 Apr 2007 21:33:25 +0000 (21:33 +0000) |
share/extensions/perspective.py | patch | blob | history |
index 2f25f6a541dd91f50f0b2184526753c4aae4d5c1..014a7b779c4807ab8426dfebfc686aa03db98a2a 100755 (executable)
Perspective approach & math by Dmitry Platonov, shadowjack@mail.ru, 2006
"""
import sys, inkex, os, re, simplepath, cubicsuperpath
-from ffgeom import *\r
+from ffgeom import *
try:
from numpy import *
- from numpy.linalg import *\r
-except:\r
- inkex.debug("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again.")\r
+ from numpy.linalg import *
+except:
+ inkex.debug("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again.")
sys.exit()
uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0}
file = self.args[-1]
id = self.options.ids[0]
for query in q.keys():
- f = os.popen("inkscape --query-%s --query-id=%s %s" % (query,id,file))
+ _,f,err = os.popen3("inkscape --query-%s --query-id=%s %s" % (query,id,file))
q[query] = float(f.read())
f.close()
+ err.close()
sp = array([[q['x'], q['y']+q['height']],[q['x'], q['y']],[q['x']+q['width'], q['y']],[q['x']+q['width'], q['y']+q['height']]], dtype=float64)
solmatrix = zeros((8,8), dtype=float64)
solmatrix[i][2] = 1
solmatrix[i][6] = -dp[i][0]*sp[i][0]
solmatrix[i][7] = -dp[i][0]*sp[i][1]
- solmatrix[i+4][3] = sp[i][0]\r
+ solmatrix[i+4][3] = sp[i][0]
solmatrix[i+4][4] = sp[i][1]
solmatrix[i+4][5] = 1
solmatrix[i+4][6] = -dp[i][1]*sp[i][0]