Precise Seam: remove known limitations and rework perimeter intersection (#16072)

Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
This commit is contained in:
Damir GaleevandIan Bassi authored and GitHub committed 2026-10-04 14:47:56 -03:00
1 parent 73a4ff9b16
commit b6d11b2b3a
27 files changed
+3931 -1416

No files matched your search

+1 -10
View File
@@ -331,13 +331,10 @@ Points Polygon::concave_points(double angle_threshold) const
}
// Projection of a point onto the polygon.
Point Polygon::point_projection(const Point &point, size_t *edge_index) const
Point Polygon::point_projection(const Point &point) const
{
Point proj = point;
double dmin = std::numeric_limits<double>::max();
// Preserve the existing projection and tie order while optionally tracking its edge.
if (edge_index)
*edge_index = std::numeric_limits<size_t>::max();
if (! this->points.empty()) {
for (size_t i = 0; i < this->points.size(); ++ i) {
const Point &pt0 = this->points[i];
@@ -346,15 +343,11 @@ Point Polygon::point_projection(const Point &point, size_t *edge_index) const
if (d < dmin) {
dmin = d;
proj = pt0;
if (edge_index)
*edge_index = i;
}
d = (point - pt1).cast<double>().norm();
if (d < dmin) {
dmin = d;
proj = pt1;
if (edge_index)
*edge_index = (i + 1) % this->points.size();
}
Vec2d v1(coordf_t(pt1(0) - pt0(0)), coordf_t(pt1(1) - pt0(1)));
coordf_t div = v1.squaredNorm();
@@ -367,8 +360,6 @@ Point Polygon::point_projection(const Point &point, size_t *edge_index) const
if (d < dmin) {
dmin = d;
proj = foot;
if (edge_index)
*edge_index = i;
}
}
}