From 3ae004d7dcea0d06e51650116bbd8dcf59ecbdd2 Mon Sep 17 00:00:00 2001 From: ChenX Date: Tue, 26 Jun 2018 17:33:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=86=E5=BC=A7=E9=9D=A2=E7=A7=AF=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Polyline/__snapshots__/polyline.test.ts.snap | 2 ++ __test__/Polyline/polyline.test.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/__test__/Polyline/__snapshots__/polyline.test.ts.snap b/__test__/Polyline/__snapshots__/polyline.test.ts.snap index 738e3f058..4c2c527e9 100644 --- a/__test__/Polyline/__snapshots__/polyline.test.ts.snap +++ b/__test__/Polyline/__snapshots__/polyline.test.ts.snap @@ -8,6 +8,8 @@ Vector3 { } `; +exports[`多段线 存在大圆弧的多段线面积 1`] = `-24.019436375469752`; + exports[`多段线 最近点精度 1`] = ` Vector3 { "x": 1.987500976448074, diff --git a/__test__/Polyline/polyline.test.ts b/__test__/Polyline/polyline.test.ts index bf66aac12..c68307cc6 100644 --- a/__test__/Polyline/polyline.test.ts +++ b/__test__/Polyline/polyline.test.ts @@ -3,6 +3,7 @@ import { Vector2, Vector3 } from 'three'; import { Polyline } from '../../src/DatabaseServices/Polyline'; import { equal, equaln } from '../../src/Geometry/GeUtils'; import { CADFile } from '../../src/DatabaseServices/CADFile'; +import { Vec2DTo3D } from '../../src/Common/CurveUtils'; test("多段线点获取参数", () => { @@ -498,4 +499,18 @@ describe('多段线', () => let p = pl.GetPointAtParam(3); expect(p).toMatchSnapshot(); }); + + test('存在大圆弧的多段线面积', () => + { + let f = new CADFile(); + f.Data = + [1, ["Polyline", 1, 1, 1606, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -19.17745164184445, -6.335408131680751, 0, 1], 2, 5, [11.884352072596577, -75.64730611519322], -1.9523252757782086, [16.25360183965801, -70.58112080246555], 0, [14.621427950114992, -70.9720172143345], 1.8583004340984604, [11.834326201222096, -73.95002751582643], 0, [11.884352072596577, -75.64730611519322], 0, false]] + + f.Read(); + + let pl = f.ReadObject() as Polyline; + + expect(pl.Area2).toMatchSnapshot(); + }); + })