From dacdcda1d1ff4a4318fd724b34a3720456dc9ada Mon Sep 17 00:00:00 2001 From: ChenX Date: Mon, 18 Dec 2023 14:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=E8=A1=A5=E5=85=85=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Geometry/__snapshots__/lir.test.ts.snap | 45 +++++++++++++++++++ __test__/Geometry/lir.test.ts | 20 ++++++--- .../__snapshots__/offset_tool_sq.test.ts.snap | 5 +++ 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 __test__/Polyline/__snapshots__/offset_tool_sq.test.ts.snap diff --git a/__test__/Geometry/__snapshots__/lir.test.ts.snap b/__test__/Geometry/__snapshots__/lir.test.ts.snap index 75f979646..9042c906a 100644 --- a/__test__/Geometry/__snapshots__/lir.test.ts.snap +++ b/__test__/Geometry/__snapshots__/lir.test.ts.snap @@ -214,3 +214,48 @@ Array [ }, ] `; + +exports[`宽度优先的情况下 不再适合动态规划的内容 2`] = ` +Array [ + Box2 { + "max": Vector2 { + "x": 1220, + "y": 1084.2889, + }, + "min": Vector2 { + "x": 0, + "y": 668.6566, + }, + }, + Box2 { + "max": Vector2 { + "x": 354.1641, + "y": 575.6342000000001, + }, + "min": Vector2 { + "x": 0, + "y": 438.7912, + }, + }, + Box2 { + "max": Vector2 { + "x": 262.7173, + "y": 332.111, + }, + "min": Vector2 { + "x": 0, + "y": 167.1686, + }, + }, + Box2 { + "max": Vector2 { + "x": 1220, + "y": 646.8867, + }, + "min": Vector2 { + "x": 1004.6024000000001, + "y": 444.4506, + }, + }, +] +`; diff --git a/__test__/Geometry/lir.test.ts b/__test__/Geometry/lir.test.ts index 6a12f86fa..5db9a88fe 100644 --- a/__test__/Geometry/lir.test.ts +++ b/__test__/Geometry/lir.test.ts @@ -36,11 +36,19 @@ test('宽度优先的情况下 不再适合动态规划的内容', () => if (equalv3(pts[0], pts[pts.length - 1])) pts.pop(); - let lir = new LargestInteriorRectangle; - lir.GetMaxRectIndexFn = LargestInteriorRectangle.GetMaxWidthFn; - - let rects = lir.ParseLIR(pts.map(AsVector2)); - - expect(rects).toMatchSnapshot(); + { + + let lir = new LargestInteriorRectangle; + lir.GetMaxRectIndexFn = LargestInteriorRectangle.GetMaxWidthFn; + let rects = lir.ParseLIR(pts.map(AsVector2)); + expect(rects).toMatchSnapshot(); + } + + { + let lir = new LargestInteriorRectangle; + lir.GetMaxRectIndexFn = LargestInteriorRectangle.GetMaxHeightFn; + let rects = lir.ParseLIR(pts.map(AsVector2)); + expect(rects).toMatchSnapshot(); + } } }); diff --git a/__test__/Polyline/__snapshots__/offset_tool_sq.test.ts.snap b/__test__/Polyline/__snapshots__/offset_tool_sq.test.ts.snap new file mode 100644 index 000000000..4069acff6 --- /dev/null +++ b/__test__/Polyline/__snapshots__/offset_tool_sq.test.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`走刀 补直线 1`] = `1`; + +exports[`走刀 补直线 2`] = `"3972.21363"`;