You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/__test__/Nest/nfp.test.ts

21 lines
1.5 KiB

import { Polyline } from "../../src/DatabaseServices/Entity/Polyline";
import { InitClipperCpp } from "../../src/Nest/Common/ClipperCpp";
import { Curves2Points } from "../../src/Nest/Converter/Curves2Points";
import { Path } from "../../src/Nest/Core/Path";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
test('NFP结果错误', async () =>
{
await InitClipperCpp();
let dd = { "file": [2, "Polyline", 8, 2, 120, false, 1, 10, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1706.0998589562755, -98.9984767277852, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2396.3998589562757, -476.89847672778524, 0, 1], 0, 2, 4, [0, 0], 0, [315.4, 0], 0, [315.4, 378.4], 0, [0, 378.4], 0, true, "Polyline", 8, 2, 121, false, 1, 5, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1706.0998589562755, -477.39847672778524, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2396.3998589562757, -476.89847672778524, 0, 1], 0, 2, 6, [505.3999, 1079.4], 0, [189.9999, 1079.4], 0, [189.9999, 1017.4000000000001], 0, [0, 1017.4000000000001], 0, [0, 0], 0, [505.40000000000003, 0], 0, true], "basePt": { "x": -1706.0998589562755, "y": -477.39847672778524, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let d = dd.file;
let [pl1, pl2] = LoadEntityFromFileData(d) as [Polyline, Polyline];
let binPath = new Path(Curves2Points(pl2, false, 0)[1]);
let path = new Path(Curves2Points(pl1, true, 0)[1]);
expect(binPath.GetNFPs(path, true)).toMatchSnapshot();
expect(binPath.GetNFPs(path, false)).toMatchSnapshot();
});