mirror of https://gitee.com/cf-fz/WebCAD.git
parent
cde09ddbeb
commit
54dc1b47d2
@ -0,0 +1,11 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`求交集错误 1`] = `2`;
|
||||||
|
|
||||||
|
exports[`求交集错误 2`] = `1`;
|
||||||
|
|
||||||
|
exports[`求交集错误 3`] = `"7704.00000"`;
|
||||||
|
|
||||||
|
exports[`求交集错误 4`] = `"5771.53229"`;
|
||||||
|
|
||||||
|
exports[`求交集错误 5`] = `"0.00000"`;
|
@ -0,0 +1,23 @@
|
|||||||
|
import { Polyline } from "../../src/api";
|
||||||
|
import { Contour } from "../../src/DatabaseServices/Contour";
|
||||||
|
import "../Utils/jest.util";
|
||||||
|
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
||||||
|
|
||||||
|
test('求交集错误', () =>
|
||||||
|
{
|
||||||
|
let d = [2, "Polyline", 8, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [9.094947017729282e-12, -1411.0000000000002], 0, [9.094947017729282e-12, 2423], 0, [-17.999999999990905, 2423], 0, [-17.999999999990905, -1411.0000000000002], 0, true, "Polyline", 8, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.5140442132778844, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.5140442132778844, 0, 0, 1], 0, 2, 8, [540, 0], 0, [540, 102], 0, [552, 102], 0, [561, 2329], 0, [-0.5140442132778844, 2329], 0, [-0.5140442132778844, 2329], 0, [-0.5140442132778844, 2329], 0, [0, 0], 0, true];
|
||||||
|
|
||||||
|
let pls = LoadEntityFromFileData(d) as Polyline[];
|
||||||
|
|
||||||
|
let cons = pls.map(pl => Contour.CreateContour(pl));
|
||||||
|
|
||||||
|
let res = cons[0].GetIntersetAndUnionList(cons[1]);
|
||||||
|
|
||||||
|
expect(res.unionList.length).toMatchSnapshot();
|
||||||
|
expect(res.intersectionList.length).toMatchSnapshot();
|
||||||
|
|
||||||
|
for (let c of res.unionList)
|
||||||
|
expect(c.Length).toMatchNumberSnapshot();
|
||||||
|
for (let c of res.intersectionList)
|
||||||
|
expect(c.Length).toMatchNumberSnapshot();
|
||||||
|
});
|
Loading…
Reference in new issue