From e6d40b931494722be7df9e8f7409f5f8cc747c99 Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Sun, 1 Mar 2020 19:01:54 +0800 Subject: [PATCH] =?UTF-8?q?!762=20=E8=A1=A5=E5=85=85=E5=B7=AE=E9=9B=86?= =?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 --- __test__/Booloperate/__snapshots__/bool5.test.ts.snap | 2 ++ __test__/Booloperate/bool5.test.ts | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/__test__/Booloperate/__snapshots__/bool5.test.ts.snap b/__test__/Booloperate/__snapshots__/bool5.test.ts.snap index 3091d9dda..37500ff83 100644 --- a/__test__/Booloperate/__snapshots__/bool5.test.ts.snap +++ b/__test__/Booloperate/__snapshots__/bool5.test.ts.snap @@ -1,3 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`差集共线(圆) 1`] = `442426.78778792813`; + +exports[`差集问题 1`] = `546438.8158863322`; diff --git a/__test__/Booloperate/bool5.test.ts b/__test__/Booloperate/bool5.test.ts index e10232e1d..ba828e021 100644 --- a/__test__/Booloperate/bool5.test.ts +++ b/__test__/Booloperate/bool5.test.ts @@ -12,3 +12,14 @@ test('差集共线(圆)', () => expect(regs[0].Area).toMatchSnapshot(); }); + +test('差集问题', () => +{ + let d = { "file": [2, "Region", 7, 2, 179, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 7, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 2, "Polyline", 7, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [166.89661244019044, 262.16359808612503], 0, [361.0113684210519, 262.16359808612503], 0, [361.0113684210519, 475.46411483253655], 0, [166.89661244019044, 475.46411483253655], 0, true, "Polyline", 7, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [224.89278468899556, 700.9699521531093], 0, [516.496842105263, 700.9699521531093], 0, [516.496842105263, 756.458181818181], 0, [224.89278468899556, 756.458181818181], 0, true, "Region", 7, 2, 206, false, 1, 3, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 7, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [134.10526315789502, 423.99555980861203], 0, [419.38373205741664, 423.99555980861203], 0, [419.38373205741664, 903.3818181818185], 0, [134.10526315789502, 903.3818181818185], 0, true, 0], "basePt": { "x": 0, "y": 0, "z": 0 } }; + let regs = LoadRegionsFromFileData(d); + + regs[0].BooleanOper(regs[1], BoolOpeartionType.Subtract); + expect(regs[0].ShapeManager.ShapeList.length).toBe(1); + expect(regs[0].Explode().length).toBe(16); + expect(regs[0].Area).toMatchSnapshot(); +});