bugfix bezier envelope
This commit is contained in:
parent
e28083b7cb
commit
b2275717c5
@ -102,15 +102,15 @@ class BezierEnvelope(inkex.EffectExtension):
|
|||||||
inkex.errormsg("axis[%i] is None. Check if envelope has at least 4 nodes (closed path) or 5 nodes (open path)." % i)
|
inkex.errormsg("axis[%i] is None. Check if envelope has at least 4 nodes (closed path) or 5 nodes (open path)." % i)
|
||||||
exit()
|
exit()
|
||||||
# morph the enveloped element according to the axes
|
# morph the enveloped element according to the axes
|
||||||
morph_element( letterElement, envelopeElement, axes );
|
morph_element( letterElement, axes );
|
||||||
|
|
||||||
|
|
||||||
def morph_element( letterElement, envelopeElement, axes ):
|
def morph_element( letterElement, axes ):
|
||||||
|
|
||||||
path = Path( letterElement.get('d') ).to_arrays()
|
path = Path( letterElement.get('d') ).to_arrays()
|
||||||
morphedPath = morphPath( path, axes )
|
morphedPath = morphPath( path, axes )
|
||||||
letterElement.set("d", str(Path(morphedPath)))
|
letterElement.set("d", str(Path(morphedPath)))
|
||||||
|
|
||||||
|
|
||||||
# Morphs a path into a new path, according to cubic curved bounding axes.
|
# Morphs a path into a new path, according to cubic curved bounding axes.
|
||||||
def morphPath(path, axes):
|
def morphPath(path, axes):
|
||||||
bounds = [y for x in list(Path(path).bounding_box()) for y in list(x)]
|
bounds = [y for x in list(Path(path).bounding_box()) for y in list(x)]
|
||||||
@ -379,7 +379,10 @@ def match( p1, p2, a1, a2 ):
|
|||||||
rp = math.hypot( dp[x], dp[y] )
|
rp = math.hypot( dp[x], dp[y] )
|
||||||
ra = math.hypot( da[x], da[y] )
|
ra = math.hypot( da[x], da[y] )
|
||||||
# scale
|
# scale
|
||||||
scale = ra / rp
|
try:
|
||||||
|
scale = ra / rp
|
||||||
|
except:
|
||||||
|
scale = 0
|
||||||
# transforms in the order they are applied
|
# transforms in the order they are applied
|
||||||
t1 = Transform( "translate(%f,%f)"%(-p1[x],-p1[y]) ).matrix
|
t1 = Transform( "translate(%f,%f)"%(-p1[x],-p1[y]) ).matrix
|
||||||
#t2 = Transform( "rotate(%f)"%(-angle_p) ).matrix
|
#t2 = Transform( "rotate(%f)"%(-angle_p) ).matrix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user