Commit d7d6ff66 authored by sumpfralle's avatar sumpfralle

prevent Exceptions for zero-length lines (e.g. caused by...

prevent Exceptions for zero-length lines (e.g. caused by pycam.Geometry.intersection.intersect_circle_line)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@697 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 14ac6beb
...@@ -96,6 +96,9 @@ class Line(TransformableContainer): ...@@ -96,6 +96,9 @@ class Line(TransformableContainer):
def closest_point(self, p): def closest_point(self, p):
v = self.dir v = self.dir
if v is None:
# for zero-length lines
return self.p1
l = self.p1.dot(v) - p.dot(v) l = self.p1.dot(v) - p.dot(v)
return self.p1.sub(v.mul(l)) return self.p1.sub(v.mul(l))
......
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