Skip to content

Commit

Permalink
fixed issue 171
Browse files Browse the repository at this point in the history
  • Loading branch information
mathandy committed Jul 9, 2022
1 parent 9ac7f62 commit 8df19f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions svgpathtools/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ def scale_bezier(bez):

def transform(curve, tf):
"""Transforms the curve by the homogeneous transformation matrix tf"""

if all((tf == np.eye(3)).ravel()):
return curve # tf is identity, return curve as is

def to_point(p):
return np.array([[p.real], [p.imag], [1.0]])

Expand All @@ -311,8 +315,6 @@ def to_complex(v):
return bpoints2bezier([to_complex(tf.dot(to_point(p)))
for p in curve.bpoints()])
elif isinstance(curve, Arc):
if curve == Arc(start=(-3600000-31200000j), radius=(400000+400000j), rotation=0.0, large_arc=True, sweep=False, end=(-2800000-31200000j)):
from IPython import embed; embed() ### DEBUG
new_start = to_complex(tf.dot(to_point(curve.start)))
new_end = to_complex(tf.dot(to_point(curve.end)))

Expand All @@ -339,7 +341,7 @@ def to_complex(v):
else :
return Arc(new_start, radius=new_radius, rotation=curve.rotation + rot,
large_arc=curve.large_arc, sweep=curve.sweep, end=new_end,
autoscale_radius=False)
autoscale_radius=True)

else:
raise TypeError("Input `curve` should be a Path, Line, "
Expand Down

0 comments on commit 8df19f1

Please sign in to comment.