Improve fuzzy skin with modifier (#6759)

* Pass all compatible regions to perimeter generator

* Simplify & unify fuzzify detection

* Simplify `to_thick_polyline`

* Group regions by fuzzy skin settings

* Initial code structure of multi-regional fuzzy skin

* Determine fuzzy type by all compatible regions

* Add fuzzy region debug

* Implement the line split algorithm

* Do splitted fuzzy in classic mode

* Disable debug macros

* Fix infinit loop issue when segment points are out of order

* Fix path connection

* Implement splitted fuzzy in Arachne mode
This commit is contained in:
Noisyfox 2024-09-23 00:41:17 +08:00 committed by GitHub
parent 3d3633f110
commit 9d3d242453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 707 additions and 92 deletions

View file

@ -3,17 +3,50 @@
#include "libslic3r.h"
#include <vector>
#include "Layer.hpp"
#include "Flow.hpp"
#include "Polygon.hpp"
#include "PrintConfig.hpp"
#include "SurfaceCollection.hpp"
namespace Slic3r {
struct FuzzySkinConfig
{
FuzzySkinType type;
coord_t thickness;
coord_t point_distance;
bool fuzzy_first_layer;
bool operator==(const FuzzySkinConfig& r) const
{
return type == r.type && thickness == r.thickness && point_distance == r.point_distance && fuzzy_first_layer == r.fuzzy_first_layer;
}
bool operator!=(const FuzzySkinConfig& r) const { return !(*this == r); }
};
}
namespace std {
template<> struct hash<Slic3r::FuzzySkinConfig>
{
size_t operator()(const Slic3r::FuzzySkinConfig& c) const noexcept
{
std::size_t seed = std::hash<Slic3r::FuzzySkinType>{}(c.type);
boost::hash_combine(seed, std::hash<coord_t>{}(c.thickness));
boost::hash_combine(seed, std::hash<coord_t>{}(c.point_distance));
boost::hash_combine(seed, std::hash<bool>{}(c.fuzzy_first_layer));
return seed;
}
};
} // namespace std
namespace Slic3r {
class PerimeterGenerator {
public:
// Inputs:
const SurfaceCollection *slices;
const LayerRegionPtrs *compatible_regions;
const ExPolygons *upper_slices;
const ExPolygons *lower_slices;
double layer_height;
@ -41,10 +74,14 @@ public:
std::pair<double, double> m_external_overhang_dist_boundary;
std::pair<double, double> m_smaller_external_overhang_dist_boundary;
bool has_fuzzy_skin = false;
bool has_fuzzy_hole = false;
std::unordered_map<FuzzySkinConfig, ExPolygons> regions_by_fuzzify;
PerimeterGenerator(
// Input:
const SurfaceCollection* slices,
const SurfaceCollection* slices,
const LayerRegionPtrs *compatible_regions,
double layer_height,
Flow flow,
const PrintRegionConfig* config,
@ -60,7 +97,7 @@ public:
SurfaceCollection* fill_surfaces,
//BBS
ExPolygons* fill_no_overlap)
: slices(slices), upper_slices(nullptr), lower_slices(nullptr), layer_height(layer_height),
: slices(slices), compatible_regions(compatible_regions), upper_slices(nullptr), lower_slices(nullptr), layer_height(layer_height),
layer_id(-1), perimeter_flow(flow), ext_perimeter_flow(flow),
overhang_flow(flow), solid_infill_flow(flow),
config(config), object_config(object_config), print_config(print_config),