From 0493e6e2d86c3ef0e7b8f088245355e528fd97fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Mon, 9 Sep 2024 08:57:42 +0000 Subject: [PATCH] =?UTF-8?q?!3073=20=E5=BC=80=E5=8F=91:=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=A4=96=E9=83=A8=E8=BD=AE=E5=BB=93=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=20Merge=20pull=20request=20!3073=20?= =?UTF-8?q?from=20=E6=9E=97=E4=B8=89/dev=5Fjest=5Fsnap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/Polyline/CreateContours.test.ts | 10 ++ .../__snapshots__/CreateContours.test.ts.snap | 145 ++++++++++++++++++ 2 files changed, 155 insertions(+) diff --git a/__test__/Polyline/CreateContours.test.ts b/__test__/Polyline/CreateContours.test.ts index 67999dbe9..84d50e614 100644 --- a/__test__/Polyline/CreateContours.test.ts +++ b/__test__/Polyline/CreateContours.test.ts @@ -1,3 +1,4 @@ +import { Curve } from "../../src/DatabaseServices/Entity/Curve"; import { Polyline } from "../../src/DatabaseServices/Entity/Polyline"; import { CreateContour2 } from "../../src/Geometry/CreateContour2"; import { LoadCurvesFromFileData } from "../Utils/LoadEntity.util"; @@ -9,3 +10,12 @@ test('创建外部轮廓', () => let cu = CreateContour2(con).Curve as Polyline; expect(cu.LineData).toMatchSnapshot(); }); + +test('创建外部轮廓2', () => +{ + let d = { "file": [1, "Polyline", 11, 2, 5032, 0, 1, 7, 71, [-1, 1.1102230246251565e-16, 0, 0, 2.465190328815662e-32, 2.220446049250313e-16, 1, 0, 1.1102230246251565e-16, 1, -2.220446049250313e-16, 0, 35241.53353479059, -17.999999999999616, -3674.8458462047706, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 61, 2, 21, [0, 0], 0, [-609.4731159461226, 9.968061931431293e-10], 0.1405408347059597, [-646.567464445041, -10.63663326907681], 0, [-685.2446315693451, -34.80480962448382], -0.14054083470579037, [-738.2365579603502, -50.000000000000455], 0, [-1197.7365579789184, -50.000000000325144], 0, [-1597.2770077495006, -127.66279613715642], 0.3590366866002194, [-1637.7365579789184, -176.74415531099976], 0, [-1637.736557977907, -190.00000000105547], 0.4142135623718738, [-1627.7365579789184, -200.00000000000045], 0, [-1197.7365579789184, -200.00000000000045], 0, [588.2634420200775, -199.9999999999991], 0, [1018.2634420149698, -199.99999999900047], 0.4142135625138464, [1028.2634420200775, -189.99999999721513], 0, [1028.2634420190734, -176.7441553192566], 0.3590366865886623, [987.8038917822851, -127.66279613787356], 0, [588.2634420210816, -50], 0, [128.7634420037357, -49.999999999001375], -0.1405408347049536, [75.7715156149352, -34.8048096241273], 0, [37.094348498707404, -10.636633273863481], 0.14054083475470996, [-3.637978807091713e-11, 0], 0, false], "basePt": { "x": 34213.270092770515, "y": -17.999999999999847, "z": -3874.845846204771 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] }; + let con = LoadCurvesFromFileData(d)[0] as Polyline; + let cus = con.Explode() as Curve[]; + let pl = CreateContour2(cus).Curve as Polyline; + expect(pl.LineData).toMatchSnapshot(); +}); diff --git a/__test__/Polyline/__snapshots__/CreateContours.test.ts.snap b/__test__/Polyline/__snapshots__/CreateContours.test.ts.snap index f4b221537..36c02dba6 100644 --- a/__test__/Polyline/__snapshots__/CreateContours.test.ts.snap +++ b/__test__/Polyline/__snapshots__/CreateContours.test.ts.snap @@ -39,3 +39,148 @@ Array [ }, ] `; + +exports[`创建外部轮廓2 1`] = ` +Array [ + Object { + "bul": 0, + "pt": Vector2 { + "x": 0, + "y": 0, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 430, + "y": 0, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 2215.999999998996, + "y": 1.3642420526593924e-12, + }, + }, + Object { + "bul": 0.4142135624921259, + "pt": Vector2 { + "x": 2645.999999993888, + "y": 9.999894245993346e-10, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 2655.999999998996, + "y": 10.000000002785328, + }, + }, + Object { + "bul": 0.35903668657674537, + "pt": Vector2 { + "x": 2655.999999997992, + "y": 23.255844682876614, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 2615.5404497612035, + "y": 72.3372038621269, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 2216, + "y": 150.00000000000045, + }, + }, + Object { + "bul": -0.14054083470495415, + "pt": Vector2 { + "x": 1756.4999999826541, + "y": 150.00000000099908, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 1703.5080735938536, + "y": 165.19519037587315, + }, + }, + Object { + "bul": 0.14054083475428802, + "pt": Vector2 { + "x": 1664.8309064776258, + "y": 189.36336672613697, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 1627.7365579789184, + "y": 200.00000000000045, + }, + }, + Object { + "bul": 0.14054083470638526, + "pt": Vector2 { + "x": 1018.2634420329123, + "y": 200.00000000099726, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 981.1690935338775, + "y": 189.36336673092364, + }, + }, + Object { + "bul": -0.1405408347057967, + "pt": Vector2 { + "x": 942.4919264095734, + "y": 165.19519037551663, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 889.5000000185682, + "y": 150, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": 430, + "y": 149.9999999996753, + }, + }, + Object { + "bul": 0.35903668660023796, + "pt": Vector2 { + "x": 30.459550229461456, + "y": 72.33720386285268, + }, + }, + Object { + "bul": 0, + "pt": Vector2 { + "x": -10, + "y": 23.255844689000696, + }, + }, + Object { + "bul": 0.4142135623718456, + "pt": Vector2 { + "x": -9.999999998988642, + "y": 9.999999998944986, + }, + }, +] +`;