Fix in flevobezier

This commit is contained in:
leyghisbb 2021-04-14 21:53:11 +02:00
parent c13ab76b7d
commit 588eedaaad

View File

@ -65,7 +65,11 @@ def flevobezier(points, z):
window = points[trail:lead + 1] # Extend the window one more node window = points[trail:lead + 1] # Extend the window one more node
v = window[-3] - window[-2] v = window[-3] - window[-2]
w = window[-1] - window[-2] w = window[-1] - window[-2]
if dotp(v, w) / dist(v) / dist(w) >= 0.5: # 60 degrees or less, over by angle try:
v_w = dist(v) / dist(w)
except ZeroDivisionError as e:
pout("Division by zero. Check if your path contains duplicate handles.")
if dotp(v, w) / v_w >= 0.5: # 60 degrees or less, over by angle
if maybeover: # backup if maybeover: # backup
newcurve = stress(points[prevtrail:lead])[0] newcurve = stress(points[prevtrail:lead])[0]
res[-3:] = newcurve[1:] # replace the last three nodes in res with those of newcurve res[-3:] = newcurve[1:] # replace the last three nodes in res with those of newcurve