From f2c7f62668558c7b79e27ac600ab7ec4ad38eb3e Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Mon, 16 Sep 2019 11:53:28 +0800 Subject: [PATCH] =?UTF-8?q?!499=20=E4=BF=AE=E5=A4=8D=E5=A4=AA=E6=9E=81?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/Polyline/offsetbug.test.ts | 13 +++++++++++++ src/GraphicsSystem/OffsetPolyline.ts | 2 ++ 2 files changed, 15 insertions(+) diff --git a/__test__/Polyline/offsetbug.test.ts b/__test__/Polyline/offsetbug.test.ts index 141a62f85..119b2e130 100644 --- a/__test__/Polyline/offsetbug.test.ts +++ b/__test__/Polyline/offsetbug.test.ts @@ -60,3 +60,16 @@ test('补充bug测试#IKWGF', () => expect(cus[2].Length).toMatchSnapshot(); }); + +test("偏移真交点判断错误", () => +{ + let data = + [1, "Polyline", 5, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1671.5225704902539, 783.1395680459682, 0, 1], 0, 0, 2, 3, [-75, -2.842170943040401e-14], 0.9999999999999997, [75, 0], -0.9999999999999997, [225, -5.684341886080802e-14], 0.9999999999999923, true] + + let pl = loadFile(data)[0]; + + //situation 1 + let cus = pl.GetOffsetCurves(75); + expect(cus.length).toBe(1); + +}) diff --git a/src/GraphicsSystem/OffsetPolyline.ts b/src/GraphicsSystem/OffsetPolyline.ts index 697626ce9..6b645e3aa 100644 --- a/src/GraphicsSystem/OffsetPolyline.ts +++ b/src/GraphicsSystem/OffsetPolyline.ts @@ -314,6 +314,7 @@ export class PolyOffsetUtil tPts = iPts.filter(p => frontLine.PtOnCurve(p) && laterLine.PtOnCurve(p) + && !equalv3(laterLine.EndPoint, p) ); } @@ -355,6 +356,7 @@ export class PolyOffsetUtil this._Polyline.GetCurveAtParam(offResList[0].index), this._RetCurves[0]); }; + cirContours = cirContours.filter(cir => cir !== undefined); this._Contours.push(...cirContours); }