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); }