2022-10-12 12:20:27 +00:00
|
|
|
#ifndef slic3r_VoronoiUtilsCgal_hpp_
|
|
|
|
#define slic3r_VoronoiUtilsCgal_hpp_
|
|
|
|
|
|
|
|
#include "Voronoi.hpp"
|
ENH: modify the multi-material segmentation and voronoi
This patch is cherry pick from Prusa, thanks to Prusa
Rework multi-material segmentation to work directly on the Voronoi diagram without creating a copy of it.
Previous algorithms assume that they can get an invalid Voronoi diagram. Because of that, during the multi-material segmentation, a copy of the Voronoi diagram was created, and there were several attempts to fix missing vertices and edges. But as it shows, this wasn't a good enough approach and sometimes led to several issues like bleeding layers.
After generalization, our approach for detection and repairs of invalid Voronoi diagrams from Arachne, we could assume that multi-material segmentation gets non-invalid Voronoi diagrams.
With this assumption, we reimplement multi-materials segmentation to work directly on the Voronoi diagram. That should make multi-material segmentation more stable.
So, this should fix several issues like bleeding layers. Also, memory consumption should decrease by a lot. Also, there should be some speedup of multi-materials segmentation.
Jira: none
Change-Id: I72aa6e1f9634d9ee8759aa469a0b39a36ace62f5
2024-03-27 12:48:03 +00:00
|
|
|
#include "../Arachne/utils/PolygonsSegmentIndex.hpp"
|
2022-10-12 12:20:27 +00:00
|
|
|
|
|
|
|
namespace Slic3r::Geometry {
|
|
|
|
class VoronoiDiagram;
|
|
|
|
|
|
|
|
class VoronoiUtilsCgal
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Check if the Voronoi diagram is planar using CGAL sweeping edge algorithm for enumerating all intersections between lines.
|
|
|
|
static bool is_voronoi_diagram_planar_intersection(const VoronoiDiagram &voronoi_diagram);
|
|
|
|
|
|
|
|
// Check if the Voronoi diagram is planar using verification that all neighboring edges are ordered CCW for each vertex.
|
ENH: modify the multi-material segmentation and voronoi
This patch is cherry pick from Prusa, thanks to Prusa
Rework multi-material segmentation to work directly on the Voronoi diagram without creating a copy of it.
Previous algorithms assume that they can get an invalid Voronoi diagram. Because of that, during the multi-material segmentation, a copy of the Voronoi diagram was created, and there were several attempts to fix missing vertices and edges. But as it shows, this wasn't a good enough approach and sometimes led to several issues like bleeding layers.
After generalization, our approach for detection and repairs of invalid Voronoi diagrams from Arachne, we could assume that multi-material segmentation gets non-invalid Voronoi diagrams.
With this assumption, we reimplement multi-materials segmentation to work directly on the Voronoi diagram. That should make multi-material segmentation more stable.
So, this should fix several issues like bleeding layers. Also, memory consumption should decrease by a lot. Also, there should be some speedup of multi-materials segmentation.
Jira: none
Change-Id: I72aa6e1f9634d9ee8759aa469a0b39a36ace62f5
2024-03-27 12:48:03 +00:00
|
|
|
template<typename SegmentIterator>
|
|
|
|
static typename boost::polygon::enable_if<
|
|
|
|
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
|
|
|
|
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
|
|
|
bool>::type
|
|
|
|
is_voronoi_diagram_planar_angle(const VoronoiDiagram &voronoi_diagram, SegmentIterator segment_begin, SegmentIterator segment_end);
|
2022-10-12 12:20:27 +00:00
|
|
|
};
|
|
|
|
} // namespace Slic3r::Geometry
|
|
|
|
|
|
|
|
#endif // slic3r_VoronoiUtilsCgal_hpp_
|