Commit 5cfb7d83 authored by sumpfralle's avatar sumpfralle

fixed a type error (Line instead of list of Lines)

remember triangles that do not result in a valid collision


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@707 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 06146d1d
...@@ -165,6 +165,7 @@ class ContourFollow: ...@@ -165,6 +165,7 @@ class ContourFollow:
self.pa = path_processor self.pa = path_processor
self._up_vector = Vector(0, 0, 1) self._up_vector = Vector(0, 0, 1)
self.physics = physics self.physics = physics
self._processed_triangles = []
if self.physics: if self.physics:
accuracy = 20 accuracy = 20
max_depth = 16 max_depth = 16
...@@ -182,6 +183,8 @@ class ContourFollow: ...@@ -182,6 +183,8 @@ class ContourFollow:
def GenerateToolPath(self, minx, maxx, miny, maxy, minz, maxz, dz, def GenerateToolPath(self, minx, maxx, miny, maxy, minz, maxz, dz,
draw_callback=None): draw_callback=None):
# reset the list of processed triangles
self._processed_triangles = []
# calculate the number of steps # calculate the number of steps
# Sometimes there is a floating point accuracy issue: make sure # Sometimes there is a floating point accuracy issue: make sure
# that only one layer is drawn, if maxz and minz are almost the same. # that only one layer is drawn, if maxz and minz are almost the same.
...@@ -254,6 +257,9 @@ class ContourFollow: ...@@ -254,6 +257,9 @@ class ContourFollow:
waterline_triangles = CollisionPaths() waterline_triangles = CollisionPaths()
projected_waterlines = [] projected_waterlines = []
for triangle in self.model.triangles(minx=minx, miny=miny, maxx=maxx, maxy=maxy): for triangle in self.model.triangles(minx=minx, miny=miny, maxx=maxx, maxy=maxy):
if id(triangle) in self._processed_triangles:
# skip triangles that are known to cause no collision
continue
if not progress_counter is None: if not progress_counter is None:
if progress_counter.increment(): if progress_counter.increment():
# quit requested # quit requested
...@@ -327,7 +333,7 @@ class ContourFollow: ...@@ -327,7 +333,7 @@ class ContourFollow:
for edge, other_point in edges[1:]: for edge, other_point in edges[1:]:
if edge.len > long_edge.len: if edge.len > long_edge.len:
long_edge = edge long_edge = edge
outer_edges = long_edge outer_edges = [long_edge]
else: else:
edge = Line(proj_points[0], proj_points[1]) edge = Line(proj_points[0], proj_points[1])
if edge.dir.cross(triangle.normal).dot(self._up_vector) < 0: if edge.dir.cross(triangle.normal).dot(self._up_vector) < 0:
...@@ -445,6 +451,8 @@ class ContourFollow: ...@@ -445,6 +451,8 @@ class ContourFollow:
result.append((cl, edge)) result.append((cl, edge))
# continue with the next outer_edge # continue with the next outer_edge
break break
if len(result) == 0:
self._processed_triangles.append(id(triangle))
return result return result
def get_shifted_waterline(self, waterline, cutter_location): def get_shifted_waterline(self, waterline, cutter_location):
......
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