!3073 开发:增加创建外部轮廓测试用例

Merge pull request !3073 from 林三/dev_jest_snap
pull/3087/MERGE
林三 3 weeks ago
parent ea3c930182
commit 0493e6e2d8

@ -1,3 +1,4 @@
import { Curve } from "../../src/DatabaseServices/Entity/Curve";
import { Polyline } from "../../src/DatabaseServices/Entity/Polyline";
import { CreateContour2 } from "../../src/Geometry/CreateContour2";
import { LoadCurvesFromFileData } from "../Utils/LoadEntity.util";
@ -9,3 +10,12 @@ test('创建外部轮廓', () =>
let cu = CreateContour2(con).Curve as Polyline;
expect(cu.LineData).toMatchSnapshot();
});
test('创建外部轮廓2', () =>
{
let d = { "file": [1, "Polyline", 11, 2, 5032, 0, 1, 7, 71, [-1, 1.1102230246251565e-16, 0, 0, 2.465190328815662e-32, 2.220446049250313e-16, 1, 0, 1.1102230246251565e-16, 1, -2.220446049250313e-16, 0, 35241.53353479059, -17.999999999999616, -3674.8458462047706, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 61, 2, 21, [0, 0], 0, [-609.4731159461226, 9.968061931431293e-10], 0.1405408347059597, [-646.567464445041, -10.63663326907681], 0, [-685.2446315693451, -34.80480962448382], -0.14054083470579037, [-738.2365579603502, -50.000000000000455], 0, [-1197.7365579789184, -50.000000000325144], 0, [-1597.2770077495006, -127.66279613715642], 0.3590366866002194, [-1637.7365579789184, -176.74415531099976], 0, [-1637.736557977907, -190.00000000105547], 0.4142135623718738, [-1627.7365579789184, -200.00000000000045], 0, [-1197.7365579789184, -200.00000000000045], 0, [588.2634420200775, -199.9999999999991], 0, [1018.2634420149698, -199.99999999900047], 0.4142135625138464, [1028.2634420200775, -189.99999999721513], 0, [1028.2634420190734, -176.7441553192566], 0.3590366865886623, [987.8038917822851, -127.66279613787356], 0, [588.2634420210816, -50], 0, [128.7634420037357, -49.999999999001375], -0.1405408347049536, [75.7715156149352, -34.8048096241273], 0, [37.094348498707404, -10.636633273863481], 0.14054083475470996, [-3.637978807091713e-11, 0], 0, false], "basePt": { "x": 34213.270092770515, "y": -17.999999999999847, "z": -3874.845846204771 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] };
let con = LoadCurvesFromFileData(d)[0] as Polyline;
let cus = con.Explode() as Curve[];
let pl = CreateContour2(cus).Curve as Polyline;
expect(pl.LineData).toMatchSnapshot();
});

@ -39,3 +39,148 @@ Array [
},
]
`;
exports[`创建外部轮廓2 1`] = `
Array [
Object {
"bul": 0,
"pt": Vector2 {
"x": 0,
"y": 0,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 430,
"y": 0,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 2215.999999998996,
"y": 1.3642420526593924e-12,
},
},
Object {
"bul": 0.4142135624921259,
"pt": Vector2 {
"x": 2645.999999993888,
"y": 9.999894245993346e-10,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 2655.999999998996,
"y": 10.000000002785328,
},
},
Object {
"bul": 0.35903668657674537,
"pt": Vector2 {
"x": 2655.999999997992,
"y": 23.255844682876614,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 2615.5404497612035,
"y": 72.3372038621269,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 2216,
"y": 150.00000000000045,
},
},
Object {
"bul": -0.14054083470495415,
"pt": Vector2 {
"x": 1756.4999999826541,
"y": 150.00000000099908,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 1703.5080735938536,
"y": 165.19519037587315,
},
},
Object {
"bul": 0.14054083475428802,
"pt": Vector2 {
"x": 1664.8309064776258,
"y": 189.36336672613697,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 1627.7365579789184,
"y": 200.00000000000045,
},
},
Object {
"bul": 0.14054083470638526,
"pt": Vector2 {
"x": 1018.2634420329123,
"y": 200.00000000099726,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 981.1690935338775,
"y": 189.36336673092364,
},
},
Object {
"bul": -0.1405408347057967,
"pt": Vector2 {
"x": 942.4919264095734,
"y": 165.19519037551663,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 889.5000000185682,
"y": 150,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": 430,
"y": 149.9999999996753,
},
},
Object {
"bul": 0.35903668660023796,
"pt": Vector2 {
"x": 30.459550229461456,
"y": 72.33720386285268,
},
},
Object {
"bul": 0,
"pt": Vector2 {
"x": -10,
"y": 23.255844689000696,
},
},
Object {
"bul": 0.4142135623718456,
"pt": Vector2 {
"x": -9.999999998988642,
"y": 9.999999998944986,
},
},
]
`;

Loading…
Cancel
Save