Commit Graph

35 Commits

Author SHA1 Message Date
Vojtech Bubnik
3cce6652dd Fix of Some FDM supports fail to generate due to wrongly-translated enforcer polygons. #6739
Thanks @n8bot for finding the bug.
Also removed some dead code in MM segmentation.
2021-08-10 09:41:28 +02:00
Lukáš Hejl
9223fe9291 Added clipping of finite Voronoi edges that have coordinates that don't fit inside type coord_t. 2021-08-03 13:03:06 +02:00
Lukáš Hejl
442b999a6d Fixed the wrong threshold in the multi-material segmentation. 2021-08-03 13:03:06 +02:00
Lukáš Hejl
5aed500cb4 Fixed a crash in the multi-material segmentation when projected lines are outside of the BoundingBox used for EdgeGrid. 2021-07-29 11:45:02 +02:00
Lukáš Hejl
84d84864c9 Replaced unnecessary double storing of edges in a graph for the multi-material segmentation by storing indices into a shared array of arcs. 2021-07-29 11:45:02 +02:00
Lukáš Hejl
a5d2919c58 Get rid of unnecessary double storage of processed input polygons in the multi-material segmentation as ExPolygons and also as Polygons. All processed input polygons are now stored as ExPolygons. 2021-07-29 11:45:02 +02:00
Lukáš Hejl
e96a3df61c Parallelized the projection of painted regions in multi-material segmentation. 2021-07-29 11:45:01 +02:00
Lukáš Hejl
ee788d6a72 Fixed a possible overflowing of a painted area to an unpainted area in multi-material segmentation.
It was reworked graph generation for multi-material segmentation. Now only oriented arcs in one direction are added to the graph for input polygons. This direction matches the direction of the lines in the input polygons.
2021-07-29 11:45:01 +02:00
Vojtech Bubnik
ce92075590 MMU segmentation: Implemented filtering of unprintable regions in
top/bottom propagation.
2021-07-13 14:00:21 +02:00
Vojtech Bubnik
1a72c78934 Merge branch 'vb_mmu_top_bottom' 2021-07-13 11:08:52 +02:00
Lukáš Hejl
309dc55456 Used function smooth_outward in multi-material segmentation to get rid of artifacts arisen after merging multi-volume objects. 2021-06-28 08:09:06 +02:00
Lukáš Hejl
2f2d9b034e Replaced boost::rtree in multi-material segmentation with much faster ClosestPointInRadiusLookup. 2021-06-28 08:09:06 +02:00
Lukáš Hejl
ae27f0d853 Optimized the projection of painted triangles in multi-material segmentation. Added heuristics to skip most of the expensive calculations in cases where it is certain that performing these calculations would be useless. 2021-06-28 08:09:06 +02:00
Vojtech Bubnik
69ffe12fd2 Renamed create_face_neighbors_index() to its_face_edge_ids().
Renamed its_create_neighbors_index() / its_create_neighbors_index_par() to its_face_neighbors() / its_face_neighbors_par().
New variant of its_face_edge_ids() to create edge IDs from face neighbors.
Fixed some incorrect use of _NDEBUG, it should be NDEBUG.
PrintObject::slice_support_volumes() returns newly Polygons, which are cheaper than ExPolygons.
Updated SeamPlacer and SupportMaterial to use regions defined as Polygons, not ExPolygons.
TriangleSelector::get_facets_strict() returning a patch with T-joints retriangulated.
New slice_mesh_slabs() - slicing projections of a triangle patch into top / bottom layers of slices, for MMU top / bottom segmentation.
TriangleMeshSlicer - use 64 mutexes instead of one when scattering sliced triangles into layers. This makes a big difference on modern many core desktop computers.
When applying MM segmented regions to input regions, the split regions are now re-merged with 10x higher positive offset epsilon to avoid creating gaps.
When testing for existence of paint-on supports or seam, use a more efficient has_facets() test, which does not deserialize into the expensive TriangleSelector tree structure.
GLIndexedVertexArray newly uses Eigen::AlignedBox<float, 3> for efficiency instead of our double based BoundingBoxf3.
Improved MMU painting refresh speed by optimizing generation of the vertex buffers.
Refactored MMU segmentation - projection of painted surfaces from top / bottom.
	1) Parallelized.
	2) Using the new slice_mesh_slabs() instead of projecting one triangle by the other and merging them with Clipper.
