FIX SPE-2674_symphysis.3mf 2/2

Island which can't create Voronoi Diagram are supported by one point in center of bounding box
This commit is contained in:
Filip Sykala - NTB T15p 2025-02-12 15:35:59 +01:00 committed by Lukas Matena
parent c7d79ec966
commit f4e61ffddd
4 changed files with 35 additions and 3 deletions

View File

@ -26,6 +26,8 @@ public:
thick_part_outline, // keep position align with island outline
thick_part_inner, // point inside wide part, without restriction on move
bad_shape_for_vd, // can't make a Voronoi diagram on the shape
permanent, // permanent support point with static position
undefined
};

View File

@ -18,6 +18,7 @@
#include <libslic3r/SVG.hpp>
#include <libslic3r/SLA/SupportPointGenerator.hpp>
#include <libslic3r/ExPolygonsIndex.hpp>
#include <libslic3r/IntersectionPoints.hpp>
#include "VoronoiGraph.hpp"
#include "Parabola.hpp"
@ -2059,7 +2060,7 @@ coord_t get_longest_distance(const IslandPartChanges& changes, Position* center
return farest_from_change;
const NodeDistance *prev_node_distance = farest_distnace;
const NodeDistance *node_distance = prev_node_distance;
const NodeDistance *node_distance = nullptr;
// iterate over longest path to find center(half distance)
while (prev_node_distance->shortest_distances[change_index].distance >= half_distance) {
node_distance = prev_node_distance;
@ -2402,16 +2403,33 @@ SupportIslandPoints uniform_support_island(
#ifdef OPTION_TO_STORE_ISLAND
if (!path.empty()){ // add center support point into image
SVG svg = draw_island(path, island, simplified_island);
svg.draw_text(Point{0, 0}, "one center support point", "black");
draw(svg, supports, config.head_radius);
}
#endif // OPTION_TO_STORE_ISLAND
return supports;
}
Slic3r::Geometry::VoronoiDiagram vd;
Geometry::VoronoiDiagram vd;
Lines lines = to_lines(simplified_island);
vd.construct_voronoi(lines.begin(), lines.end());
Slic3r::Voronoi::annotate_inside_outside(vd, lines);
assert(vd.get_issue_type() == Geometry::VoronoiDiagram::IssueType::NO_ISSUE_DETECTED);
if (vd.get_issue_type() != Geometry::VoronoiDiagram::IssueType::NO_ISSUE_DETECTED) {
// error state suppport island by one point
Point center = BoundingBox{island.contour.points}.center();
SupportIslandPoints supports;
supports.push_back(std::make_unique<SupportIslandNoMovePoint>(
center, SupportIslandInnerPoint::Type::bad_shape_for_vd));
#ifdef OPTION_TO_STORE_ISLAND
if (!path.empty()) { // add center support point into image
SVG svg = draw_island(path, island, simplified_island);
svg.draw_text(Point{0, 0}, "Can't create Voronoi Diagram for the shape", "red");
draw(svg, supports, config.head_radius);
}
#endif // OPTION_TO_STORE_ISLAND
return supports;
}
Voronoi::annotate_inside_outside(vd, lines);
VoronoiGraph skeleton = VoronoiGraphUtils::create_skeleton(vd, lines);
VoronoiGraph::ExPath longest_path;

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg height="20.860270" width="22.311550" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<marker id="endArrow" markerHeight="8" markerUnits="strokeWidth" markerWidth="10" orient="auto" refX="1" refY="5" viewBox="0 0 10 10">
<polyline fill="darkblue" points="0,0 10,5 0,10 1,5" />
</marker>
<rect fill='white' stroke='none' x='0' y='0' width='22.311550' height='20.860270'/>
<path d="M 1716256 -11015182 1795391 -11035439 1568498 -10955916 1631011 -10984708 1564236 -10960836 1564236 -10960837 1674546 -11011825 1791112 -11041943 z " style="fill: none; stroke: black; stroke-width: 0.000010; fill-type: evenodd" fill-opacity="0.000000" />
<path d="M 11.5202 10.5927 12.3116 10.7952 10.0426 10 10.6677 10.2879 10 10.0492 10 10.0492 11.1031 10.5591 12.2688 10.8603 z " style="fill: lightgray; stroke: black; stroke-width: 0.000000; fill-type: evenodd" fill-opacity="1.000000" />
<path d="M 10 10.0492 12.0868 10.7952 11.5202 10.5927 12.3116 10.7952 z " style="fill: gray; stroke: black; stroke-width: 0.000000; fill-type: evenodd" fill-opacity="1.000000" />
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -390,6 +390,7 @@ ExPolygons createTestIslands(double size)
create_cylinder_bottom_slice(),
load_svg(dir + "lm_issue.svg"), // change from thick to thin and vice versa on circle
load_svg(dir + "SPE-2674.svg"), // center of longest path lay inside of the VD node
load_svg(dir + "SPE-2674_2.svg"), // missing Voronoi vertex even after the rotation of input.
// still problem
// three support points