Commit 0b37abfa authored by sumpfralle's avatar sumpfralle

handle invalid angles properly


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@859 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c1857e73
...@@ -663,7 +663,11 @@ def draw_direction_cone(p1, p2): ...@@ -663,7 +663,11 @@ def draw_direction_cone(p1, p2):
cross = direction.cross(Point(0, 0, -1)) cross = direction.cross(Point(0, 0, -1))
if cross.norm != 0: if cross.norm != 0:
# The line direction is not in line with the z axis. # The line direction is not in line with the z axis.
try:
angle = math.asin(sqrt(direction.x ** 2 + direction.y ** 2)) angle = math.asin(sqrt(direction.x ** 2 + direction.y ** 2))
except ValueError:
# invalid angle - just ignore this cone
return
# convert from radians to degree # convert from radians to degree
angle = angle / math.pi * 180 angle = angle / math.pi * 180
if direction.z < 0: if direction.z < 0:
......
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