perspective.py revision b537f26600e0f7924eb1088903cca14402da987d
"""
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
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
Perspective approach & math by Dmitry Platonov, shadowjack@mail.ru, 2006
"""
from ffgeom import *
from numpy import *
if p:
else:
retval = 0.0
if u:
try:
except KeyError:
pass
return retval
exit()
#obj is selected second
for i in range(4):
#query inkscape about the bounding box of obj
q = {'x':0,'y':0,'width':0,'height':0}
f.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)
for i in (0,1,2,3):
projmatrix = array([[res[0],res[1],res[2]],[res[3],res[4],res[5]],[res[6],res[7],1.0]],dtype=float64)
for subs in p:
def project_point(self,p,m):
x = p[0]
y = p[1]
return [(x*m[0][0] + y*m[0][1] + m[0][2])/(x*m[2][0]+y*m[2][1]+m[2][2]),(x*m[1][0] + y*m[1][1] + m[1][2])/(x*m[2][0]+y*m[2][1]+m[2][2])]
e = Project()
e.affect()