Luban icon indicating copy to clipboard operation
Luban copied to clipboard

Feature Request: optimize Optimize Path option

Open Abolfazl opened this issue 4 years ago • 7 comments

When I check Optimize Path when loading a svg file, it does not seem to do anything. The output file is the exact same as a file that did not have Optimize Path checked.

This seems to be the case with any .svg I load.

I am running V3.7.0 stable

Abolfazl avatar Jul 04 '20 02:07 Abolfazl

Seems like we introduce a new bug.

parachvte avatar Jul 06 '20 02:07 parachvte

https://github.com/Snapmaker/Luban/pull/388 Fixed.

parachvte avatar Jul 20 '20 08:07 parachvte

@parachvte Why does this fix limit optimization at 2000 shapes? https://github.com/Snapmaker/Luban/pull/388/commits/5d921f0a5dec1b64353f70ad9f3d8a82106b69dc

Abolfazl avatar Jul 23 '20 20:07 Abolfazl

Optimize Path uses an unoptimized short path algorithm, which is at O(N^2) complexity. With number of shapes grows, it will be very slow.

parachvte avatar Jul 27 '20 06:07 parachvte

Is there a way to optimize Optimize Path? I do not mind the added time

Abolfazl avatar Jul 27 '20 06:07 Abolfazl

@Abolfazl

I do not mind the added time

We still need it to complete under a limited time (in 1 second or in a few seconds). I come up with some ideas to improve it, I'll put this into our backlog.

parachvte avatar Aug 04 '20 04:08 parachvte

Instead of using an exact short path algorithm, just selecting greedily the next nearest path/point, should already provide a sufficient result.

Currently when cutting something with the laser, there are still lots of unnecessary movements from "left to right". If one just selects the nearest path to continue cutting, one could save a lot of travel movements. Yes, this is not the optimal path, with the overall shortest travel movements. However, a good approxmiation which should result in 90% or 95% less travel movements, which should be good enough for most use cases while still being fast (and easy to implement).

siberianhuskies avatar May 18 '22 10:05 siberianhuskies

The new path planning algorithm shows better results and subsequent issues can be proposed on this basis. image

tensile23 avatar Mar 21 '23 09:03 tensile23