From f6ba152f0e368786383057cc7cdb8acb2b48ca33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=AF=97=E6=B4=A5?= <2723065175@qq.com> Date: Tue, 9 Jan 2024 08:39:52 +0000 Subject: [PATCH] =?UTF-8?q?!2544=20=E4=BC=98=E5=8C=96:=E7=9F=A9=E5=BD=A2?= =?UTF-8?q?=E6=A7=BD=E8=B5=B0=E5=88=80=E5=9C=A8=E6=9C=80=E5=90=8E=E8=B5=B0?= =?UTF-8?q?=E5=88=80=E6=97=B6=E5=A4=9A=E8=B5=B0=E4=B8=80=E4=B8=AA=E7=9F=A9?= =?UTF-8?q?=E5=BD=A2=E5=88=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GraphicsSystem/ToolPath/FeedingToolPath.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/GraphicsSystem/ToolPath/FeedingToolPath.ts b/src/GraphicsSystem/ToolPath/FeedingToolPath.ts index baaabd382..45c5d83fc 100644 --- a/src/GraphicsSystem/ToolPath/FeedingToolPath.ts +++ b/src/GraphicsSystem/ToolPath/FeedingToolPath.ts @@ -94,12 +94,15 @@ export class FeedingToolPath extends Singleton let tempOffsetCus = GetOffsetCurves(outline, offsetDist * dir, rectInfo); retCus.push(...tempOffsetCus); - //最后一次内偏移如果是矩形,需在偏移一个刀半径避免没切到中心 + //最后一次内偏移如果是矩形 if (retCus.length === 0 && rectInfo && offsetDist > knifRadius) { - offsetDist -= knifRadius; - if (hasRedK) offsetDist += redundancyKnif; - retCus.push(...GetOffsetCurves(outline, offsetDist * dir, rectInfo)); + const rectMinLengthHalf = Math.min(rectInfo.size.x, rectInfo.size.y) / 2; + //如果最后一个矩形最小边区间一半小于刀半径减去冗余值的一半,则偏移到中心处切一次 + if (!equaln(offsetDist, rectMinLengthHalf, 1e-5) && offsetDist - rectMinLengthHalf - 1e-5 < knifRadius - redundancyKnif / 2) + { + retCus.push(...GetOffsetCurves(outline, rectMinLengthHalf * dir, rectInfo)); + } } if (retCus.length === 0) break;