- fixed the Travelling Salesman algorithm such that it does not add duplicated points that are next to each other
This commit is contained in:
@@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
- in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document)
|
- in AppTextEditor made some changes (added some placeholders and a message popup when reaching the end of document)
|
||||||
- when viewing GCode the Find field can now keep the focus
|
- when viewing GCode the Find field can now keep the focus
|
||||||
|
- fixed the Travelling Salesman algorithm such that it does not add duplicated points that are next to each other
|
||||||
|
|
||||||
21.11.2021
|
21.11.2021
|
||||||
|
|
||||||
|
|||||||
@@ -3153,6 +3153,9 @@ class CNCjob(Geometry):
|
|||||||
# must_visit.remove(start)
|
# must_visit.remove(start)
|
||||||
while must_visit:
|
while must_visit:
|
||||||
nearest = min(must_visit, key=lambda x: distance(path[-1], x))
|
nearest = min(must_visit, key=lambda x: distance(path[-1], x))
|
||||||
|
# fixed the Travelling Salesman algorithm such that it does not add duplicated points
|
||||||
|
# that are next to each other
|
||||||
|
if nearest != path[-1]:
|
||||||
path.append(nearest)
|
path.append(nearest)
|
||||||
must_visit.remove(nearest)
|
must_visit.remove(nearest)
|
||||||
return path
|
return path
|
||||||
@@ -3706,6 +3709,7 @@ class CNCjob(Geometry):
|
|||||||
flat_geometry = flat_ext_geo + flat_ints_geo
|
flat_geometry = flat_ext_geo + flat_ints_geo
|
||||||
# flat_geometry = self.flatten(geometry, reset=True, pathonly=True)
|
# flat_geometry = self.flatten(geometry, reset=True, pathonly=True)
|
||||||
log.debug("%d paths" % len(flat_geometry))
|
log.debug("%d paths" % len(flat_geometry))
|
||||||
|
|
||||||
if tool_offset != 0.0:
|
if tool_offset != 0.0:
|
||||||
# for it in flat_geometry:
|
# for it in flat_geometry:
|
||||||
# # if the geometry is a closed shape then create a Polygon out of it
|
# # if the geometry is a closed shape then create a Polygon out of it
|
||||||
|
|||||||
Reference in New Issue
Block a user