462{
464
465
466
467
468
469 if (!
m_vd.is_valid()) {
472
473 if (!
m_vd.is_valid())
474 BOOST_LOG_TRIVIAL(error) << "MedialAxis - Invalid Voronoi diagram even after morphological closing.";
475 }
476
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
500 if (edge->is_primary() && edge->is_finite() &&
503 this->validate_edge(&*edge)) {
504
505 this->
edge_data(*edge).first.active =
true;
506 }
507
508
509 ThickPolyline reverse_polyline;
512
513 seed_edge_data.active = false;
514
515
516 ThickPolyline polyline;
517 polyline.points.emplace_back(seed_edge->vertex0()->x(), seed_edge->vertex0()->y());
518 polyline.points.emplace_back(seed_edge->vertex1()->x(), seed_edge->vertex1()->y());
519 polyline.width.emplace_back(seed_edge_data.width_start);
520 polyline.width.emplace_back(seed_edge_data.width_end);
521
523 assert(polyline.width.size() == polyline.points.size() * 2 - 2);
524
525
526 reverse_polyline.clear();
528 polyline.points.insert(polyline.points.begin(), reverse_polyline.points.rbegin(), reverse_polyline.points.rend());
529 polyline.width.insert(polyline.width.begin(), reverse_polyline.width.rbegin(), reverse_polyline.width.rend());
530 polyline.endpoints.first = reverse_polyline.endpoints.second;
531 assert(polyline.width.size() == polyline.points.size() * 2 - 2);
532
533
534 if (polyline.first_point() == polyline.last_point()) {
535 polyline.endpoints.first = false;
536 polyline.endpoints.second = false;
537 }
538
539
540 polylines->emplace_back(std::move(polyline));
541 }
542
543 #ifdef SLIC3R_DEBUG
544 {
545 static int iRun = 0;
547 printf("Thick lines: ");
548 for (ThickPolylines::const_iterator it = polylines->begin(); it != polylines->end(); ++ it) {
550 for (ThickLines::const_iterator it2 = lines.begin(); it2 != lines.end(); ++ it2) {
551 printf("%f,%f ", it2->a_width, it2->b_width);
552 }
553 }
554 printf("\n");
555 }
556 #endif
557}
voronoi_diagram_type::const_edge_iterator const_edge_iterator
Definition Voronoi.hpp:45
#define SCALED_EPSILON
Definition libslic3r.h:109
VertexCategory vertex_category(const VD::vertex_type &v)
Definition VoronoiOffset.hpp:77
@ Inside
Definition VoronoiOffset.hpp:42
void annotate_inside_outside(VD &vd, const Lines &lines)
Definition VoronoiOffset.cpp:660
std::string debug_out_path(const char *name,...)
Definition utils.cpp:382
Lines to_lines(const ExPolygon &src)
Definition ExPolygon.hpp:124
static void dump_voronoi_to_svg(const char *path, const Geometry::VoronoiDiagram &vd, const Points &points, const Lines &lines, const Polygons &offset_curves=Polygons(), const Lines &helper_lines=Lines(), double scale=0)
Definition VoronoiVisualUtils.hpp:311
std::vector< ThickLine > ThickLines
Definition Line.hpp:22
Slic3r::ExPolygons closing_ex(const Slic3r::Polygons &polygons, const float delta1, const float delta2, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:678