2021-06-20 15:21:12 +02:00
Lukáš Hejl
38ef600b7a Fixed an issue where multi-material segmentation ignored the last extruder. 2021-06-17 19:26:40 +02:00
Lukáš Hejl
4b82d9b280 Fixed an issue where the color of the first extruder always replaced the default color after painting in a multi-material gizmo.
multi_material_segmentation_by_painting is now returning only the painted region. Regions with default colors that aren't painted by multi-material gizmo aren't returned.
2021-06-16 06:06:37 +02:00
Lukáš Hejl
843048ade8 Fixed layers with the wrong color after multi-material segmentation on objects with multiple objects. 2021-06-16 06:06:34 +02:00
Lukáš Hejl
e0973f6a27 Added using the move operator in some parts of multi-material segmentation. 2021-06-16 06:06:34 +02:00
Lukáš Hejl
0ce6e666cf Moved debug prints out of parallel cycles, and more debug prints were added for multi-material segmentation. 2021-06-16 06:06:34 +02:00
Vojtech Bubnik
473644a94c Small MMU segmentation optimization 2021-06-04 08:46:02 +02:00
Lukáš Hejl
0ea67565d6 Cleaned up of 0a6490bab9 2021-05-28 17:36:56 +02:00
Lukáš Hejl
ed6bdbd07b Added cancellation to MMU segmentation. 2021-05-28 05:57:32 +02:00
Vojtech Bubnik
aa6cc8eef7 Some fixes after preceding merge. Moved mmu_segmented_region_max_width
from PrintConfig to PrintObjectConfig.
2021-05-26 16:14:52 +02:00
Vojtech Bubnik
4809689dcb Merge remote-tracking branch 'remotes/origin/lh_multi_material_segmentation' into vb_print_regions 2021-05-26 15:23:35 +02:00
Lukáš Hejl
94364508d1 Follow-up of 168b4afbc2: Replaced forgotten lslices in the top and bottom layer propagation in MMU segmentation. 2021-05-03 22:11:04 +02:00
Lukáš Hejl
53f6d451ff Fixed compiler warnings 2021-05-03 21:50:40 +02:00
Lukáš Hejl
60a1eecd6e Fixed possible warnings 2021-05-03 21:13:13 +02:00
Lukáš Hejl
00b369c54c Fixed MMU segmentation for cases when a contour was whole colored by one color and a hole was whole colored by a different color. 2021-05-03 21:06:46 +02:00
Lukáš Hejl
0f7bbd626e Parallelization of regions merging for MMU segmentation. 2021-05-03 21:01:52 +02:00
Lukáš Hejl
ea73c79293 Fixed a few cases of missing colored segments in MMU segmentation.
Occasionally, some input polygons contained self-intersections that caused problems with Voronoi diagrams and consequently with the extraction of colored segments by function extract_colored_segments.
Also, occasionally input polygons contained several points very close together (distance between points is 1 or so). Such close points sometimes caused that the Voronoi diagram has self-intersecting edges around these vertices. This consequently leads to issues with the extraction of colored segments by function extract_colored_segments.
2021-05-03 20:56:39 +02:00
Lukáš Hejl
ff250f5d36 Fixed MMU segmentation for multi-volume objects.
MMU segmentation no longer works directly on lslices, instead of it works on custom merged regions. So lslices in PrintObject are no longer overwritten because of MMU segmentation.
All regions are scaled by SCALED_EPSILON before merging and shrunk back by SCALED_EPSILON after merging. That fixed issues with multi-volume objects when very close regions weren't merged.
Also, small expolygons and holes are filtered out that fixed missing segmentation at the boundary of two volumes in the case of multi-volume objects.
2021-05-03 20:37:14 +02:00
Lukáš Hejl
8ae1d180c7 Extended support of MMU segmentation backed for more than three colors.
Serialization and deserialization in TriangleSelector were extended to support up to 16 materials (3 unused states left for possible later extension). These changes also affect the encoding of data from custom supports and seams, but it is backward compatible with the previous encoding. And for custom supports and seams, it is produced exactly the same data encoding as before.
2021-04-27 00:37:49 +02:00
Lukáš Hejl
ea402ff871 Fixed case in MMU segmentation when the infinity-edge in the Voronoi diagram has vertex0(), and vertex1() equals nullptr. 2021-04-27 00:36:22 +02:00
Vojtech Bubnik
3ae74a5ca8 1) New methods PrintObject::num_regions() and ::has_region() to make
the code more readable and to highlight where PrintObject::region_volumes
   are actually set and consumed.
2) Replaced Slic3r::clamp() with std::clamp(). They differ in the order
   of their parameters, thus hopefully no new bugs were introduced.
3) Some refactoring of MultiMaterialSegmentation for efficiency.
2021-04-22 11:41:26 +02:00
Vojtech Bubnik
08d553d411 MMU segmentation refactoring: Most of the MMU segmentation code
was extracted to its own file.
2021-04-20 15:07:05 +02:00