Commit a39bba08 authored by Guillaume Seguin's avatar Guillaume Seguin

Hackily handle avg_norm == 0

parent 2f3f39c2
...@@ -335,8 +335,11 @@ class GcodeModel(Model): ...@@ -335,8 +335,11 @@ class GcodeModel(Model):
avg_move = move_normalized / 2 + prev_move / 2 avg_move = move_normalized / 2 + prev_move / 2
norm = numpy.linalg.norm(avg_move) norm = numpy.linalg.norm(avg_move)
# FIXME: handle norm == 0 or when paths go back (add an extra cap ?) # FIXME: handle norm == 0 or when paths go back (add an extra cap ?)
avg_move = avg_move / norm if norm == 0:
avg_move_normal = numpy.array([- avg_move[1], avg_move[0]]) avg_move_normal = move_normal
else:
avg_move = avg_move / norm
avg_move_normal = numpy.array([- avg_move[1], avg_move[0]])
# Compute vertices # Compute vertices
p1 = prev_2d - path_halfwidth * avg_move_normal p1 = prev_2d - path_halfwidth * avg_move_normal
p2 = prev_2d + path_halfwidth * avg_move_normal p2 = prev_2d + path_halfwidth * avg_move_normal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment