Compare commits

..
Author SHA1 Message Date
Ian Bassi 7b0e2f3ce5 Keep the G-code identical to main on Clipper2
Since main moved to Clipper2, parts of this branch no longer gave the same
G-code as main:

- bridge_over_infill dropped expand(limiting_area, 0.3 * flow.spacing()) as
  a no-op. The offset is below one unit, but Clipper2 still unites its
  result, which splits and merges touching polygons and so changes the
  anchor lines. Running it on the polygons next to the bridge gives main's
  anchors without the whole-layer pass.
- tsp_remove_crossings stopped at the first repeated ordering, where main
  runs on to its pn * pn cap. The loop is periodic from that point, so it
  now takes only the steps to the ordering main stops on.
- With a single tile, the tiled booleans now make the plain call instead of
  cutting the clip to the tile first.

The tiled boolean test compared rings exactly. With the safety offset a tile
unites only the clip polygons near it, and Clipper2 can then round a
crossing 1 unit differently, so that case allows 1 unit.

Comments that named ClipperLib now say Clipper, and
docs/HLSD/polygon-clipping.md describes the tiled booleans.

G-code of the five handy models in four configurations and of a baked
texture relief is byte-identical to main. Colour-painted models still
differ: segmenting each island on its own splits a colour's region into
different pieces than one diagram over the layer, which on one model also
changes the first layer's tool order.
2026-10-02 20:26:59 -03:00
ExPikaPaka d80c69341c Say what the code does, not what it replaced
The timings and the runs that never finished belong in the commit
messages, where they can be read against the change; a reader of the
code cannot check them. Kept the cost that still explains the design.

MultiPoint also spells out the consequence: a moved-from Polygon or
Polyline is now really empty where it used to silently keep its points.

The two wall spacing comments the parallel loop reindented are plain
ASCII now, so the whole file is.
2026-10-02 18:13:46 -03:00
ExPikaPaka 4a63a7d916 Compare the tiled booleans polygon by polygon
Area alone would pass on a result whose pieces were merged across tiles
or which kept the cut edges of the clip. The rings are compared after
rotating each to its lowest point and sorting, so only the ordering is
free. The fixture now also asserts it really is split into more than one
tile, which is the path being tested.
2026-10-02 18:13:46 -03:00
ExPikaPaka de1dfd0611 Hand the island's walls over instead of copying them
append(const ExtrusionEntity &) clones; the collection each island
produced was deep-copied into the layer's loops and then thrown away.
The no-overlap areas are moved as well.
2026-10-02 18:13:46 -03:00
ExPikaPaka 11a5971cef Include what the new code uses
The Windows build stopped on test_kdtree.cpp: it calls std::iota without
including <numeric>, which libstdc++ happens to pull in anyway. Added
there, and the same for <limits> and <algorithm>/<cmath> where the
recent changes rely on them being included by something else.
2026-10-02 18:13:45 -03:00
ExPikaPaka 82f37ddb3a Fix the Windows build: near and far are macros there
bridge_over_infill's helper for splitting polygons by proximity named
its locals near and far. The Windows headers define both as macros that
expand to nothing, so "Polygons near;" declared nothing and the uses of
it did not compile. Renamed; no behaviour change.
2026-10-02 18:13:37 -03:00
ExPikaPaka fb03d1a1cb Visit seam candidates as the search finds them
Collecting every candidate within the radius into a vector cost more
than the search itself. Same order, so the seams are unchanged;
align_seam_points ~19.6 s at 0.1 mm / 2000k, was ~21.
2026-10-02 18:13:37 -03:00
ExPikaPaka 2b4bdead73 Run a layer's regions in parallel where they are independent
detect_surfaces_type, process_external_surfaces and the vertical shells
each waited on their own heaviest layer in turn. The LOTR map plate
slices in ~10.5 min at 0.1 mm / 2000k, was ~11.5; ~87 s at normal
settings, was ~97.
2026-10-02 18:13:37 -03:00
ExPikaPaka b1f0d6c6f6 Move polygons instead of copying them on move
MultiPoint had no rvalue constructor, so the derived move constructors
bound to the const reference and copied; append reserved exactly, so
collecting pieces one by one was quadratic. Colour segmentation ~3 s at
0.1 mm / 2000k, was ~40, and ordinary prints gain too.
2026-10-02 18:13:37 -03:00
ExPikaPaka 14751a8b06 Project painted faces onto the shell layers per tile
Only the slices within the deepest shell offset decide the result, so
the work is done per tile of the face. Top and bottom segmentation
~130 s at 0.1 mm / 2000k, was ~180.
2026-10-02 18:13:36 -03:00
ExPikaPaka 9a86d79038 Tile the booleans on layers of many pieces
ClipperLib slows down with the number of edges on a scan line, and a
layer cut through a fine relief has tens of thousands of pieces.
detect_surfaces_type ~50 s at 0.1 mm / 2000k, was ~145.
2026-10-02 18:13:05 -03:00
ExPikaPaka d905f1a39b Merge colour and top/bottom regions per island
The merge took anything from 3 to 38 minutes at 0.1 mm / 2000k, now
~2.5. Every region is grouped with the islands it overlaps, so the
result is the same.
2026-10-02 18:12:41 -03:00
ExPikaPaka 84ec518f26 Slice fine texture relief without stalling
A colour texture baked at 0.1 mm / 2000k made the top layers thousands
of islands and slicing never finished. Colour segmentation runs per
island, the merge subtracts piece by piece, the support check tests only
nearby islands, and the travel ordering finds crossings through a grid.
2026-10-02 18:12:41 -03:00
ExPikaPaka 1fc153308f Generate walls and split solid infill in parallel
Same output, ~2.2 min for the LOTR map plate, was ~2.6.
2026-10-02 18:12:41 -03:00
ExPikaPaka 3167c3665a Run colour segmentation and vertical shells in parallel
Same output, ~2.6 min for the LOTR map plate, was ~2.9.
2026-10-02 18:12:40 -03:00
ExPikaPaka 6d34d83e78 Faster slicing of colour-painted layers
A layer split into ~1000 colour fragments (a colour texture baked over a
large top face) made several per-fragment loops redo whole-layer ClipperLib
work, so slicing took ~33 min; it now takes ~3 min with the same output.

- make_fills: clip the layer's no-overlap area to each expolygon's box
  before intersecting
- discover_vertical_shells: small-piece filter compares only against the
  nearby part of the layer
- bridge_over_infill: whole-layer union/diff/intersections restricted to the
  candidate's neighbourhood; fill boundary expanded once per spacing; anchor
  tree built only from lines crossing the scan range; bbox pre-check in the
  collision test; limiting outline taken directly instead of through
  expand(..., 0.3 * flow.spacing()), which offsets by 0.135 scaled units
  (flow.spacing() is in mm) and only cost a whole-layer pass per candidate
2026-10-02 18:11:17 -03:00
885 changed files with 1563 additions and 7418 deletions
+3 -21
View File
@@ -7,17 +7,9 @@ CheckOptions:
misc-include-cleaner.UnusedIncludes: false
# Headers that declare a symbol but are not the one to include: per-platform
# implementations of wxWidgets and Boost.Thread (a Linux run would suggest the
# GTK or pthread one), library internals and forward declarations (MSVC's STL
# __msvc_* and the Windows UCRT's corecrt_* included), CPython's headers behind
# Python.h (python3.x/ on Linux and macOS, libpython/include/ on Windows),
# curl's behind curl.h, oneTBB's behind tbb/, and
# GTK or pthread one), library internals and forward declarations, CPython's
# headers behind Python.h, curl's behind curl.h, oneTBB's behind tbb/, and
# admesh's stl.h, which the include path also exposes without its directory.
# Clipper's own clipper.hpp is only included through libslic3r/clipper.hpp or
# clipper_z.hpp, which configure it first, and Boost.Polygon's headers only
# work through boost/polygon/polygon.hpp or voronoi.hpp. Clipper2's headers
# are included through clipper2/clipper.h, or clipper2_z.hpp, which defines
# USINGZ first. minilzo's config
# headers are internal to minilzo.h.
# FFmpeg's C headers are left alone because they are only included inside
# extern "C", which an inserted include would miss. OS-specific headers (GLib,
# GTK, D-Bus, POSIX, the Windows SDK) are only used inside platform #if blocks,
@@ -31,11 +23,7 @@ CheckOptions:
.*[/\\]impl[/\\].*;
.*_fwd\.hpp;
python3\.[0-9]+[/\\].*;
libpython[/\\]include[/\\].*;
bits[/\\].*;
corecrt_.*\.h;
__msvc_.*\.hpp;
boost[/\\]multiprecision[/\\]fwd\.hpp;
imconfig\.h;
expat_external\.h;
admesh[/\\]stl\.h;
@@ -56,10 +44,4 @@ CheckOptions:
fcntl\.h;
termios\.h;
[/\\](um|shared)[/\\].*;
sal\.h;
clipper[/\\]clipper\.hpp;
png(lib)?conf\.h;
mcut[/\\]platform\.h;
boost[/\\]polygon[/\\].*;
clipper2[/\\]clipper\.(core|engine|offset|minkowski|rectclip|export|triangulation|version)\.h;
lzo(conf|defs)\.h
sal\.h
+17
View File
@@ -62,6 +62,23 @@ Clipper2 behaves differently by default, the wrapper adjusts it.
clip do not leave slivers.
- Open polylines are clipped with the non-zero rule and keep their direction.
### Tiled booleans
The sweep slows down with the number of edges crossing a scan line, so a layer
cut into thousands of pieces makes every whole-layer boolean expensive.
`diff_ex_by_piece()` and `intersection_ex_by_piece()` take a subject of
non-overlapping `ExPolygons`, group them into tiles with
`ClipperUtils::tile_expolygons()`, and run each tile in parallel against only
the clip polygons near it, cut to the tile's box. Below 128 pieces there is a
single tile, and they are the plain `diff_ex()` / `intersection_ex()`.
The result covers the same area as the plain call. Without the safety offset
the rings are the same. With it, each tile unites only the clip polygons near
it, so a clip edge that the whole-layer union splits where it crosses a distant
clip polygon stays whole, and a crossing with the subject can round 1 unit
differently. The tiles' results are concatenated in tile order, so the order of
the output `ExPolygons` differs from the plain call.
### Offsets
- Before offsetting, input vertices closer than
-43
View File
@@ -20,49 +20,6 @@
#endif /* SLIC3R_GUI */
#endif /* WIN32 */
#include <map>
#include <vector>
#include "libslic3r/PrintBase.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <cerrno>
#include <utility>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include "libslic3r/LocalesUtils.hpp"
#include <fstream>
#include <exception>
#include <set>
#include "libslic3r/Color.hpp"
#include "libslic3r/TriangleSelector.hpp"
#include <algorithm>
#include "libslic3r/Format/bbs_3mf.hpp"
#include <cstdlib>
#include <stdlib.h>
#include <stdexcept>
#include "libslic3r/Point.hpp"
#include "libslic3r_version.h"
#include "libslic3r/Semver.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/CustomGCode.hpp"
#include <memory>
#include <sstream>
#include <iomanip>
#include <iterator>
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/GCode/WipeTowerEstimate.hpp"
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
#include <functional>
#include "libslic3r/Arrange.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/GCode/ThumbnailData.hpp"
#include "slic3r/GUI/3DScene.hpp"
#include "slic3r/GUI/GLShader.hpp"
#include <cassert>
#include <boost/filesystem/exception.hpp>
#include <signal.h>
#include <cstdio>
#include <string>
#include <cstring>
-7
View File
@@ -1,14 +1,7 @@
#ifndef SLIC3R_HPP
#define SLIC3R_HPP
#include <map>
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Format/bbs_3mf.hpp"
#include "libslic3r/GCode/ThumbnailData.hpp"
#include <set>
#include <string>
#include <vector>
#include "libslic3r/Config.hpp"
#include "libslic3r/Model.hpp"
@@ -8,28 +8,6 @@
#define NANOSVGRAST_IMPLEMENTATION
#include "nanosvg/nanosvgrast.h"
#include <vector>
#include <boost/filesystem/path.hpp>
#include <map>
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <utility>
#include "libslic3r/CustomGCode.hpp"
#include <iterator>
#include <boost/smart_ptr/make_shared_object.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/log/core/record_view.hpp>
#include <boost/log/expressions/message.hpp>
#include <cstddef>
#include <exception>
#include "libslic3r/PlaceholderParser.hpp"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/errors.hpp>
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/GCode.hpp"
#include "libslic3r/GCode/WipeTower.hpp"
-1
View File
@@ -1,4 +1,3 @@
#include <iosfwd>
#include <vector>
#include <iostream>
#include <fstream>
-10
View File
@@ -4,19 +4,9 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/log/trivial.hpp>
#include <boost/program_options.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/errors.hpp>
#include <exception>
#include <cstddef>
#include <iostream>
#include <memory>
#include "libslic3r/Config.hpp"
using namespace Slic3r;
namespace fs = boost::filesystem;
-6
View File
@@ -11,19 +11,13 @@
#include "libslic3r/Utils.hpp"
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/nowide/fstream.hpp>
#include "nlohmann/json.hpp"
#include <algorithm>
#include <cstddef>
#include <exception>
#include <iostream>
#include "libslic3r/Config.hpp"
#include <map>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>
-9
View File
@@ -1,19 +1,10 @@
#include "AABBMesh.hpp"
#include "Point.hpp"
#include <Eigen/Core>
#include <Execution/ExecutionTBB.hpp>
#include <igl/Hit.h>
#include <cstddef>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <libslic3r/AABBTreeIndirect.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <limits>
#include <numeric>
#include <vector>
#ifdef SLIC3R_HOLE_RAYCASTER
#include <libslic3r/SLA/Hollowing.hpp>
-4
View File
@@ -1,10 +1,6 @@
#ifndef PRUSASLICER_AABBMESH_H
#define PRUSASLICER_AABBMESH_H
#include <cstddef>
#include <limits>
#include <cmath>
#include <cassert>
#include <memory>
#include <vector>
-5
View File
@@ -6,20 +6,15 @@
#ifndef slic3r_AABBTreeIndirect_hpp_
#define slic3r_AABBTreeIndirect_hpp_
#include <Eigen/Core>
#include <algorithm>
#include <cstddef>
#include <cassert>
#include <limits>
#include <type_traits>
#include <utility>
#include <vector>
#include <Eigen/Geometry>
#include "BoundingBox.hpp"
#include "Utils.hpp" // for next_highest_power_of_2()
#include "libslic3r.h"
// Definition of the ray intersection hit structure.
#include <igl/Hit.h>
-6
View File
@@ -6,15 +6,9 @@
#include "libslic3r.h"
#include "libslic3r/AABBTreeIndirect.hpp"
#include "libslic3r/Line.hpp"
#include <Eigen/Core>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <tuple>
#include <limits>
#include <type_traits>
#include <utility>
#include <vector>
namespace Slic3r {
-4
View File
@@ -1,11 +1,7 @@
#ifndef ASTAR_HPP
#define ASTAR_HPP
#include <cassert>
#include <cmath> // std::isinf() is here
#include <type_traits>
#include <cstddef>
#include <limits>
#include <unordered_map>
#include "libslic3r/MutablePriorityQueue.hpp"
-12
View File
@@ -1,20 +1,8 @@
#include "LineSplit.hpp"
#include "AABBTreeLines.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/ClipperZUtils.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "SVG.hpp"
#include "Utils.hpp"
#include <limits>
#include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cstddef>
#include <cassert>
#include <vector>
#include <utility>
//#define DEBUG_SPLIT_LINE
-6
View File
@@ -2,12 +2,6 @@
#define SRC_LIBSLIC3R_ALGORITHM_LINE_SPLIT_HPP_
#include "ClipperZUtils.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include <cstdint>
#include <cstddef>
#include <vector>
#include "libslic3r/ExPolygon.hpp"
namespace Slic3r {
namespace Algorithm {
@@ -1,25 +1,11 @@
#include "RegionExpansion.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Polyline.hpp"
#include "libslic3r/Polygon.hpp"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cassert>
#include <iterator>
#include <cstdint>
#include <libslic3r/AABBTreeIndirect.hpp>
#include <libslic3r/ClipperZUtils.hpp>
#include <libslic3r/ClipperUtils.hpp>
#include <libslic3r/Utils.hpp>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
namespace Slic3r {
namespace Algorithm {
@@ -1,12 +1,10 @@
#ifndef SRC_LIBSLIC3R_ALGORITHM_REGION_EXPANSION_HPP_
#define SRC_LIBSLIC3R_ALGORITHM_REGION_EXPANSION_HPP_
#include <cstddef>
#include <cstdint>
#include <libslic3r/Point.hpp>
#include <libslic3r/Polygon.hpp>
#include <libslic3r/ExPolygon.hpp>
#include <vector>
namespace Slic3r {
namespace Algorithm {
-1
View File
@@ -1,7 +1,6 @@
#ifndef ANYPTR_HPP
#define ANYPTR_HPP
#include <boost/variant/variant.hpp>
#include <memory>
#include <type_traits>
#include <boost/variant.hpp>
-14
View File
@@ -1,8 +1,3 @@
#include "Technologies.hpp"
#include "Config.hpp"
#include "PrintConfig.hpp"
#include "calib.hpp"
#include "Semver.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Format/DRC.hpp"
@@ -14,18 +9,9 @@
#include "LocalesUtils.hpp"
#include "Thread.hpp"
#include "format.hpp"
#include "libslic3r_version.h"
#include "nlohmann/json.hpp"
#include <algorithm>
#include <string>
#include <exception>
#include <boost/none.hpp>
#include <cstddef>
#include <system_error>
#include <chrono>
#include <map>
#include <cstring>
#include <utility>
#include <vector>
#include <stdexcept>
-3
View File
@@ -5,11 +5,8 @@
#include <chrono>
#include <map>
#include <string>
#include "LocalesUtils.hpp"
#include "nlohmann/json.hpp"
#include <boost/algorithm/string/trim_all.hpp>
#include <utility>
#include <vector>
#include "libslic3r/Config.hpp"
#include "libslic3r/Semver.hpp"
@@ -2,9 +2,7 @@
//CuraEngine is released under the terms of the AGPLv3 or higher.
#include "BeadingStrategy.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include <vector>
namespace Slic3r::Arachne
{
@@ -12,7 +12,6 @@
#include "DistributedBeadingStrategy.hpp"
#include "RedistributeBeadingStrategy.hpp"
#include "OuterWallInsetBeadingStrategy.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne {
@@ -6,7 +6,6 @@
#include <cassert>
#include "DistributedBeadingStrategy.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne
@@ -3,12 +3,10 @@
#include <boost/log/trivial.hpp>
#include <cassert>
#include <string>
#include <utility>
#include <cstddef>
#include "LimitedBeadingStrategy.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
@@ -6,7 +6,6 @@
#include <algorithm>
#include <utility>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne
@@ -7,7 +7,6 @@
#include <numeric>
#include <utility>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne
@@ -4,11 +4,8 @@
#include "WideningBeadingStrategy.hpp"
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne
@@ -10,18 +10,10 @@
#include <cmath>
#include <cstdint>
#include <limits>
#include <math.h>
#include <list>
#include <memory>
#include <utility>
#include <cassert>
#include <cstdlib>
#include <vector>
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
#include "libslic3r/Geometry/VoronoiUtils.hpp"
#include "ankerl/unordered_dense.h"
#include "libslic3r/Arachne/SkeletalTrapezoidationEdge.hpp"
@@ -4,12 +4,10 @@
#ifndef SKELETAL_TRAPEZOIDATION_EDGE_H
#define SKELETAL_TRAPEZOIDATION_EDGE_H
#include <cassert>
#include <memory> // smart pointers
#include <list>
#include <vector>
#include "libslic3r/libslic3r.h"
#include "utils/ExtrusionJunction.hpp"
namespace Slic3r::Arachne
@@ -6,17 +6,11 @@
#include <ankerl/unordered_dense.h>
#include <boost/log/trivial.hpp>
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <cassert>
#include <cinttypes>
#include <optional>
#include <utility>
#include "../Line.hpp"
#include "libslic3r/Arachne/utils/HalfEdge.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/utils/HalfEdgeNode.hpp"
#include "libslic3r/Arachne/SkeletalTrapezoidationEdge.hpp"
#include "libslic3r/Arachne/SkeletalTrapezoidationJoint.hpp"
#include "libslic3r/Point.hpp"
@@ -6,7 +6,6 @@
#include <memory> // smart pointers
#include "libslic3r/libslic3r.h"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategy.hpp"
namespace Slic3r::Arachne
-21
View File
@@ -2,31 +2,12 @@
// CuraEngine is released under the terms of the AGPLv3 or higher.
#include <algorithm> //For std::partition_copy and std::min_element.
#include <cstddef>
#include <cstdint>
#include <memory>
#include <cassert>
#include <cmath>
#include <math.h>
#include <limits>
#include <unordered_set>
#include "WallToolPaths.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Arachne/utils/ExtrusionLine.hpp"
#include "libslic3r/Line.hpp"
#include "libslic3r/Arachne/utils/PolygonsPointIndex.hpp"
#include "libslic3r/Flow.hpp"
#include "libslic3r/Arachne/BeadingStrategy/BeadingStrategyFactory.hpp"
#include "libslic3r/Arachne/utils/ExtrusionJunction.hpp"
#include "libslic3r/Arachne/utils/SparsePointGrid.hpp"
#include "libslic3r/Arachne/utils/SquareGrid.hpp"
#include "SkeletalTrapezoidation.hpp"
#include "../ClipperUtils.hpp"
#include "libslic3r/libslic3r.h"
#include "utils/linearAlg2D.hpp"
#include "EdgeGrid.hpp"
#include "utils/SparseLineGrid.hpp"
@@ -36,8 +17,6 @@
#include "Utils.hpp"
#include <boost/log/trivial.hpp>
#include <utility>
#include <vector>
//#define ARACHNE_STITCH_PATCH_DEBUG
-6
View File
@@ -4,16 +4,10 @@
#ifndef CURAENGINE_WALLTOOLPATHS_H
#define CURAENGINE_WALLTOOLPATHS_H
#include <cstddef>
#include <boost/container_hash/hash.hpp>
#include <memory>
#include <ankerl/unordered_dense.h>
#include <vector>
#include <utility>
#include "BeadingStrategy/BeadingStrategyFactory.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "utils/ExtrusionLine.hpp"
#include "../Polygon.hpp"
#include "../PrintConfig.hpp"
@@ -6,9 +6,6 @@
#define UTILS_EXTRUSION_JUNCTION_H
#include "../../Point.hpp"
#include "libslic3r/libslic3r.h"
#include <cstddef>
#include <vector>
namespace Slic3r::Arachne
{
@@ -2,17 +2,11 @@
//CuraEngine is released under the terms of the AGPLv3 or higher.
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include "ExtrusionLine.hpp"
#include "../../VariableWidth.hpp"
#include "libslic3r/ClipperZUtils.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include "libslic3r/Arachne/utils/ExtrusionJunction.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
@@ -22,7 +22,6 @@
#include "../../BoundingBox.hpp"
#include "../../ExtrusionEntity.hpp"
#include "../../Flow.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
namespace Slic3r {
@@ -4,9 +4,6 @@
#ifndef UTILS_POLYGONS_POINT_INDEX_H
#define UTILS_POLYGONS_POINT_INDEX_H
#include <utility>
#include <functional>
#include <cstddef>
#include <vector>
#include "../../Point.hpp"
@@ -6,10 +6,7 @@
#include <vector>
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Point.hpp"
#include "PolygonsPointIndex.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r::Arachne
{
@@ -4,7 +4,6 @@
#include "PolylineStitcher.hpp"
#include "ExtrusionLine.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/Arachne/utils/PolygonsPointIndex.hpp"
#include "libslic3r/Polygon.hpp"
@@ -6,14 +6,11 @@
#define UTILS_SPARSE_GRID_H
#include <cassert>
#include <unordered_map>
#include <cstddef>
#include <vector>
#include <functional>
#include "../../Point.hpp"
#include "SquareGrid.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r::Arachne {
@@ -6,15 +6,10 @@
#define UTILS_SPARSE_LINE_GRID_H
#include <cassert>
#include <cstddef>
#include <utility>
#include <unordered_map>
#include <vector>
#include <functional>
#include "libslic3r/Point.hpp"
#include "SparseGrid.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r::Arachne {
@@ -6,13 +6,9 @@
#define UTILS_SPARSE_POINT_GRID_H
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "libslic3r/Point.hpp"
#include "SparseGrid.hpp"
#include "libslic3r/libslic3r.h"
namespace Slic3r::Arachne {
@@ -4,11 +4,7 @@
#include "SquareGrid.hpp"
#include <cassert>
#include <cstdint>
#include <utility>
#include <functional>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
using namespace Slic3r::Arachne;
@@ -5,9 +5,6 @@
#define UTILS_LINEAR_ALG_2D_H
#include "../../Point.hpp"
#include <cstdint>
#include <math.h>
#include <cmath>
namespace Slic3r::Arachne::LinearAlg2D
{
-6
View File
@@ -1,14 +1,8 @@
#include "ArcFitter.hpp"
#include "Point.hpp"
#include "Circle.hpp"
#include "MultiPoint.hpp"
#include "Polyline.hpp"
#include "libslic3r.h"
#include <cmath>
#include <cassert>
#include <vector>
#include <cstddef>
namespace Slic3r {
-3
View File
@@ -2,9 +2,6 @@
#define slic3r_ArcFitter_hpp_
#include "Circle.hpp"
#include <cstddef>
#include "Point.hpp"
#include <vector>
namespace Slic3r {
-24
View File
@@ -1,28 +1,9 @@
#include "Arrange.hpp"
#include "ExPolygon.hpp"
#include "Point.hpp"
#include "Print.hpp"
#include "BoundingBox.hpp"
#include "PrintConfig.hpp"
#include "libslic3r.h"
#include <Eigen/Core>
#include <boost/geometry/index/parameters.hpp>
#include <functional>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstddef>
#include <boost/geometry/algorithms/convert.hpp>
#include <array>
#include <boost/geometry/index/predicates.hpp>
#include <iterator>
#include <exception>
#include <libnest2d/backends/libslic3r/geometries.hpp>
#include "libnest2d/common.hpp"
#include "libnest2d/geometry_traits_nfp.hpp"
#include "libnest2d/nester.hpp"
#include "libnest2d/geometry_traits.hpp"
#include <libnest2d/optimizers/nlopt/subplex.hpp>
#include <libnest2d/placers/nfpplacer.hpp>
#include <libnest2d/selections/firstfit.hpp>
@@ -32,11 +13,6 @@
#include <ClipperUtils.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <utility>
#include <vector>
#include <tuple>
#include <set>
#include <string>
#if defined(_MSC_VER) && defined(__clang__)
#define BOOST_NO_CXX17_HDR_STRING_VIEW
-9
View File
@@ -2,17 +2,8 @@
#define ARRANGE_HPP
#include "ExPolygon.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include "PrintConfig.hpp"
#include "Print.hpp"
#include <cmath>
#include "libslic3r.h"
#include <vector>
#include <string>
#include <functional>
#include <iostream>
#include <ostream>
#define BED_SHRINK_SEQ_PRINT 5
-3
View File
@@ -1,8 +1,5 @@
#include "BoundingBox.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include "libslic3r.h"
#include <Eigen/Core>
#include <algorithm>
#include <assert.h>
-3
View File
@@ -5,10 +5,7 @@
#include "Exception.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include <cassert>
#include <cstddef>
#include <ostream>
#include <vector>
namespace Slic3r {
-11
View File
@@ -1,18 +1,7 @@
#include "BridgeDetector.hpp"
#include "BoundingBox.hpp"
#include "ClipperUtils.hpp"
#include "ExPolygon.hpp"
#include "Geometry.hpp"
#include "libslic3r.h"
#include "Polygon.hpp"
#include "Line.hpp"
#include "Polyline.hpp"
#include "Point.hpp"
#include <algorithm>
#include <utility>
#include <vector>
#include <cstddef>
#include <cmath>
namespace Slic3r {
-7
View File
@@ -9,14 +9,7 @@
#include "PrincipalComponents2D.hpp"
#include "libslic3r.h"
#include "ExPolygon.hpp"
#include <cmath>
#include <cstdlib>
#include <limits>
#include <string>
#include <vector>
#include <tuple>
#include <unordered_map>
#include <utility>
namespace Slic3r {
-19
View File
@@ -1,37 +1,18 @@
#include "BoundingBox.hpp"
#include "BrimEarsPoint.hpp"
#include "ClipperUtils.hpp"
#include "EdgeGrid.hpp"
#include "ExPolygon.hpp"
#include "Flow.hpp"
#include "Geometry.hpp"
#include "ExtrusionEntity.hpp"
#include "Layer.hpp"
#include "Point.hpp"
#include "ObjectID.hpp"
#include "Polygon.hpp"
#include "Line.hpp"
#include "MultiPoint.hpp"
#include "Polyline.hpp"
#include "Print.hpp"
#include "PrintBase.hpp"
#include "ShortestPath.hpp"
#include "libslic3r.h"
#include "PrintConfig.hpp"
#include "MaterialType.hpp"
#include "Model.hpp"
#include <algorithm>
#include <cstddef>
#include <cmath>
#include <cstdint>
#include <limits>
#include <map>
#include <string>
#include <tbb/parallel_for.h>
#include <boost/log/trivial.hpp>
#include <utility>
#include <vector>
#ifndef NDEBUG
// #define BRIM_DEBUG_TO_SVG
-2
View File
@@ -4,10 +4,8 @@
#include "ExPolygon.hpp"
#include "ObjectID.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include<map>
#include <utility>
#include<vector>
namespace Slic3r {
-3
View File
@@ -1,10 +1,7 @@
#ifndef BRIMEARSPOINT_HPP
#define BRIMEARSPOINT_HPP
#include <cstdlib>
#include "libslic3r.h"
#include <libslic3r/Point.hpp>
#include <vector>
namespace Slic3r {
-13
View File
@@ -1,24 +1,11 @@
#include "BuildVolume.hpp"
#include "BoundingBox.hpp"
#include "ClipperUtils.hpp"
#include "Polygon.hpp"
#include "Geometry/Circle.hpp"
#include "ExtrusionEntity.hpp"
#include "TriangleMesh.hpp"
#include "Geometry/ConvexHull.hpp"
#include "GCode/GCodeProcessor.hpp"
#include "Point.hpp"
#include "libslic3r.h"
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <limits>
#include <utility>
#include <cstddef>
#include <string_view>
namespace Slic3r {
-4
View File
@@ -5,13 +5,9 @@
#include "Geometry/Circle.hpp"
#include "Polygon.hpp"
#include "BoundingBox.hpp"
#include "libslic3r.h"
#include <admesh/stl.h>
#include <array>
#include <string_view>
#include <vector>
#include <utility>
namespace Slic3r {
-16
View File
@@ -1,14 +1,8 @@
#include "libslic3r/CAD/CadDocument.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
#include "libslic3r/CAD/GeometryEngine.hpp"
#include "libslic3r/CAD/SketchConstraints.hpp"
#include "libslic3r/CAD/SketchSolver.hpp"
#include "libslic3r/CAD/SketchImport.hpp" // transform_regions for imported art
#include <Standard_Handle.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_TypeDef.hxx>
#include <array>
#include <Standard_Failure.hxx>
@@ -32,10 +26,6 @@
#include <BRepOffsetAPI_DraftAngle.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <functional>
#include <exception>
#include <cstdint>
#include <cereal/cereal.hpp>
#include <gp_Pln.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
@@ -79,18 +69,12 @@
#include <cmath>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <set>
#include <stdexcept>
#include <algorithm>
#include <sstream>
#include <cereal/archives/binary.hpp>
#include <BRepTools.hxx>
#include <string>
#include <vector>
#include <utility>
namespace Slic3r {
-4
View File
@@ -1,20 +1,16 @@
#ifndef slic3r_CadDocument_hpp_
#define slic3r_CadDocument_hpp_
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
#include "libslic3r/CAD/GeometryEngine.hpp" // FaceGroup
#include "libslic3r/Color.hpp" // ColorRGBA (per-body display colour override)
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <cereal/cereal.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/string.hpp>
#include <cstdint>
#include <cstddef>
#include <map>
#include <cereal/types/map.hpp>
#include <string>
-16
View File
@@ -1,25 +1,12 @@
#include "libslic3r/CAD/GeometryEngine.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepLProp_SLProps.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <cstddef>
#include <algorithm>
#include <GeomAbs_SurfaceType.hxx>
#include <TopAbs_Orientation.hxx>
#include <Standard_Handle.hxx>
#include <cstdint>
#include <Poly_Triangle.hxx>
#include <GeomAbs_CurveType.hxx>
#include <gp_Cylinder.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <math.h>
#include <gp_Mat.hxx>
#include <stdexcept>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
@@ -56,9 +43,6 @@
#include <array>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <utility>
namespace Slic3r {
-3
View File
@@ -1,7 +1,6 @@
#ifndef slic3r_GeometryEngine_hpp_
#define slic3r_GeometryEngine_hpp_
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include <BRepPrimAPI_MakeBox.hxx>
@@ -9,8 +8,6 @@
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeTorus.hxx>
#include <TopoDS_Shape.hxx>
#include <array>
#include <gp_Ax2.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Face.hxx>
-5
View File
@@ -1,11 +1,6 @@
#include "libslic3r/CAD/SketchConstraints.hpp"
#include "libslic3r/Point.hpp"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <vector>
namespace Slic3r {
-1
View File
@@ -2,7 +2,6 @@
#define slic3r_SketchConstraints_hpp_
#include "libslic3r/Point.hpp"
#include <Eigen/Core>
#include <vector>
#include <Eigen/Dense>
-14
View File
@@ -1,18 +1,7 @@
#include "libslic3r/CAD/SketchEngine.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include <Standard_Handle.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <GeomAbs_JoinType.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_TypeDef.hxx>
#include <TopAbs_Orientation.hxx>
#include <Poly_Triangle.hxx>
#include <TopAbs_State.hxx>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <limits>
#include <BRepBuilderAPI_MakeWire.hxx>
@@ -58,11 +47,8 @@
#include <TopoDS_Wire.hxx>
#include <GeomAPI_IntCS.hxx>
#include <map>
#include <math.h>
#include <tuple>
#include <stdexcept>
#include <vector>
#include <utility>
namespace Slic3r {
-8
View File
@@ -1,8 +1,5 @@
#include "libslic3r/CAD/SketchImport.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/EmbossShape.hpp"
#include "libslic3r/Emboss.hpp"
#include "libslic3r/NSVGUtils.hpp"
#include "libslic3r/ExPolygon.hpp"
@@ -12,11 +9,6 @@
#include <algorithm>
#include <limits>
#include <vector>
#include <string>
#include <memory>
#include <utility>
#include <nanosvg/nanosvg.h>
namespace Slic3r {
-6
View File
@@ -1,13 +1,7 @@
#include "libslic3r/CAD/SketchInference.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
#include "libslic3r/Point.hpp"
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstddef>
#include <optional>
#include <math.h>
namespace Slic3r {
-2
View File
@@ -1,9 +1,7 @@
#ifndef slic3r_SketchInference_hpp_
#define slic3r_SketchInference_hpp_
#include "libslic3r/Point.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
#include <math.h>
#include <vector>
#include <optional>
#include <cmath>
-4
View File
@@ -1,7 +1,5 @@
#include "libslic3r/CAD/SketchSolver.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
#include <math.h>
#include <slvs.h>
#include <cmath>
@@ -9,8 +7,6 @@
#include <functional>
#include <map>
#include <unordered_map>
#include <vector>
#include <utility>
namespace Slic3r {
-2
View File
@@ -1,6 +1,4 @@
#include "libslic3r/CAD/ThreadStandards.hpp"
#include <vector>
#include <string>
namespace Slic3r {
-4
View File
@@ -2,11 +2,7 @@
#define CSGMESH_HPP
#include <libslic3r/AnyPtr.hpp>
#include <libslic3r/Point.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <admesh/stl.h>
#include <string>
#include <utility>
namespace Slic3r { namespace csg {
-4
View File
@@ -1,11 +1,7 @@
#ifndef CSGMESHCOPY_HPP
#define CSGMESHCOPY_HPP
#include "libslic3r/AnyPtr.hpp"
#include "CSGMesh.hpp"
#include "libslic3r/libslic3r.h"
#include <utility>
#include <cstddef>
namespace Slic3r { namespace csg {
-4
View File
@@ -3,13 +3,9 @@
#include "CSGMesh.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/SLA/Hollowing.hpp"
#include "libslic3r/MeshSplitImpl.hpp"
#include <utility>
#include <memory>
namespace Slic3r { namespace csg {
@@ -1,17 +1,11 @@
#ifndef PERFORMCSGMESHBOOLEANS_HPP
#define PERFORMCSGMESHBOOLEANS_HPP
#include <cstddef>
#include <stack>
#include <utility>
#include <tuple>
#include <vector>
#include <boost/log/trivial.hpp>
#include "CSGMesh.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Execution/ExecutionTBB.hpp"
//#include "libslic3r/Execution/ExecutionSeq.hpp"
#include "libslic3r/MeshBoolean.hpp"
-8
View File
@@ -3,16 +3,8 @@
#include "CSGMesh.hpp"
#include <cstddef>
#include <functional>
#include <cassert>
#include <stack>
#include <vector>
#include <utility>
#include "libslic3r/ExPolygon.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Execution/Execution.hpp"
#include "libslic3r/TriangleMeshSlicer.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Execution/ExecutionTBB.hpp"
@@ -3,7 +3,6 @@
#include "CSGMesh.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
namespace Slic3r { namespace csg {
-3
View File
@@ -1,9 +1,6 @@
#ifndef slic3r_Channel_hpp_
#define slic3r_Channel_hpp_
#include <boost/optional/optional.hpp>
#include <boost/none.hpp>
#include <cstddef>
#include <memory>
#include <deque>
#include <condition_variable>
-6
View File
@@ -2,14 +2,8 @@
#include <cmath>
#include <cassert>
#include <cstddef>
#include <utility>
#include <math.h>
#include "Geometry.hpp"
#include "Point.hpp"
#include "Line.hpp"
#include "Polygon.hpp"
#include "libslic3r.h"
//BBS: Refer to ArcWelderLib for the arc fitting functions
-2
View File
@@ -3,8 +3,6 @@
#include "Point.hpp"
#include "Line.hpp"
#include "libslic3r.h"
#include <cmath>
namespace Slic3r {
+68 -14
View File
@@ -1,29 +1,17 @@
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <limits>
#include <numeric>
#include <unordered_map>
#include <tbb/parallel_for.h>
#include "ClipperUtils.hpp"
#include "BoundingBox.hpp"
#include "ExPolygon.hpp"
#include "Geometry.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include "Polyline.hpp"
#include "Line.hpp"
#include "ShortestPath.hpp"
#include "libslic3r.h"
#include "Surface.hpp"
#include <clipper2/clipper.h>
#include <utility>
#include <vector>
// #define CLIPPER_UTILS_DEBUG
@@ -800,6 +788,72 @@ Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r
{ return _clipper_ex(ctIntersection, ClipperUtils::SurfacesProvider(subject), ClipperUtils::SurfacesProvider(clip), do_safety_offset); }
Slic3r::ExPolygons intersection_ex(const Slic3r::SurfacesPtr &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset)
{ return _clipper_ex(ctIntersection, ClipperUtils::SurfacesPtrProvider(subject), ClipperUtils::ExPolygonsProvider(clip), do_safety_offset); }
namespace ClipperUtils {
std::vector<ExPolygonsTile> tile_expolygons(const ExPolygons &expolygons, size_t per_tile)
{
BoundingBox extent;
std::vector<BoundingBox> bboxes;
bboxes.reserve(expolygons.size());
for (const ExPolygon &expoly : expolygons) {
bboxes.emplace_back(get_extents(expoly));
extent.merge(bboxes.back());
}
if (! extent.defined)
return {};
const int tiles = std::clamp(int(std::sqrt(double(expolygons.size()) / double(std::max<size_t>(per_tile, 1)))), 1, 32);
const Point size = extent.size();
const coord_t tile_w = std::max<coord_t>(1, size.x() / tiles + 1), tile_h = std::max<coord_t>(1, size.y() / tiles + 1);
std::vector<ExPolygonsTile> out(size_t(tiles * tiles));
for (size_t i = 0; i < expolygons.size(); ++ i) {
const Point c = bboxes[i].center();
ExPolygonsTile &tile = out[size_t(std::clamp(int((c.y() - extent.min.y()) / tile_h), 0, tiles - 1) * tiles +
std::clamp(int((c.x() - extent.min.x()) / tile_w), 0, tiles - 1))];
tile.members.emplace_back(i);
tile.bbox.merge(bboxes[i]);
}
out.erase(std::remove_if(out.begin(), out.end(), [](const ExPolygonsTile &tile) { return tile.members.empty(); }), out.end());
return out;
}
}
static Slic3r::ExPolygons clipper_ex_by_piece(ClipType clipType, const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset)
{
// A few dozen subject ExPolygons to a tile, each tile one Clipper call with the clip cut to the tile's box.
const std::vector<ClipperUtils::ExPolygonsTile> tiles = ClipperUtils::tile_expolygons(subject, 32);
// One tile is the plain call: cutting the clip would only cost time.
if (tiles.size() <= 1)
return _clipper_ex(clipType, ClipperUtils::ExPolygonsProvider(subject), ClipperUtils::PolygonsProvider(clip), do_safety_offset);
std::vector<BoundingBox> clip_bboxes;
clip_bboxes.reserve(clip.size());
for (const Polygon &polygon : clip)
clip_bboxes.emplace_back(get_extents(polygon));
std::vector<Slic3r::ExPolygons> out_tiles(tiles.size());
tbb::parallel_for(size_t(0), tiles.size(), [&](size_t tile_idx) {
const ClipperUtils::ExPolygonsTile &tile = tiles[tile_idx];
Slic3r::ExPolygons local_subject;
local_subject.reserve(tile.members.size());
for (size_t i : tile.members)
local_subject.emplace_back(subject[i]);
// Grown so that the cut edges of the clip stay clear of the subject, also after the safety offset.
const BoundingBox bbox = tile.bbox.inflated(SCALED_EPSILON);
Polygons local_clip;
for (size_t i = 0; i < clip.size(); ++i)
if (clip_bboxes[i].overlap(bbox))
if (Polygon clipped = ClipperUtils::clip_clipper_polygon_with_subject_bbox(clip[i], bbox); ! clipped.empty())
local_clip.emplace_back(std::move(clipped));
out_tiles[tile_idx] = _clipper_ex(clipType, ClipperUtils::ExPolygonsProvider(local_subject), ClipperUtils::PolygonsProvider(local_clip), do_safety_offset);
});
Slic3r::ExPolygons out;
for (Slic3r::ExPolygons &out_tile : out_tiles)
append(out, std::move(out_tile));
return out;
}
Slic3r::ExPolygons diff_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset)
{ return clipper_ex_by_piece(ctDifference, subject, clip, do_safety_offset); }
Slic3r::ExPolygons intersection_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset)
{ return clipper_ex_by_piece(ctIntersection, subject, clip, do_safety_offset); }
// May be used to "heal" unusual models (3DLabPrints etc.) by providing fill_type (pftEvenOdd, pftNonZero, pftPositive, pftNegative).
Slic3r::ExPolygons union_ex(const Slic3r::Polygons &subject, PolyFillType fill_type)
{ return _clipper_ex(ctUnion, ClipperUtils::PolygonsProvider(subject), ClipperUtils::EmptyPathsProvider(), ApplySafetyOffset::No, fill_type); }
+15 -7
View File
@@ -1,17 +1,11 @@
#ifndef slic3r_ClipperUtils_hpp_
#define slic3r_ClipperUtils_hpp_
#include "Point.hpp"
#include "Polyline.hpp"
#include "Line.hpp"
#include "libslic3r.h"
#include "BoundingBox.hpp"
#include "ExPolygon.hpp"
#include "Polygon.hpp"
#include "Surface.hpp"
#include <cstddef>
#include <iterator>
#include <cassert>
#include <vector>
namespace Slic3r {
@@ -337,6 +331,15 @@ namespace ClipperUtils {
[[nodiscard]] Polygons clip_clipper_polygons_with_subject_bbox(const ExPolygon &src, const BoundingBox &bbox, const bool get_entire_polygons = false);
[[nodiscard]] Polygons clip_clipper_polygons_with_subject_bbox(const ExPolygons &src, const BoundingBox &bbox, const bool get_entire_polygons = false);
// Splits ExPolygons into tiles by the centres of their boxes, about `per_tile` of them to a tile, to run Clipper on a
// layer of many pieces tile by tile. Returns the non-empty tiles, each with the indices of its ExPolygons and their box.
struct ExPolygonsTile
{
BoundingBox bbox;
std::vector<size_t> members;
};
[[nodiscard]] std::vector<ExPolygonsTile> tile_expolygons(const ExPolygons &expolygons, size_t per_tile);
}
// offset Polygons
@@ -532,6 +535,11 @@ Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r
Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r::Surfaces &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
Slic3r::ExPolygons intersection_ex(const Slic3r::SurfacesPtr &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
// diff_ex() / intersection_ex() of the subject split into tiles, each against only the part of the clip near it, the tiles in
// parallel. The same area as the operation on the whole subject when its ExPolygons do not overlap, and much faster for a
// subject of thousands of pieces spread over a layer: Clipper slows down with the number of edges crossing a scan line.
Slic3r::ExPolygons diff_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
Slic3r::ExPolygons intersection_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No);
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip);
Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::ExPolygon &clip);
Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::ExPolygon &clip);
-2
View File
@@ -1,8 +1,6 @@
#include "ClipperZUtils.hpp"
#include "ClipperUtils.hpp"
#include <clipper2/clipper2_z.hpp>
#include <cstddef>
namespace Slic3r {
namespace ClipperZUtils {
-5
View File
@@ -1,13 +1,8 @@
#ifndef slic3r_ClipperZUtils_hpp_
#define slic3r_ClipperZUtils_hpp_
#include "libslic3r.h"
#include <cstddef>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <utility>
#include <vector>
#include <libslic3r/ClipperUtils.hpp>
-8
View File
@@ -1,15 +1,7 @@
#include "libslic3r.h"
#include "Color.hpp"
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <random>
#include <string>
#include <vector>
static const float INV_255 = 1.0f / 255.0f;
-2
View File
@@ -9,9 +9,7 @@
#include <cstdio>
#include <fstream>
#include <limits>
#include <string>
#include <utility>
#include <vector>
namespace Slic3r {
namespace {
-22
View File
@@ -1,6 +1,4 @@
#include "Config.hpp"
#include "Exception.hpp"
#include "Point.hpp"
#include "format.hpp"
#include "Utils.hpp"
#include "LocalesUtils.hpp"
@@ -8,20 +6,7 @@
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <boost/algorithm/string/join.hpp>
#include <cstdlib>
#include <exception>
#include <cctype>
#include <boost/algorithm/string/trim.hpp>
#include <fstream>
#include <functional>
#include <set>
#include <initializer_list>
#include <map>
#include <list>
#include <optional>
#include <memory>
#include <sstream>
#include <iostream>
#include <iomanip>
@@ -41,15 +26,8 @@
#include <boost/nowide/fstream.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/format.hpp>
#include <stdexcept>
#include <string.h>
#include <string>
#include <vector>
#include <utility>
#include <system_error>
//BBS: add json support
#include "libslic3r.h"
#include "libslic3r_version.h"
#include "nlohmann/json.hpp"
using namespace nlohmann;
-10
View File
@@ -3,11 +3,6 @@
#include <assert.h>
#include <algorithm>
#include <boost/container_hash/hash.hpp>
#include <cctype>
#include <initializer_list>
#include <limits>
#include <cmath>
#include <map>
#include <climits>
#include <cfloat>
@@ -15,15 +10,10 @@
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
#include <optional>
#include <sstream>
#include <set>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "LocalesUtils.hpp"
#include "libslic3r.h"
#include "clonable_ptr.hpp"
#include "Exception.hpp"
-4
View File
@@ -2,18 +2,14 @@
#include "ExtrusionEntity.hpp"
#include "ExtrusionEntityCollection.hpp"
#include "Layer.hpp"
#include "Line.hpp"
#include "Point.hpp"
#include "Print.hpp"
#include "SLA/IndexedMesh.hpp"
#include "libslic3r.h"
#include <Eigen/Core>
#include <cfloat>
#include <cmath>
#include <initializer_list>
#include <math.h>
#include <string>
#include <utility>
namespace Slic3r {
-4
View File
@@ -2,10 +2,6 @@
#include "Config.hpp"
#include "GCode.hpp"
#include "GCodeWriter.hpp"
#include <vector>
#include <utility>
#include <cstddef>
#include <cassert>
namespace Slic3r {
-3
View File
@@ -1,10 +1,7 @@
#ifndef slic3r_CustomGCode_hpp_
#define slic3r_CustomGCode_hpp_
#include <map>
#include <cstddef>
#include <string>
#include <utility>
#include <vector>
#include <nlohmann/json.hpp>
-34
View File
@@ -1,38 +1,4 @@
#include "CutSurface.hpp"
#include "libslic3r/Emboss.hpp"
#include <vector>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh/Surface_mesh.h>
#include "libslic3r/Point.hpp"
#include "libslic3r/ExPolygon.hpp"
#include <cstdint>
#include <limits>
#include <string>
#include <utility>
#include "libslic3r/BoundingBox.hpp"
#include <cstddef>
#include "libslic3r/Polygon.hpp"
#include <cassert>
#include <array>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <queue>
#include <CGAL/enum.h>
#include <CGAL/Kernel/global_functions_3.h>
#include <CGAL/Named_function_parameters.h>
#include "libslic3r/AABBTreeIndirect.hpp"
#include <cstdlib>
#include "libslic3r/libslic3r.h"
#include <boost/property_map/property_map.hpp>
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <iterator>
#include <optional>
#include <CGAL/Surface_mesh/IO/OFF.h>
/// models_input.obj - Check transormation of model to each others
/// projection_center.obj - circle representing center of projection with correct distance
-2
View File
@@ -1,8 +1,6 @@
#ifndef slic3r_CutSurface_hpp_
#define slic3r_CutSurface_hpp_
#include "libslic3r/BoundingBox.hpp"
#include <string>
#include <vector>
#include <admesh/stl.h> // indexed_triangle_set
#include "ExPolygon.hpp"
-11
View File
@@ -1,24 +1,13 @@
#include "CutUtils.hpp"
#include "Geometry.hpp"
#include "Point.hpp"
#include "TriangleMesh.hpp"
#include "libslic3r.h"
#include "Model.hpp"
#include "TriangleMeshSlicer.hpp"
#include "TriangleSelector.hpp"
#include "ObjectID.hpp"
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <cstddef>
#include <optional>
#include <math.h>
#include <cmath>
namespace Slic3r {
-1
View File
@@ -5,7 +5,6 @@
#include "Point.hpp"
#include "Model.hpp"
#include <optional>
#include <vector>
namespace Slic3r {
-11
View File
@@ -1,21 +1,10 @@
#include <algorithm>
#include <cstddef>
#include <cstdlib>
#include <cstdint>
#include <utility>
#include <cmath>
#include <set>
#include <vector>
#include <float.h>
#include <unordered_map>
#include <png.h>
#include "Polygon.hpp"
#include "Point.hpp"
#include "Polyline.hpp"
#include "ExPolygon.hpp"
#include "Line.hpp"
#include "libslic3r.h"
#include "ClipperUtils.hpp"
#include "EdgeGrid.hpp"
-12
View File
@@ -1,24 +1,12 @@
#ifndef slic3r_EdgeGrid_hpp_
#define slic3r_EdgeGrid_hpp_
#include <cstddef>
#include <cassert>
#include <limits>
#include <cstdlib>
#include <algorithm>
#include <stdint.h>
#include <math.h>
#include <vector>
#include <utility>
#include <string>
#include "Line.hpp"
#include "Point.hpp"
#include "BoundingBox.hpp"
#include "ExPolygon.hpp"
#include "libslic3r.h"
#include "Polygon.hpp"
#include "Polyline.hpp"
namespace Slic3r {
namespace EdgeGrid {
@@ -1,6 +1,3 @@
#include "Point.hpp"
#include "BoundingBox.hpp"
#include "Polygon.hpp"
#include "libslic3r.h"
#include "ClipperUtils.hpp"
#include "EdgeGrid.hpp"
@@ -11,14 +8,8 @@
#include "SVG.hpp"
#include "Utils.hpp"
#include <algorithm>
#include <cmath>
#include <cassert>
#include <cstddef>
#include <vector>
#include <utility>
#include <math.h>
#include <limits>
// #define CONTOUR_DISTANCE_DEBUG_SVG
-23
View File
@@ -1,35 +1,12 @@
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdint>
#include <memory>
#include <cstdio>
#include <cctype>
#include <limits>
#include <math.h>
#include <Eigen/Geometry>
#include <Eigen/Core>
#include <numeric>
#include "Emboss.hpp"
#include <optional>
#include <stdio.h>
#include <numeric>
#include <cstdlib>
#include <boost/nowide/convert.hpp>
#include <boost/log/trivial.hpp>
#include <ClipperUtils.hpp> // union_ex + for boldness(polygon extend(offset))
#include "ExPolygon.hpp"
#include <vector>
#include "AABBTreeIndirect.hpp"
#include <utility>
#include "EmbossShape.hpp"
#include <string>
#include "IntersectionPoints.hpp"
#include "Polygon.hpp"
#include "TextConfiguration.hpp"
#include "Point.hpp"
#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation
#include "imgui/imstb_truetype.h" // stbtt_fontinfo
-8
View File
@@ -1,19 +1,11 @@
#ifndef slic3r_Emboss_hpp_
#define slic3r_Emboss_hpp_
#include <string>
#include <map>
#include <utility>
#include <cassert>
#include <cstddef>
#include <functional>
#include <cstdint>
#include <vector>
#include <set>
#include <optional>
#include <memory>
#include <admesh/stl.h> // indexed_triangle_set
#include "Point.hpp"
#include "Polygon.hpp"
#include "ExPolygon.hpp"
#include "EmbossShape.hpp" // ExPolygonsWithIds
-2
View File
@@ -9,11 +9,9 @@
#include <cereal/types/vector.hpp>
#include <cereal/types/optional.hpp>
#include <cereal/archives/binary.hpp>
#include <vector>
#include "Point.hpp" // Transform3d
#include "ExPolygon.hpp"
#include "ExPolygonSerialize.hpp"
#include "libslic3r.h"
#include "nanosvg/nanosvg.h" // NSVGimage
namespace Slic3r {
-10
View File
@@ -2,23 +2,13 @@
#include "ExPolygon.hpp"
#include "Exception.hpp"
#include "Geometry/MedialAxis.hpp"
#include "Point.hpp"
#include "MultiPoint.hpp"
#include "Polygon.hpp"
#include "Line.hpp"
#include "ClipperUtils.hpp"
#include "Polyline.hpp"
#include "SVG.hpp"
#include "libslic3r.h"
#include <algorithm>
#include <cassert>
#include <limits>
#include <cstddef>
#include <cmath>
#include <cstdlib>
#include <list>
#include <utility>
#include <vector>
namespace Slic3r {

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