Browse Source

Merge branch 'merill-merge'

remi durand 3 years ago
parent
commit
d4f5d643f3

+ 14 - 14
doc/How to build - Linux et al.md

@@ -1,5 +1,5 @@
 
-# Building SuperSlicer on UNIX/Linux
+# Building Slic3r on UNIX/Linux
 
 
 SuperSlicer uses the CMake build system and requires several dependencies.
@@ -8,7 +8,7 @@ as the versions listed - generally versions available on conservative Linux dist
 
 Perl is not required anymore.
 
-In a typical situation, one would open a command line, go to the SuperSlicer sources, create a directory called `build` or similar,
+In a typical situation, one would open a command line, go to the Slic3r sources, create a directory called `build` or similar,
 `cd` into it and call:
 
     cmake ..
@@ -34,7 +34,7 @@ git submodule update
 
 ## How to build, the easy way
 
-You can follow the [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_ubuntu.yml) the build server use to create the ubuntu release.
+You can follow the [script](https://github.com/supermerill/Slic3r/blob/master/.github/workflows/ccpp_ubuntu.yml) the build server use to create the ubuntu release.
 
 You have to execute each command at the right of the 'run: ' tags, in the directory that is at the right of the previous 'working-directory:' tag.
 
@@ -44,13 +44,13 @@ You can stop after the `make slic3r` as the rest of the commands are for buildin
 
 ### Dependency resolution
 
-By default SuperSlicer looks for dependencies the default way CMake looks for them, i.e. in default system locations.
-On Linux this will typically make SuperSlicer depend on dynamically loaded libraries from the system, however, SuperSlicer can be told
+By default Slic3r looks for dependencies the default way CMake looks for them, i.e. in default system locations.
+On Linux this will typically make Slic3r depend on dynamically loaded libraries from the system, however, Slic3r can be told
 to specifically look for static libraries with the `SLIC3R_STATIC` flag passed to cmake:
 
     cmake .. -DSLIC3R_STATIC=1
 
-Additionally, SuperSlicer can be built in a static manner mostly independent of the system libraries with a dependencies bundle
+Additionally, Slic3r can be built in a static manner mostly independent of the system libraries with a dependencies bundle
 created using CMake script in the `deps` directory (these are not interconnected with the rest of the CMake scripts).
 
 Note: We say _mostly independent_ because it's still expected the system will provide some transitive dependencies, such as GTK for wxWidgets.
@@ -62,7 +62,7 @@ To do this, go to the `deps` directory, create a `build` subdirectory (or the li
 where the target destdir is a directory of your choosing where the dependencies will be installed.
 You can also omit the `DESTDIR` option to use the default, in that case the `destdir` will be created inside the `build` directory where `cmake` is run.
 
-To pass the destdir path to the top-level SuperSlicer CMake script, use the `CMAKE_PREFIX_PATH` option along with turning on `SLIC3R_STATIC`:
+To pass the destdir path to the top-level Slic3r CMake script, use the `CMAKE_PREFIX_PATH` option along with turning on `SLIC3R_STATIC`:
 
     cmake .. -DSLIC3R_STATIC=1 -DCMAKE_PREFIX_PATH=<path to destdir>/usr/local
 
@@ -73,18 +73,18 @@ This is because wxWidgets hardcode the installation path.
 
 ### wxWidgets version
 
-SuperSlicer need at least wxWidgets 3.1
+Slic3r need at least wxWidgets 3.1
 
 ### Build variant
 
-By default SuperSlicer builds the release variant.
+By default Slic3r builds the release variant.
 To create a debug build, use the following CMake flag:
 
     -DCMAKE_BUILD_TYPE=Debug
 
 ### Enabling address sanitizer
 
-If you're using GCC/Clang compiler, it is possible to build SuperSlicer with the built-in address sanitizer enabled to help detect memory-corruption issues.
+If you're using GCC/Clang compiler, it is possible to build Slic3r with the built-in address sanitizer enabled to help detect memory-corruption issues.
 To enable it, simply use the following CMake flag:
 
     -DSLIC3R_ASAN=1
@@ -93,15 +93,15 @@ This requires GCC>4.8 or Clang>3.1.
 
 ### Installation
 
-At runtime, SuperSlicer needs a way to access its resource files. By default, it looks for a `resources` directory relative to its binary.
+At runtime, Slic3r needs a way to access its resource files. By default, it looks for a `resources` directory relative to its binary.
 
-If you instead want SuperSlicer installed in a structure according to the File System Hierarchy Standard, use the `SLIC3R_FHS` flag
+If you instead want Slic3r installed in a structure according to the File System Hierarchy Standard, use the `SLIC3R_FHS` flag
 
     cmake .. -DSLIC3R_FHS=1
 
-This will make SuperSlicer look for a fixed-location `share/slic3r-prusa3d` directory instead (note that the location becomes hardcoded).
+This will make Slic3r look for a fixed-location `share/slic3r-prusa3d` directory instead (note that the location becomes hardcoded).
 
-You can then use the `make install` target to install SuperSlicer.
+You can then use the `make install` target to install Slic3r.
 
 
 ## Raspberry pi

+ 13 - 13
doc/How to build - Mac OS.md

@@ -1,7 +1,7 @@
 
-# Building SuperSlicer on Mac OS
+# Building Slic3r on Mac OS
 
-To build SuperSlicer on Mac OS, you will need the following software:
+To build Slic3r on Mac OS, you will need the following software:
 
 - XCode
 - CMake
@@ -26,7 +26,7 @@ git submodule update
 ```
 ### How to build
 
-You can follow the [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_mac.yml) the build server use to create the ubuntu release.
+You can follow the [script](https://github.com/supermerill/Slic3r/blob/master/.github/workflows/ccpp_mac.yml) the build server use to create the ubuntu release.
 
 You have to execute each command at the right of the 'run: ' tags, in the directory that is at the right of the previous 'working-directory:' tag.
 
@@ -37,8 +37,8 @@ You can stop after the `make slic3r` as the rest of the commands are for buildin
 
 ### Dependencies
 
-SuperSlicer comes with a set of CMake scripts to build its dependencies, it lives in the `deps` directory.
-Open a terminal window and navigate to SuperSlicer sources directory and then to `deps`.
+Slic3r comes with a set of CMake scripts to build its dependencies, it lives in the `deps` directory.
+Open a terminal window and navigate to Slic3r sources directory and then to `deps`.
 Use the following commands to build the dependencies:
 
     mkdir build
@@ -56,10 +56,10 @@ FIXME The Cereal serialization library needs a tiny patch on some old OSX clang
 https://github.com/USCiLab/cereal/issues/339#issuecomment-246166717
 
 
-### Building SuperSlicer
+### Building Slic3r
 
-If dependencies are built without errors, you can proceed to build SuperSlicer itself.
-Go back to top level SuperSlicer sources directory and use these commands:
+If dependencies are built without errors, you can proceed to build Slic3r itself.
+Go back to top level Slic3r sources directory and use these commands:
 
     mkdir build
     cd build
@@ -68,7 +68,7 @@ Go back to top level SuperSlicer sources directory and use these commands:
 The `CMAKE_PREFIX_PATH` is the path to the dependencies bundle but with `/usr/local` appended - if you set a custom path
 using the `DESTDIR` option, you will need to change this accordingly. **Warning:** the `CMAKE_PREFIX_PATH` needs to be an absolute path.
 
-The CMake command above prepares SuperSlicer for building from the command line.
+The CMake command above prepares Slic3r for building from the command line.
 To start the build, use
 
     make -jN
@@ -79,12 +79,12 @@ Alternatively, if you would like to use XCode GUI, modify the `cmake` command to
 
     cmake .. -GXcode -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local"
 
-and then open the `SuperSlicer.xcodeproj` file.
+and then open the `Slic3r.xcodeproj` file.
 This should open up XCode where you can perform build using the GUI or perform other tasks.
 
 ### Note on Mac OS X SDKs
 
-By default SuperSlicer builds against whichever SDK is the default on the current system.
+By default Slic3r builds against whichever SDK is the default on the current system.
 
 This can be customized. The `CMAKE_OSX_SYSROOT` option sets the path to the SDK directory location
 and the `CMAKE_OSX_DEPLOYMENT_TARGET` option sets the target OS X system version (eg. `10.14` or similar).
@@ -93,9 +93,9 @@ In case you set both, the two settings need to agree with each other. (Building
 is currently unsupported because some of the dependencies don't support this, most notably wxWidgets.)
 
 Please note that the `CMAKE_OSX_DEPLOYMENT_TARGET` and `CMAKE_OSX_SYSROOT` options need to be set the same
-on both the dependencies bundle as well as SuperSlicer itself.
+on both the dependencies bundle as well as Slic3r itself.
 
-Official Mac SuperSlicer builds are currently built against SDK 10.9 to ensure compatibility with older Macs.
+Official Mac Slic3r builds are currently built against SDK 10.9 to ensure compatibility with older Macs.
 
 _Warning:_ XCode may be set such that it rejects SDKs bellow some version (silently, more or less).
 This is set in the property list file

+ 15 - 15
doc/How to build - Windows.md

@@ -1,7 +1,7 @@
 
-# Building SuperSlicer on Microsoft Windows
+# Building Slic3r on Microsoft Windows
 
-The currently supported way of building SuperSlicer on Windows is with CMake and [MS Visual Studio 2019](https://visualstudio.microsoft.com/fr/vs).
+The currently supported way of building Slic3r on Windows is with CMake and [MS Visual Studio 2019](https://visualstudio.microsoft.com/fr/vs).
 CMake installer can be downloaded from [the official website](https://cmake.org/download/).~~
 
 Building with [Visual Studio 2017 Community Edition](https://www.visualstudio.com/vs/older-downloads/). should work too.
@@ -28,24 +28,24 @@ cmake .. -G "Visual Studio 16 2019" -A x64
 msbuild /m ALL_BUILD.vcxproj
 ```
 
-and then build superslicer (in ./build):
+and then build Slic3r (in ./build):
 ```
-cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH="PATH_TO_SuperSlicer\deps\build\destdir\usr\local"
+cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH="PATH_TO_Slic3r\deps\build\destdir\usr\local"
 msbuild /m /P:Configuration=Release INSTALL.vcxproj
 ```
 You can also build it in visual studio, for that open the .sln.
-Note that you need to have `libgmp-10.dll` and `libmpfr-4.dll` next to your built superslicer. You can get them from any superslicer release.
+Note that you need to have `libgmp-10.dll` and `libmpfr-4.dll` next to your built Slic3r. You can get them from any Slic3r release.
 
-If you want to create the zipped release, you can follow this [script](https://github.com/supermerill/SuperSlicer/blob/master/.github/workflows/ccpp_win.yml).
+If you want to create the zipped release, you can follow this [script](https://github.com/supermerill/Slic3r/blob/master/.github/workflows/ccpp_win.yml).
 
 # Old doc, not up-to-date:
 
 ### Building the dependencies package yourself
 
-The dependencies package is built using CMake scripts inside the `deps` subdirectory of SuperSlicer sources.
+The dependencies package is built using CMake scripts inside the `deps` subdirectory of Slic3r sources.
 (This is intentionally not interconnected with the CMake scripts in the rest of the sources.)
 
-Open the preferred Visual Studio command line (64 or 32 bit variant, or just a cmd window) and `cd` into the directory with SuperSlicer sources.
+Open the preferred Visual Studio command line (64 or 32 bit variant, or just a cmd window) and `cd` into the directory with Slic3r sources.
 Then `cd` into the `deps` directory and use these commands to build:
 
     mkdir build
@@ -77,13 +77,13 @@ Refer to the CMake scripts inside the `deps` directory to see which dependencies
 * Specifically, the problem arises when building boost. Boost build tool appends all build options into paths of intermediate files, which are not handled correctly by either `b2.exe` or possibly `ninja` (?).
 
 
-### Building SuperSlicer with Visual Studio
+### Building Slic3r with Visual Studio
 
-First obtain the SuperSlicer sources via either git or by extracting the source archive.
+First obtain the Slic3r sources via either git or by extracting the source archive.
 
 Then you will need to note down the so-called 'prefix path' to the dependencies, this is the location of the dependencies packages + `\usr\local` appended.
 
-When ready, open the relevant Visual Studio command line and `cd` into the directory with SuperSlicer sources.
+When ready, open the relevant Visual Studio command line and `cd` into the directory with Slic3r sources.
 Use these commands to prepare Visual Studio solution file:
 
     mkdir build
@@ -92,14 +92,14 @@ Use these commands to prepare Visual Studio solution file:
 
 Note that the '-G "Visual Studio 15 Win64"' have to be the same as the one you sue for building the dependencies. So replace it the same way your replace it when you built the dependencies (if you did).
 
-If `cmake` has finished without errors, go to the build directory and open the `SuperSlicer.sln` solution file in Visual Studio.
-Before building, make sure you're building the right project (use one of those starting with `SuperSlicer_app_...`) and that you're building with the right configuration, i.e. _Release_ vs. _Debug_. When unsure, choose _Release_.
+If `cmake` has finished without errors, go to the build directory and open the `Slic3r.sln` solution file in Visual Studio.
+Before building, make sure you're building the right project (use one of those starting with `Slic3r_app_...`) and that you're building with the right configuration, i.e. _Release_ vs. _Debug_. When unsure, choose _Release_.
 Note that you won't be able to build a _Debug_ variant against a _Release_-only dependencies package.
 
 #### Installing using the `INSTALL` project
 
-SuperSlicer can be run from the Visual Studio or from Visual Studio's build directory (`src\Release` or `src\Debug`), but for longer-term usage you might want to install somewhere using the `INSTALL` project.
-By default, this installs into `C:\Program Files\SuperSlicer`.
+Slic3r can be run from the Visual Studio or from Visual Studio's build directory (`src\Release` or `src\Debug`), but for longer-term usage you might want to install somewhere using the `INSTALL` project.
+By default, this installs into `C:\Program Files\Slic3r`.
 To customize the install path, use the `-DCMAKE_INSTALL_PREFIX=<path of your choice>` when invoking `cmake`.
 
 ### Building from the command line

+ 10 - 0
src/libslic3r/AppConfig.cpp

@@ -57,6 +57,7 @@ void AppConfig::set_defaults()
 
         if (get("show_drop_project_dialog").empty())
             set("show_drop_project_dialog", "1");
+		
         if (get("drop_project_action").empty())
             set("drop_project_action", "1");
 
@@ -151,12 +152,21 @@ void AppConfig::set_defaults()
         if (get("use_custom_toolbar_size").empty())
             set("use_custom_toolbar_size", "0");
 
+        if (get("show_collapse_button").empty())
+            set("show_collapse_button", "1");
+
+        if (get("suppress_hyperlinks").empty())
+            set("suppress_hyperlinks", "1");
+
         if (get("custom_toolbar_size").empty())
             set("custom_toolbar_size", "100");
 
         if (get("auto_toolbar_size").empty())
             set("auto_toolbar_size", "100");
 
+        if (get("auto_switch_preview").empty())
+            set("auto_switch_preview", "1");
+
 #if ENABLE_ENVIRONMENT_MAP
         if (get("use_environment_map").empty())
             set("use_environment_map", "0");

+ 9 - 12
src/libslic3r/GCode.cpp

@@ -3289,10 +3289,11 @@ void GCode::use(const ExtrusionEntityCollection &collection) {
 std::string GCode::extrude_path(const ExtrusionPath &path, const std::string &description, double speed) {
 
     ExtrusionPath simplifed_path = path;
-    if (this->config().min_length.value != 0 && !m_last_too_small.empty()) {
+    const double scaled_min_length = scale_(this->config().min_length.value);
+    if (scaled_min_length > 0 && !m_last_too_small.empty()) {
         //descr += " trys fusion " + std::to_string(unscaled(m_last_too_small.last_point().x())) + " , " + std::to_string(unscaled(path.first_point().x()));
         //ensure that it's a continous thing
-        if (m_last_too_small.first_point().distance_to_square(path.first_point()) < scale_(this->config().min_length) /*&& m_last_too_small.first_point().distance_to_square(path.first_point()) > EPSILON*/) {
+        if (m_last_too_small.last_point().distance_to_square(path.first_point()) < scaled_min_length*scaled_min_length /*&& m_last_too_small.first_point().distance_to_square(path.first_point()) > EPSILON*/) {
             //descr += " ! fusion " + std::to_string(simplifed_path.polyline.points.size());
             simplifed_path.height = (m_last_too_small.height * m_last_too_small.length() + simplifed_path.height * simplifed_path.length()) / (m_last_too_small.length() + simplifed_path.length());
             simplifed_path.mm3_per_mm = (m_last_too_small.mm3_per_mm * m_last_too_small.length() + simplifed_path.mm3_per_mm * simplifed_path.length()) / (m_last_too_small.length() + simplifed_path.length());
@@ -3302,24 +3303,20 @@ std::string GCode::extrude_path(const ExtrusionPath &path, const std::string &de
         }
         m_last_too_small.polyline.points.clear();
     }
-    if (this->config().min_length.value > 0) {
-        simplifed_path.simplify(scale_(this->config().min_length));
+    if (scaled_min_length > 0) {
+        // it's an alternative to simplifed_path.simplify(scale_(this->config().min_length)); with more enphasis ont he segment length that on the feature detail.
+        // because tolerance = min_length /10, douglas_peucker will erase more points if angles are shallower than 6° and then the '_plus' will kick in to keep a bit more.
+        // if angles are all bigger than 6°, then the douglas_peucker will do all the work.
+        simplifed_path.polyline.points = MultiPoint::_douglas_peucker_plus(simplifed_path.polyline.points, scaled_min_length / 10, scaled_min_length);
     }
     //else simplifed_path.simplify(SCALED_RESOLUTION);  //should already be simplified
-    if (this->config().min_length.value != 0 && simplifed_path.length() < scale_(this->config().min_length)) {
+    if (scaled_min_length > 0 && simplifed_path.length() < scaled_min_length) {
         m_last_too_small = simplifed_path;
         return "";
-            //"; "+ descr+" .... too small for extrude: "+std::to_string(simplifed_path.length())+" < "+ std::to_string(scale_(this->config().min_length))
-            //+ " ; " + std::to_string(unscaled(path.first_point().x())) + " : " + std::to_string(unscaled(path.last_point().x()))
-            //+" =;=> " + std::to_string(unscaled(simplifed_path.first_point().x())) + " : " + std::to_string(unscaled(simplifed_path.last_point().x()))
-            //+ "\n";
     }
 
     std::string gcode = this->_extrude(simplifed_path, description, speed);
 
-    //gcode += " ; " + std::to_string(unscaled(path.first_point().x())) + " : " + std::to_string(unscaled(path.last_point().x()));
-    //gcode += " =;=> " + std::to_string(unscaled(simplifed_path.first_point().x())) + " : " + std::to_string(unscaled(simplifed_path.last_point().x()));
-
     if (m_wipe.enable) {
         m_wipe.path = std::move(simplifed_path.polyline);
         m_wipe.path.reverse();

+ 157 - 0
src/libslic3r/MultiPoint.cpp

@@ -249,6 +249,163 @@ std::vector<Point> MultiPoint::_douglas_peucker(const std::vector<Point>& pts, c
     return result_pts;
 }
 
+/// <summary>
+/// douglas_peucker will keep only points that are more than 'tolerance' out of the current polygon.
+/// But when we want to ensure we don't have a segment less than min_length, it's not very usable.
+/// This one is more effective: it will keep all points like the douglas_peucker, and also all points 
+/// in-between that satisfies the min_length, ordered by their tolerance.
+/// Note: to have a all 360 points of a circle, then you need 'tolerance  <= min_length * (1-cos(1°)) ~= min_length * 0.000155'
+/// Note: douglas_peucker is bad for simplifying circles, as it will create uneven segments.
+/// </summary>
+/// <param name="pts"></param>
+/// <param name="tolerance"></param>
+/// <param name="min_length"></param>
+/// <returns></returns>
+std::vector<Point> MultiPoint::_douglas_peucker_plus(const std::vector<Point>& pts, const double tolerance, const double min_length)
+{
+    std::vector<Point> result_pts;
+    std::vector<size_t> result_idx;
+    double tolerance_sq = tolerance * tolerance;
+    if (!pts.empty()) {
+        const Point* anchor = &pts.front();
+        size_t        anchor_idx = 0;
+        const Point* floater = &pts.back();
+        size_t        floater_idx = pts.size() - 1;
+        result_pts.reserve(pts.size());
+        result_pts.emplace_back(*anchor);
+        result_idx.reserve(pts.size());
+        result_idx.emplace_back(anchor_idx);
+        if (anchor_idx != floater_idx) {
+            assert(pts.size() > 1);
+            std::vector<size_t> dpStack;
+            dpStack.reserve(pts.size());
+            dpStack.emplace_back(floater_idx);
+            for (;;) {
+                double max_dist_sq = 0.0;
+                size_t furthest_idx = anchor_idx;
+                // find point furthest from line seg created by (anchor, floater) and note it
+                for (size_t i = anchor_idx + 1; i < floater_idx; ++i) {
+                    double dist_sq = Line::distance_to_squared(pts[i], *anchor, *floater);
+                    if (dist_sq > max_dist_sq) {
+                        max_dist_sq = dist_sq;
+                        furthest_idx = i;
+                    }
+                }
+                // remove point if less than tolerance
+                if (max_dist_sq <= tolerance_sq) {
+                    result_pts.emplace_back(*floater);
+                    result_idx.emplace_back(floater_idx);
+                    anchor_idx = floater_idx;
+                    anchor = floater;
+                    assert(dpStack.back() == floater_idx);
+                    dpStack.pop_back();
+                    if (dpStack.empty())
+                        break;
+                    floater_idx = dpStack.back();
+                } else {
+                    floater_idx = furthest_idx;
+                    dpStack.emplace_back(floater_idx);
+                }
+                floater = &pts[floater_idx];
+            }
+        }
+        assert(result_pts.front() == pts.front());
+        assert(result_pts.back() == pts.back());
+
+        //TODO use linked list if needed.
+        // add other points that are at not less than min_length dist of the other points.
+        std::vector<double> distances;
+        for (size_t segment_idx = 0; segment_idx < result_idx.size()-1; segment_idx++) {
+            distances.clear();
+            size_t start_idx = result_idx[segment_idx];
+            size_t end_idx = result_idx[segment_idx + 1];
+            if (end_idx - start_idx == 1) continue;
+            //create the list of distances
+            double sum = 0;
+            for (size_t i = start_idx; i < end_idx; i++) {
+                double dist = pts[i].distance_to(pts[i + 1]);
+                distances.push_back(dist);
+                sum += dist;
+            }
+            if (sum < min_length * 2) continue;
+            //if there are too many points and dist, then choose a more difficult sections of ~min_length * 2-4, where we will at least one
+            if (sum > min_length * 4) {
+                //check what is the last index possible
+                double current_sum = 0;
+                size_t last_possible_idx = end_idx;
+                while (current_sum < min_length * 2) {
+                    last_possible_idx--;
+                    current_sum += distances[last_possible_idx - start_idx];
+                }
+
+                //find the new end point
+                current_sum = 0;
+                size_t current_idx = start_idx;
+                while (current_sum < min_length * 4 && current_idx < last_possible_idx){
+                    current_sum += distances[current_idx - start_idx];
+                    current_idx ++;
+                }
+
+                // last check, to see if the points are well distributed enough. 
+                if (current_sum > min_length * 2 && current_idx > start_idx + 1) {
+                    //set new end
+                    sum = current_sum;
+                    end_idx = current_idx;
+                    result_idx.insert(result_idx.begin() + segment_idx + 1, end_idx);
+                    result_pts.insert(result_pts.begin() + segment_idx + 1, pts[end_idx]);
+                }
+            }
+
+            Point* start_point = &result_pts[segment_idx];
+            Point* end_point = &result_pts[segment_idx + 1];
+
+            //use at least a point, even if it's not in the middle and sum ~= min_length * 2
+            double max_dist_sq = 0.0;
+            size_t furthest_idx = start_idx + 1;
+            // find point furthest from line seg created by (anchor, floater) and note it
+            for (size_t i = start_idx + 1; i < end_idx; ++i) {
+                double dist_sq = Line::distance_to_squared(pts[i], *start_point, *end_point);
+                if (dist_sq > max_dist_sq) {
+                    max_dist_sq = dist_sq;
+                    furthest_idx = i;
+                }
+            }
+
+            //add this point and skip it
+            result_idx.insert(result_idx.begin() + segment_idx + 1, furthest_idx);
+            result_pts.insert(result_pts.begin() + segment_idx + 1, pts[furthest_idx]);
+            segment_idx++;
+        }
+
+
+#if 0
+        {
+            static int iRun = 0;
+            BoundingBox bbox(pts);
+            BoundingBox bbox2(result_pts);
+            bbox.merge(bbox2);
+            //SVG svg(debug_out_path("douglas_peucker_%d.svg", iRun ++).c_str(), bbox);
+
+            std::stringstream stri;
+            stri << "douglas_peucker_" << (iRun++) << ".svg";
+            SVG svg(stri.str());
+            if (pts.front() == pts.back())
+                svg.draw(Polygon(pts), "black");
+            else
+                svg.draw(Polyline(pts), "black");
+            if (result_pts.front() == result_pts.back())
+                svg.draw(Polygon(result_pts), "green");
+            else
+                svg.draw(Polyline(result_pts), "green", scale_(0.1));
+            svg.Close();
+        }
+#endif
+    }
+    return result_pts;
+}
+
+
+
 // Visivalingam simplification algorithm https://github.com/slic3r/Slic3r/pull/3825
 // thanks to @fuchstraumer
 /*

+ 3 - 2
src/libslic3r/MultiPoint.hpp

@@ -82,8 +82,9 @@ public:
     bool intersections(const Line &line, Points *intersections) const;
     // Projection of a point onto the lines defined by the points.
     virtual Point point_projection(const Point &point) const;
-    
-    static Points _douglas_peucker(const Points &points, const double tolerance);
+
+    static Points _douglas_peucker(const Points& points, const double tolerance);
+    static Points _douglas_peucker_plus(const Points& points, const double tolerance, const double min_length);
     static Points visivalingam(const Points& pts, const double& tolerance);
 };
 

+ 3 - 2
src/libslic3r/Print.cpp

@@ -125,12 +125,13 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
         "gcode_precision_e",
         "infill_acceleration",
         "layer_gcode",
-        "min_fan_speed",
         "max_fan_speed",
         "max_print_height",
-        "min_print_speed",
         "max_print_speed",
         "max_volumetric_speed",
+        "min_fan_speed",
+        "min_length",
+        "min_print_speed",
         "milling_toolchange_end_gcode",
         "milling_toolchange_start_gcode",
         "milling_offset",

+ 3 - 3
src/libslic3r/PrintConfig.cpp

@@ -2909,14 +2909,14 @@ void PrintConfigDef::init_fff_params()
     def->category = OptionCategory::slicing;
     def->tooltip = L("Minimum detail resolution, used to simplify the input file for speeding up "
         "the slicing job and reducing memory usage. High-resolution models often carry "
-        "more detail than printers can render. Set to zero to disable any simplification "
+        "more details than printers can render. Set to zero to disable any simplification "
         "and use full resolution from input. "
-        "\nNote: " SLIC3R_APP_NAME " has an internal resolution of 0.000001mm."
+        "\nNote: " SLIC3R_APP_NAME " has an internal working resolution of 0.0001mm."
         "\nInfill & Thin areas are simplified up to 0.0125mm.");
     def->sidetext = L("mm");
     def->min = 0;
     def->mode = comExpert;
-    def->set_default_value(new ConfigOptionFloat(0.0125));
+    def->set_default_value(new ConfigOptionFloat(0.002));
 
     def = this->add("retract_before_travel", coFloats);
     def->label = L("Minimum travel after retraction");

+ 5 - 3
src/slic3r/GUI/Plater.cpp

@@ -3095,7 +3095,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
     }
 
     //update tab if needed
-    if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED)
+    if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED && wxGetApp().app_config->get("auto_switch_preview") == "1")
     {
         if (this->preview->can_display_gcode())
             main_frame->select_tab(MainFrame::ETabType::PlaterGcode, true);
@@ -3708,7 +3708,8 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
 void Plater::priv::on_slicing_completed(wxCommandEvent & evt)
 {
     notification_manager->push_slicing_complete_notification(evt.GetInt(), is_sidebar_collapsed());
-    main_frame->select_tab(MainFrame::ETabType::PlaterPreview);
+    if(wxGetApp().app_config->get("auto_switch_preview") == "1")
+        main_frame->select_tab(MainFrame::ETabType::PlaterPreview);
     switch (this->printer_technology) {
     case ptFFF:
         this->update_fff_scene();
@@ -3788,7 +3789,8 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
     this->background_process.stop();
     this->statusbar()->reset_cancel_callback();
     this->statusbar()->stop_busy();
-    main_frame->select_tab(MainFrame::ETabType::PlaterGcode);
+    if (wxGetApp().app_config->get("auto_switch_preview") == "1")
+        main_frame->select_tab(MainFrame::ETabType::PlaterGcode);
 
     // Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
     this->background_process.reset_export();

Some files were not shown because too many files changed in this diff