From e451df27f792bf6455121a72c55c384dcd34ba32 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Tue, 5 May 2026 11:05:48 +0800 Subject: [PATCH] Fix issue of pojection calculation --- src/libslic3r/TriangleSelector.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/TriangleSelector.cpp b/src/libslic3r/TriangleSelector.cpp index 6368955fce..ba6926d227 100644 --- a/src/libslic3r/TriangleSelector.cpp +++ b/src/libslic3r/TriangleSelector.cpp @@ -2299,10 +2299,10 @@ public: Vec3f pt_a = pts_proj[idx_a]; Vec3f pt_b = pts_proj[idx_b]; if (std::abs(dist_a) > tolerance_) { - pt_a = (tolerance_ - dist_b) / (dist_a - dist_b) * (pts_proj[idx_a] - pts_proj[idx_b]); + pt_a = (tolerance_ - dist_b) / (dist_a - dist_b) * (pts_proj[idx_a] - pts_proj[idx_b]) + pts_proj[idx_b]; } if (std::abs(dist_b) > tolerance_) { - pt_b = (tolerance_ - dist_a) / (dist_b - dist_a) * (pts_proj[idx_b] - pts_proj[idx_a]); + pt_b = (tolerance_ - dist_a) / (dist_b - dist_a) * (pts_proj[idx_b] - pts_proj[idx_a]) + pts_proj[idx_a]; } // If any projected end is inside the triangle, then is in @@ -2315,7 +2315,7 @@ public: { const Vec3f uvw_a = barycentric(pt_a, vertices_[0], vertices_[1], vertices_[2]); const Vec3f uvw_b = barycentric(pt_b, vertices_[0], vertices_[1], vertices_[2]); - auto proj = [&](const Vec3f& p) -> std::pair { return {p(0), p(1)}; }; + auto proj = [](const Vec3f& p) -> std::pair { return {p(0), p(1)}; }; const Vec3f uvw_0 = {1.f,0.f,0.f}; const Vec3f uvw_1 = {0.f,1.f,0.f}; const Vec3f uvw_2 = {0.f,0.f,1.f};