import { MathUtils } from "three"; import { Polyline } from "../../src/DatabaseServices/Entity/Polyline"; import { VKnifToolPath } from "../../src/GraphicsSystem/ToolPath/VKnifToolPath"; import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; test('V型刀测试', () => { let d = { "file": [5, "Polyline", 8, 2, 209, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 2, 4, [212.36464735516373, 1006.9161234266252], 0, [298.7946473551637, 1006.9161234266252], 0, [298.7946473551637, 1020.3461234266252], 0, [212.36464735516373, 1020.3461234266252], 0, true, "Polyline", 8, 2, 234, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 2, 4, [212.36464735516373, 1006.9161234266252], 0, [298.7946473551637, 1006.9161234266252], 0, [298.7946473551637, 1020.3461234266252], 0, [212.36464735516373, 1020.3461234266252], 0, true, "Polyline", 8, 2, 235, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 2, 4, [212.36464735516373, 1006.9161234266252], 0, [298.7946473551637, 1006.9161234266252], 0, [298.7946473551637, 1020.3461234266252], 0, [212.36464735516373, 1020.3461234266252], 0, true, "Polyline", 8, 2, 243, false, 1, 8, 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, 2, [193.21499999999997, 359.21500000000015], 0, [106.785, 359.21500000000015], 0, false, "Polyline", 8, 2, 254, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -105.57964735516373, -661.1311234266251, 0, 1], 0, 2, 4, [212.36464735516373, 1006.9161234266252], 0, [298.7946473551637, 1006.9161234266252], 0, [298.7946473551637, 1020.3461234266252], 0, [212.36464735516373, 1020.3461234266252], 0, true], "basePt": { "x": 106.785, "y": 345.7850000000001, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }; let pl = LoadEntityFromFileData(d)[0] as Polyline; let vd = VKnifToolPath(pl, 12, MathUtils.DEG2RAD * 120 / 2); expect(vd).toMatchSnapshot(); });