Commit aaa7dc1f authored by sumpfralle's avatar sumpfralle

prevent ZeroDivision caused by parallel lines


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@514 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 82bf7722
...@@ -258,7 +258,11 @@ class ContourModel(BaseModel): ...@@ -258,7 +258,11 @@ class ContourModel(BaseModel):
b = x4.sub(x3) b = x4.sub(x3)
c = x3.sub(x1) c = x3.sub(x1)
# see http://mathworld.wolfram.com/Line-LineIntersection.html (24) # see http://mathworld.wolfram.com/Line-LineIntersection.html (24)
factor = c.cross(b).dot(a.cross(b)) / a.cross(b).normsq() try:
factor = c.cross(b).dot(a.cross(b)) / a.cross(b).normsq()
except ZeroDivisionError:
l2.p1 = None
return
if not (0 <= factor < 1): if not (0 <= factor < 1):
# The intersection is always supposed to be within p1 and p2. # The intersection is always supposed to be within p1 and p2.
l2.p1 = None l2.p1 = None
......
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