Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pycam/Geometry/Line.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ def get_intersection(self, line, infinite_lines=False):
return None, None
# the lines are on one straight
candidates = []
if self.is_point_inside(x3):
if self.is_point_inside(x3) and pnorm(a) != 0:
candidates.append((x3, pnorm(c) / pnorm(a)))
elif self.is_point_inside(x4):
elif self.is_point_inside(x4) and pnorm(a) != 0:
candidates.append((x4, pdist(line.p2, self.p1) / pnorm(a)))
elif line.is_point_inside(x1):
candidates.append((x1, 0))
Expand Down
9 changes: 9 additions & 0 deletions pycam/Geometry/PointUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def ptransform_by_matrix(a, matrix):

def pmul(a, c):
c = number(c)
if not a:
return (False, False, False)
return (a[0] * c, a[1] * c, a[2] * c)


Expand All @@ -85,6 +87,13 @@ def pdiv(a, c):


def padd(a, b):
if not (a and b):
if a:
return (a[0], a[1], a[2])
elif b:
return (b[0], b[1], b[2])
else:
return (None, None, None)
return (a[0] + b[0], a[1] + b[1], a[2] + b[2])


Expand Down
4 changes: 2 additions & 2 deletions pycam/Geometry/Polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def copy(self):
def append(self, line):
if not self.is_connectable(line):
raise ValueError("This line does not fit to the polygon")
elif line.len < epsilon:
raise ValueError("A line with zero length may not be part of a polygon")
# elif line.len < epsilon:
# raise ValueError("A line with zero length may not be part of a polygon")
else:
if not self._points:
self._points.append(line.p1)
Expand Down