mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-28 05:01:59 +08:00
wip
This commit is contained in:
parent
7b71d74b38
commit
6df17e1dd1
@ -978,8 +978,12 @@ MedialAxis::main_fusion(ThickPolylines& pp)
|
|||||||
if (polyline.width[idx_point] > max_width)
|
if (polyline.width[idx_point] > max_width)
|
||||||
polyline.width[idx_point] = max_width;
|
polyline.width[idx_point] = max_width;
|
||||||
//failsafe: try to not go out of the radius of the section, take the width of the merging point for that. (and with some offset)
|
//failsafe: try to not go out of the radius of the section, take the width of the merging point for that. (and with some offset)
|
||||||
if (find_main_branch && polyline.width[idx_point] > pp[biggest_main_branch_id].width.front() * 1.1)
|
coord_t main_branch_width = pp[biggest_main_branch_id].width.front();
|
||||||
polyline.width[idx_point] = pp[biggest_main_branch_id].width.front() * 1.1;
|
coord_t main_branch_dist = pp[biggest_main_branch_id].points.front().distance_to(polyline.points[idx_point]);
|
||||||
|
coord_t max_width_from_main = std::sqrt(main_branch_width*main_branch_width + main_branch_dist*main_branch_dist);
|
||||||
|
if (find_main_branch && polyline.width[idx_point] > max_width_from_main)
|
||||||
|
polyline.width[idx_point] = max_width_from_main;
|
||||||
|
//std::cout << "main fusion, max dist : " << max_width_from_main << "\n";
|
||||||
|
|
||||||
++idx_point;
|
++idx_point;
|
||||||
}
|
}
|
||||||
@ -1322,10 +1326,12 @@ MedialAxis::ensure_not_overextrude(ThickPolylines& pp)
|
|||||||
ExPolygon
|
ExPolygon
|
||||||
MedialAxis::simplify_polygon_frontier()
|
MedialAxis::simplify_polygon_frontier()
|
||||||
{
|
{
|
||||||
|
|
||||||
//simplify the boundary between us and the bounds.
|
//simplify the boundary between us and the bounds.
|
||||||
//it will remove every point in the surface contour that aren't on the bounds contour
|
|
||||||
ExPolygon simplified_poly = this->surface;
|
ExPolygon simplified_poly = this->surface;
|
||||||
|
simplified_poly.contour.remove_colinear_points(SCALED_EPSILON);
|
||||||
|
for (Polygon &hole : simplified_poly.holes)
|
||||||
|
hole.remove_colinear_points(SCALED_EPSILON);
|
||||||
|
//it will remove every point in the surface contour that aren't on the bounds contour
|
||||||
if (&this->surface != &this->bounds) {
|
if (&this->surface != &this->bounds) {
|
||||||
bool need_intersect = false;
|
bool need_intersect = false;
|
||||||
for (size_t i = 0; i < simplified_poly.contour.points.size(); i++) {
|
for (size_t i = 0; i < simplified_poly.contour.points.size(); i++) {
|
||||||
@ -1483,6 +1489,13 @@ MedialAxis::build(ThickPolylines* polylines_out) {
|
|||||||
for (ThickPolylines::const_iterator it = pp.begin(); it != pp.end(); ++it)
|
for (ThickPolylines::const_iterator it = pp.begin(); it != pp.end(); ++it)
|
||||||
max_w = std::max(max_w, *std::max_element(it->width.begin(), it->width.end()));
|
max_w = std::max(max_w, *std::max_element(it->width.begin(), it->width.end()));
|
||||||
|
|
||||||
|
//for (auto &p : pp) {
|
||||||
|
// std::cout << "Start polyline : ";
|
||||||
|
// for (auto &w : p.width) {
|
||||||
|
// std::cout << ", " << w;
|
||||||
|
// }
|
||||||
|
// std::cout << "\n";
|
||||||
|
//}
|
||||||
|
|
||||||
fusion_curve(pp);
|
fusion_curve(pp);
|
||||||
//{
|
//{
|
||||||
@ -1521,6 +1534,13 @@ MedialAxis::build(ThickPolylines* polylines_out) {
|
|||||||
extends_line_both_side(pp);
|
extends_line_both_side(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*for (auto &p : pp) {
|
||||||
|
std::cout << "Fusion polyline : ";
|
||||||
|
for (auto &w : p.width) {
|
||||||
|
std::cout << ", " << w;
|
||||||
|
}
|
||||||
|
std::cout << "\n";
|
||||||
|
}*/
|
||||||
//reduce extrusion when it's too thin to be printable
|
//reduce extrusion when it's too thin to be printable
|
||||||
remove_too_thin_extrusion(pp);
|
remove_too_thin_extrusion(pp);
|
||||||
//{
|
//{
|
||||||
@ -1605,6 +1625,14 @@ MedialAxis::build(ThickPolylines* polylines_out) {
|
|||||||
// svg.Close();
|
// svg.Close();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//for (auto &p : pp) {
|
||||||
|
// std::cout << " polyline : ";
|
||||||
|
// for (auto &w : p.width) {
|
||||||
|
// std::cout << ", " << w;
|
||||||
|
// }
|
||||||
|
// std::cout << "\n";
|
||||||
|
//}
|
||||||
|
|
||||||
polylines_out->insert(polylines_out->end(), pp.begin(), pp.end());
|
polylines_out->insert(polylines_out->end(), pp.begin(), pp.end());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -294,6 +294,11 @@ SCENARIO("thin walls: ")
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GIVEN("1° rotated tooths")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
GIVEN("narrow trapezoid")
|
GIVEN("narrow trapezoid")
|
||||||
{
|
{
|
||||||
ExPolygon expolygon;
|
ExPolygon expolygon;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user