From abb241c769f2e097820ca8be37c6b12fc3c9734b Mon Sep 17 00:00:00 2001 From: ChenX Date: Thu, 28 Jun 2018 15:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=81=8F=E7=A7=BB=E7=9A=84?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/offset.test.ts.snap | 16 ++++++++++++++ __test__/Polyline/offset.test.ts | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/__test__/Polyline/__snapshots__/offset.test.ts.snap b/__test__/Polyline/__snapshots__/offset.test.ts.snap index 22b0c818b..ca008b41b 100644 --- a/__test__/Polyline/__snapshots__/offset.test.ts.snap +++ b/__test__/Polyline/__snapshots__/offset.test.ts.snap @@ -199,6 +199,22 @@ Array [ ] `; +exports[`圆求交错误导致的线丢失 1`] = `4148.643109243218`; + +exports[`圆求交错误导致的线丢失 2`] = `4425.268216257021`; + +exports[`圆求交错误导致的线丢失 3`] = `4021.8883370297244`; + +exports[`圆求交错误导致的线丢失 4`] = `4581.211434067452`; + +exports[`圆求交错误导致的线丢失 5`] = `3900.596094685299`; + +exports[`圆求交错误导致的线丢失 6`] = `4757.455448859379`; + +exports[`圆求交错误导致的线丢失 7`] = `3783.7370117939813`; + +exports[`圆求交错误导致的线丢失 8`] = `4971.999047743294`; + exports[`拱门偏移 1`] = ` Array [ 1, diff --git a/__test__/Polyline/offset.test.ts b/__test__/Polyline/offset.test.ts index e18f0d4cc..c70064234 100644 --- a/__test__/Polyline/offset.test.ts +++ b/__test__/Polyline/offset.test.ts @@ -814,3 +814,25 @@ test('简单图形因为点在线内算法错误导致的丢失', () => expect(cus[0].Length).toMatchSnapshot(); } }); + +test('圆求交错误导致的线丢失', () => +{ + let f = new CADFile(); + f.Data = + [1, ["Polyline", 1, 1, 1077, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [245.62964413684085, 1116.1391538309313], -0.6953179171905909, [357.14209871457234, 1741.1251588427203], -0.6821635222887411, [892.2042303620135, 1596.040230558597], 0.37526047823909664, [1317.3934365017694, 1221.2756098839004], 0.14384173346393453, [1715.0964405621776, 1096.7424042631346], 0.026448384140957723, [1793.2064027435729, 1099.4889679050386], -0.1912121824403452, [733.4339688924879, 1000.3133228797258], -0.3304377553967397, [245.62964413684108, 1116.139153830931], 0, false]] + + f.Read(); + let pl = f.ReadObject() as Polyline; + + for (let d of [10, 20, 30, 40]) + { + let cus = pl.GetOffsetCurves(d); + + expect(cus.length).toBe(1); + expect(cus[0].Length).toMatchSnapshot(); + + cus = pl.GetOffsetCurves(-d); + expect(cus.length).toBe(1); + expect(cus[0].Length).toMatchSnapshot(); + } +});