From c86705ab2681a9fbe1530bcde636a8558900d8eb Mon Sep 17 00:00:00 2001 From: cx Date: Fri, 29 Jun 2018 23:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E7=BA=BF=E5=92=8C=E5=9C=86=E7=9B=B8?= =?UTF-8?q?=E5=88=87=20=E6=B1=82=E4=BA=A4=E7=82=B9=E7=9A=84=E5=8D=95?= =?UTF-8?q?=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__/Geometry/__snapshots__/intersect.test.ts.snap | 10 ++++++++++ __test__/Geometry/intersect.test.ts | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/__test__/Geometry/__snapshots__/intersect.test.ts.snap b/__test__/Geometry/__snapshots__/intersect.test.ts.snap index d845fd6a5..c622cfc8c 100644 --- a/__test__/Geometry/__snapshots__/intersect.test.ts.snap +++ b/__test__/Geometry/__snapshots__/intersect.test.ts.snap @@ -146,6 +146,16 @@ Vector3 { } `; +exports[`直线和圆相切 1`] = ` +Array [ + Vector3 { + "x": 34450.21257120082, + "y": 3606.7814824644443, + "z": 0, + }, +] +`; + exports[`相交测试 1`] = ` Vector3 { "x": 0.5, diff --git a/__test__/Geometry/intersect.test.ts b/__test__/Geometry/intersect.test.ts index 0afe5bc24..a4cbba101 100644 --- a/__test__/Geometry/intersect.test.ts +++ b/__test__/Geometry/intersect.test.ts @@ -139,3 +139,13 @@ test('直线和圆 圆心和直线重合的时候', () => expect(pts.length).toBe(0); }); + +test('直线和圆相切', () => +{ + let data = + [["Line", 1, 1, 24, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.33854166666666696, 0, 1], 1, [23700.893770110895, 6917.069643795053, 0], [34450.21257120082, 3606.4429407977773, 0]], ["Circle", 1, 1, 29, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 34567.94904695702, 3989.061644487676, 0, 1], 1, 400]] + let cus = loadFile(data) as Array; + + let pts = cus[0].IntersectWith(cus[1], 0); + expect(pts).toMatchSnapshot(); +});