From 25904f147896674357dad2a9194b9663444f37d6 Mon Sep 17 00:00:00 2001 From: Alex Koksin Date: Tue, 20 Jun 2023 15:52:59 +0400 Subject: [PATCH] fix duplicate lines in g-code --- source/MRMesh/MRToolPath.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/MRMesh/MRToolPath.cpp b/source/MRMesh/MRToolPath.cpp index 6518b913a462..c00307b8191c 100644 --- a/source/MRMesh/MRToolPath.cpp +++ b/source/MRMesh/MRToolPath.cpp @@ -147,7 +147,7 @@ tl::expected lacingToolPath( const Mesh& inputMesh, if ( bottomLeftIt < bottomRightIt ) { res.commands.reserve( res.commands.size() + std::distance( bottomLeftIt, bottomRightIt ) + 1 ); - for ( auto it = bottomLeftIt; it <= bottomRightIt; ++it ) + for ( auto it = bottomLeftIt + 1; it <= bottomRightIt; ++it ) { res.commands.push_back( { .y = it->y, .z = it->z } ); } @@ -155,7 +155,7 @@ tl::expected lacingToolPath( const Mesh& inputMesh, else { res.commands.reserve( res.commands.size() + std::distance( bottomLeftIt, contour.end() ) + std::distance( contour.begin(), bottomRightIt ) ); - for ( auto it = bottomLeftIt; it < contour.end(); ++it ) + for ( auto it = bottomLeftIt + 1; it < contour.end(); ++it ) { res.commands.push_back( { .y = it->y, .z = it->z } ); } @@ -191,7 +191,7 @@ tl::expected lacingToolPath( const Mesh& inputMesh, } else { - for ( auto it = bottomRightIt; it > contour.begin(); --it ) + for ( auto it = bottomRightIt - 1; it > contour.begin(); --it ) { res.commands.push_back( { .y = it->y, .z = it->z } ); } @@ -607,7 +607,6 @@ std::vector replaceLineSegmentsWithCircularArcs( const std::span res; - res.push_back( path[0] ); int startIdx = 0, endIdx = 0; Vector2f bestArcCenter, bestArcStart, bestArcEnd;