diff --git a/__test__/Polyline/__snapshots__/join.test.ts.snap b/__test__/Polyline/__snapshots__/join.test.ts.snap new file mode 100644 index 000000000..96529b2c5 --- /dev/null +++ b/__test__/Polyline/__snapshots__/join.test.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`镜像的圆弧join错误 1`] = `"100.87433"`; + +exports[`镜像的圆弧join错误 2`] = `"43.04956"`; diff --git a/__test__/Polyline/join.test.ts b/__test__/Polyline/join.test.ts index 941ad715b..10d191e83 100644 --- a/__test__/Polyline/join.test.ts +++ b/__test__/Polyline/join.test.ts @@ -1,7 +1,10 @@ -import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; +import { curveLinkGroup } from "../../src/Common/CurveUtils"; +import { Curve } from "../../src/DatabaseServices/Entity/Curve"; +import { Line } from "../../src/DatabaseServices/Entity/Line"; import { Polyline } from "../../src/DatabaseServices/Entity/Polyline"; import { equaln } from "../../src/Geometry/GeUtils"; -import { Line } from "../../src/DatabaseServices/Entity/Line"; +import "../Utils/jest.util"; +import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; test('多段线与多段线Join', () => { @@ -49,3 +52,19 @@ test('一定精度容差内的直线Join', () => let lines = LoadEntityFromFileData(data) as Line[]; expect(lines[0].Join(lines[1])).toBe(1); }); + + +test('镜像的圆弧join错误', () => +{ + let data = + { "file": [5, "Arc", 10, 2, 381, 0, 1, 1, 0, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, -1.2246467991052327e-16, -1, 1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 31.950000002904744, 1814.9522549174983, -2.720676492299624e-13, 1], 0, 0, 1, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, 1.2246467991052327e-16, 1, -1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 31.950000002904744, 1814.9522549174983, -2.720676492299624e-13, 1], 0, 0, 1, 2, 3.0000000038214694, 1.570796326476423, 4.712388981340115, 1, "Line", 10, 2, 382, 0, 1, 1, 0, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, -1.2246467991052327e-16, -1, 1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, 1.2246467991052327e-16, 1, -1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, 1, [2737.030476529, -1484.0672999999997, 2.524354896707238e-29], [2724.9304765290003, -1484.0672999999997, 2.524354896707238e-29], "Arc", 10, 2, 383, 0, 1, 1, 0, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, -1.2246467991052327e-16, -1, 1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 44.04999999771144, 1814.9522549213198, -2.7206764923066435e-13, 1], 0, 0, 1, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, 1.2246467991052327e-16, 1, -1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 44.04999999771144, 1814.9522549213198, -2.7206764923066435e-13, 1], 0, 0, 1, 2, 3, 4.71238897974774, 1.5707963274318462, 1, "Line", 10, 2, 384, 0, 1, 1, 0, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, -1.2246467991052327e-16, -1, 1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, 1.2246467991052327e-16, 1, -1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, 1, [2724.9304765290003, -1478.0672999999997, 2.524354896707238e-29], [2737.0304765270894, -1478.0672999923568, 2.524354896707238e-29], "Line", 10, 2, 385, 0, 1, 1, 0, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, -1.2246467991052327e-16, -1, 1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, [-0.9999999999656061, 1.2246467991473532e-16, 0, 0, 1.2246467991052327e-16, 1, -1.836970198657849e-16, 0, -2.2496396739154126e-32, 0.000008293838842227955, -0.9999999999656061, 0, 2768.980476434901, 333.88495492131983, 0, 1], 0, 0, 1, 1, [2737.0304765270894, -1478.0672999923568, 2.524354896707238e-29], [2737.0304765270894, -1478.0672999923568, 2.524354896707238e-29]], "basePt": { "x": 28.94999999908327, "y": 1811.9522549136768, "z": -0.00002488151683044617 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }; + + let lines = LoadEntityFromFileData(data) as Curve[]; + let groups = curveLinkGroup(lines); + for (let g of groups) + { + let pl = Polyline.Combine(g, 1e-3); + expect(pl.Area2).toMatchNumberSnapshot(); + expect(pl.Length).toMatchNumberSnapshot(); + } +});