格式化代码,增加行尾分号

pull/556/head
ChenX 5 years ago
parent 9a91c68c50
commit 154969a368

@ -15,5 +15,9 @@
"javascript.format.enable": true,
"files.insertFinalNewline": true,
//
"formattingToggle.activateFor": ["formatOnPaste", "formatOnSave"]
"formattingToggle.activateFor": [
"formatOnPaste",
"formatOnSave"
],
"typescript.format.semicolons": "insert"
}

@ -8,13 +8,13 @@ function expectReg(alg: RegionParse)
let data1 = alg.RegionsInternal.map(o =>
{
let res = [];
o.forEach(r => { res.push(r.to.position.toArray()) })
o.forEach(r => { res.push(r.to.position.toArray()); });
return res;
});
let data2 = alg.RegionsOutline.map(o =>
{
let res = [];
o.forEach(r => { res.push(r.to.position.toArray()) })
o.forEach(r => { res.push(r.to.position.toArray()); });
return res;
});
@ -41,8 +41,8 @@ test('两个相连的区域', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7);
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(2);
expect(g.RegionsInternal.length).toBe(0);
@ -65,8 +65,8 @@ test('区域内有分割-三角形', () =>
culist.push(l1, l2, l3, l4, l5);
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(1);
expect(g.RegionsInternal.length).toBe(2);
@ -88,8 +88,8 @@ test('区域有延长线', () =>
culist.push(l1, l2, l3, l4, l5, l6);
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(1);
expect(g.RegionsInternal.length).toBe(2);
@ -113,8 +113,8 @@ test('区域内多条线', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7);
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(1);
expect(g.RegionsInternal.length).toBe(3);
@ -140,8 +140,8 @@ test('包含区域', () =>
culist.push(l1, l2, l3, l4, l5, l6, l7, l8);
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(2);
expect(g.RegionsInternal.length).toBe(0);
@ -168,11 +168,11 @@ test('测试复杂形状', () =>
new Line(new Vector3().fromArray([1.306042884990254, -0.30214424951267027, 0]), new Vector3().fromArray([2.348927875243664, -1.042884990253411, 0])),
new Line(new Vector3().fromArray([3.9668615984405444, -1.042884990253411, 0]), new Vector3().fromArray([3.586744639376219, 0.253411306042885, 0])),
new Line(new Vector3().fromArray([3.586744639376219, 0.253411306042885, 0]), new Vector3().fromArray([2.465886939571151, 1.939571150097466, 0])),
]
];
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(1);
expect(g.RegionsInternal.length).toBe(8);
@ -194,11 +194,11 @@ test('矩形套矩形', () =>
new Line(new Vector3().fromArray([14.054086973365617, -5.026969104116221, 0]), new Vector3().fromArray([14.054086973365617, -2.0467060532687644, 0])),
new Line(new Vector3().fromArray([18.54122460048426, -5.026969104116222, 0]), new Vector3().fromArray([19.5123215496368, -5.947836900726394, 0])),
new Line(new Vector3().fromArray([14.054086973365617, -2.0467060532687644, 0]), new Vector3().fromArray([18.54122460048426, -5.026969104116222, 0]))
]
];
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(1);
expect(g.RegionsInternal.length).toBe(4);
@ -217,10 +217,10 @@ test('保护伞', () =>
new Line(new Vector3().fromArray([-2.0843672456575684, 1.9106699751861045, 0]), new Vector3().fromArray([-0.33498759305210907, 2.7543424317617866, 0])),
new Line(new Vector3().fromArray([-0.33498759305210907, 2.7543424317617866, 0]), new Vector3().fromArray([-0.33498759305210946, 0.5583126550868487, 0])),
new Line(new Vector3().fromArray([-0.33498759305210946, 0.5583126550868487, 0]), new Vector3().fromArray([-2.0843672456575684, 1.9106699751861045, 0])),
]
];
let g = new RegionParse(culist);
g.RegionsOutline.length //?
g.RegionsInternal.length //?
g.RegionsOutline.length; //?
g.RegionsInternal.length; //?
expect(g.RegionsOutline.length).toBe(3);
expect(g.RegionsInternal.length).toBe(0);
@ -232,7 +232,7 @@ test('带圆弧的复杂图形测试', () =>
{
let cus = LoadCurvesFromFileData(
[23, "Line", 1, 1, -1, false, 0, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [135.10332884629918, 7.41153204925861, 0], [141.2013396407662, -3.6141642356868466, 0], "Line", 1, 1, -1, false, 1, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [141.2013396407662, -3.6141642356868466, 0], [129.0669141204631, -3.614164235686845, 0], "Line", 1, 1, -1, false, 2, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [129.0669141204631, -3.614164235686845, 0], [118.90356279635137, 9.936970863128803, 0], "Line", 1, 1, -1, false, 3, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [118.90356279635137, 9.936970863128803, 0], [129.25170232635605, 16.219769863488786, 0], "Line", 1, 1, -1, false, 4, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [129.25170232635605, 16.219769863488786, 0], [131.77714114022623, 24.28885485414719, 0], "Line", 1, 1, -1, false, 5, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [131.77714114022623, 24.28885485414719, 0], [121.09714288582433, 18.21968481731883, 0], "Line", 1, 1, -1, false, 6, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [121.09714288582433, 18.21968481731883, 0], [115.57737509027845, 20.531494667657398, 0], "Line", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [115.57737509027845, 20.531494667657398, 0], [118.90356279635137, 9.936970863128803, 0], "Line", 1, 1, -1, false, 0, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [129.25170232635605, 16.219769863488786, 0], [135.10332884629918, 7.41153204925861, 0], "Line", 1, 1, -1, false, 1, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [135.10332884629918, 7.41153204925861, 0], [141.07814750350425, 7.411532049258609, 0], "Line", 1, 1, -1, false, 2, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [141.07814750350425, 7.411532049258609, 0], [150.9951145530921, 6.9187635002107655, 0], "Line", 1, 1, -1, false, 3, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [150.9951145530921, 6.9187635002107655, 0], [146.62179368029246, 22.625761001110725, 0], "Line", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [115.57737509027845, 20.531494667657398, 0], [122.16815443379333, 33.2818808742703, 0], "Line", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [122.16815443379333, 33.2818808742703, 0], [131.77714114022623, 24.28885485414719, 0], "Line", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [131.77714114022623, 24.28885485414719, 0], [140.3389946799325, 29.339732481887566, 0], "Line", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [140.3389946799325, 29.339732481887566, 0], [146.62179368029246, 22.625761001110725, 0], "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 151.10541370131332, 26.821442121699068, 0, 1], 2, 6.14056907448819, 3.8938276244846772, 6.018122149019185, false, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 161.1393080144557, 24.097737845466003, 0, 1], 2, 4.256430496141867, 2.8765294954293896, 5.103001249079749, true, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 164.0426698023552, 17.04682100167833, 0, 1], 2, 3.368852318904628, 1.9614085954899536, 5.109952481560101, false, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 168.0577082733428, 7.485478534075631, 0, 1], 2, 7.001287685275334, 1.9683598279703076, 3.2491377039705007, true, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 156.0343039466818, 6.18741259702873, 0, 1], 2, 5.091984278064126, 0.10754505038070734, 2.997466317295445, false, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 146.05997836303806, 7.635012886374687, 0, 1], 2, 4.986840923627034, 6.139058970885238, 3.1864217771069283, true, "Arc", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 138.09073817490173, 7.277519322534491, 0, 1], 2, 2.9904136682983347, 0.04482912351713572, 3.0967635300726575, false]
)
);
let g = new RegionParse(cus);
expect(g.RegionsInternal.length).toBe(7);

@ -21,7 +21,7 @@ test('板件与板件切割_分裂成多个', () =>
[3, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -331.4882673815591, 22.964750159997493, 0, 1], 2, 1200, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 1, 2, 560.6466, 189.21820000000014, 18, false, "Polyline", 3, 2, 0, false, 0, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1827.9668979500452, -289.76232632197764, 0, 1], 2, 4, [1827.9668979500452, 755.7998263219777], 0, [1827.9668979500452, 289.76232632197764], 0, [2017.1850979500452, 289.76232632197764], 0, [2017.1850979500452, 755.7998263219777], 0.9999999999999999, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -331.4882673815591, 240.21531912679802, 487.0617703059633, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -331.4882673815591, 22.964750159997493, 0, 1], 1, "左侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[\"three\",\"three\",\"three\",\"three\",\"three\",\"three\"]}", 0, 0, "Board", 3, 2, 103, false, 1, 2, 0, [0, 0.7071067811865476, 0.7071067811865475, 0, -1, 0, 0, 0, 0, -0.7071067811865475, 0.7071067811865476, 0, 150.8430102636048, -52.19811424968327, 170.47952541755785, 1], 2, 783.3533043634961, 1175.1597867537462, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 376.7045899568675, -325.59238647697345, 0, 1], 2, 4, [-376.7045899568675, 325.59238647697345], 0, [798.4551967968786, 325.59238647697345], 0, [798.4551967968786, 1108.9456908404695], 0, [-376.7045899568675, 1108.9456908404695], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, -0.7071067811865475, 0.7071067811865476, 0, 476.43539674057826, 214.17225581291558, 436.84989548015665, 1], 0, "层板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0, "Board", 3, 2, 105, false, 1, 2, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 150.8430102636048, -84.04268340053818, 746.0908003894185, 1], 2, 1200, 1446.4691198791304, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1446.4691198791304, 0], 0, [1446.4691198791304, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 150.8430102636048, -84.04268340053818, 746.0908003894185, 1], 0, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0];
let brs = LoadBoardsFromFileData(d);
let br = brs.shift()
let br = brs.shift();
let splitBrs = CuttingBoard(br, brs);
splitBrs.push(br);
@ -37,7 +37,7 @@ test('板件与板件切割_分裂成多个', () =>
test('斜切割', () =>
{
let d =
{ "file": [2, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -2215.328823760792, 499.71410406375077, -2294.099214285263, 1], 2, 1200, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -205.28537176904496, 177.69146652013302, 0, 1], 1, "左侧板", { "roomName": "", "cabinetName": "", "boardName": "", "material": "", "color": "", "lines": 0, "bigHoleDir": 0, "composingFace": 2, "highSealed": [], "sealedUp": "1", "sealedDown": "1", "sealedLeft": "1", "sealedRight": "1", "spliteHeight": "", "spliteWidth": "", "spliteThickness": "", "highDrill": ["三合一", "三合一", "三合一", "三合一"], "frontDrill": true, "backDrill": true, "drillType": "三合一" }, 0, 0, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, -0.9502295409734979, 0, -0.31155066917163815, 0, -0.31155066917163815, 0, 0.9502295409734979, 0, -1370.93197964564, 499.71410406375077, -1535.8828067472384, 1], 2, 1210.53726169844, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1210.53726169844], 0, [0, 1210.53726169844], 0, true, 0, 3, 0, 0, 0, 2, [0.9502295409734979, 0, 0.31155066917163815, 0, 0, 1, 0, 0, -0.31155066917163815, 0, 0.9502295409734979, 0, 639.1114723461071, 177.69146652013302, 758.2164075380244, 1], 0, "层板", { "roomName": "", "cabinetName": "", "boardName": "", "material": "", "color": "", "lines": 0, "bigHoleDir": 0, "composingFace": 2, "highSealed": [], "sealedUp": "1", "sealedDown": "1", "sealedLeft": "1", "sealedRight": "1", "spliteHeight": "", "spliteWidth": "", "spliteThickness": "", "highDrill": ["三合一", "三合一", "三合一", "三合一"], "frontDrill": true, "backDrill": true, "drillType": "三合一" }, 0, 0], "basePt": { "x": -1847.3471649178755, "y": -8951.992136339191, "z": 0 } }
{ "file": [2, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -2215.328823760792, 499.71410406375077, -2294.099214285263, 1], 2, 1200, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -205.28537176904496, 177.69146652013302, 0, 1], 1, "左侧板", { "roomName": "", "cabinetName": "", "boardName": "", "material": "", "color": "", "lines": 0, "bigHoleDir": 0, "composingFace": 2, "highSealed": [], "sealedUp": "1", "sealedDown": "1", "sealedLeft": "1", "sealedRight": "1", "spliteHeight": "", "spliteWidth": "", "spliteThickness": "", "highDrill": ["三合一", "三合一", "三合一", "三合一"], "frontDrill": true, "backDrill": true, "drillType": "三合一" }, 0, 0, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, -0.9502295409734979, 0, -0.31155066917163815, 0, -0.31155066917163815, 0, 0.9502295409734979, 0, -1370.93197964564, 499.71410406375077, -1535.8828067472384, 1], 2, 1210.53726169844, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1210.53726169844], 0, [0, 1210.53726169844], 0, true, 0, 3, 0, 0, 0, 2, [0.9502295409734979, 0, 0.31155066917163815, 0, 0, 1, 0, 0, -0.31155066917163815, 0, 0.9502295409734979, 0, 639.1114723461071, 177.69146652013302, 758.2164075380244, 1], 0, "层板", { "roomName": "", "cabinetName": "", "boardName": "", "material": "", "color": "", "lines": 0, "bigHoleDir": 0, "composingFace": 2, "highSealed": [], "sealedUp": "1", "sealedDown": "1", "sealedLeft": "1", "sealedRight": "1", "spliteHeight": "", "spliteWidth": "", "spliteThickness": "", "highDrill": ["三合一", "三合一", "三合一", "三合一"], "frontDrill": true, "backDrill": true, "drillType": "三合一" }, 0, 0], "basePt": { "x": -1847.3471649178755, "y": -8951.992136339191, "z": 0 } };
{
let [br0, br1] = LoadBoardsFromFileData(d) as Board[];

@ -6,7 +6,7 @@ import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util";
test('2没有洞的面域,相交', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-2.8550724637681157, -3.3478260869565215], 0, [1.4347826086956512, -3.3478260869565215], 0, [1.4347826086956512, -0.304347826086957], 0, [-2.8550724637681157, -0.304347826086957], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.4492753623188404, -4.695652173913043], 0, [2.2753623188405787, -4.695652173913043], 0, [2.2753623188405787, -1.434782608695652], 0, [-1.4492753623188404, -1.434782608695652], 0, true, 0]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-2.8550724637681157, -3.3478260869565215], 0, [1.4347826086956512, -3.3478260869565215], 0, [1.4347826086956512, -0.304347826086957], 0, [-2.8550724637681157, -0.304347826086957], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.4492753623188404, -4.695652173913043], 0, [2.2753623188405787, -4.695652173913043], 0, [2.2753623188405787, -1.434782608695652], 0, [-1.4492753623188404, -1.434782608695652], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Intersection);
@ -21,16 +21,16 @@ test('2没有洞的面域,相交', () =>
test('2面域,大的包含小的', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.8800742693409744, -12.621788424068765], 0, [6.005662808022923, -12.621788424068765], 0, [6.005662808022923, -8.540226017191973], 0, [-1.8800742693409744, -8.540226017191973], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-0.03742716332378216, -11.254663151862458], 0, [3.9450681948424067, -11.254663151862458], 0, [3.9450681948424067, -9.53089650429799], 0, [-0.03742716332378216, -9.53089650429799], 0, true, 0]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.8800742693409744, -12.621788424068765], 0, [6.005662808022923, -12.621788424068765], 0, [6.005662808022923, -8.540226017191973], 0, [-1.8800742693409744, -8.540226017191973], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-0.03742716332378216, -11.254663151862458], 0, [3.9450681948424067, -11.254663151862458], 0, [3.9450681948424067, -9.53089650429799], 0, [-0.03742716332378216, -9.53089650429799], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
testBool(regs[0], regs[1], 1, 0, 1, 0, 1, 1);
testBool(regs[1], regs[0], 1, 0, 1, 0, 0, 0);
})
});
test('2没有洞的面域,不相交', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-4.711014253295126, -24.920368119197704], 0, [5.1917279358166155, -24.920368119197704], 0, [5.1917279358166155, -16.88167151862464], 0, [-4.711014253295126, -16.88167151862464], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [7.948962035530085, -25.735888064183378], 0, [14.084778764469913, -25.735888064183378], 0, [14.084778764469913, -19.716574184527214], 0, [7.948962035530085, -19.716574184527214], 0, true, 0]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-4.711014253295126, -24.920368119197704], 0, [5.1917279358166155, -24.920368119197704], 0, [5.1917279358166155, -16.88167151862464], 0, [-4.711014253295126, -16.88167151862464], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [7.948962035530085, -25.735888064183378], 0, [14.084778764469913, -25.735888064183378], 0, [14.084778764469913, -19.716574184527214], 0, [7.948962035530085, -19.716574184527214], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Intersection);
@ -46,7 +46,7 @@ test('2没有洞的面域,不相交', () =>
test("多无洞面域,互相相交", () =>
{
let data =
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-0.8607930519232294, -2.5865143049017547], 0, [4.439811998377018, -2.5865143049017547], 0, [4.439811998377018, 1.1818845980460777], 0, [-0.8607930519232294, 1.1818845980460777], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-2.8550724637681157, -3.3478260869565215], 0, [1.4347826086956512, -3.3478260869565215], 0, [1.4347826086956512, -0.304347826086957], 0, [-2.8550724637681157, -0.304347826086957], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.4492753623188404, -4.695652173913043], 0, [2.2753623188405787, -4.695652173913043], 0, [2.2753623188405787, -1.434782608695652], 0, [-1.4492753623188404, -1.434782608695652], 0, true, 0]
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-0.8607930519232294, -2.5865143049017547], 0, [4.439811998377018, -2.5865143049017547], 0, [4.439811998377018, 1.1818845980460777], 0, [-0.8607930519232294, 1.1818845980460777], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-2.8550724637681157, -3.3478260869565215], 0, [1.4347826086956512, -3.3478260869565215], 0, [1.4347826086956512, -0.304347826086957], 0, [-2.8550724637681157, -0.304347826086957], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.4492753623188404, -4.695652173913043], 0, [2.2753623188405787, -4.695652173913043], 0, [2.2753623188405787, -1.434782608695652], 0, [-1.4492753623188404, -1.434782608695652], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(3);
testRegionsBool(regs, 1, 0, 1, 0, 1, 0);
@ -54,7 +54,7 @@ test("多无洞面域,互相相交", () =>
test('简单差集', () =>
{
let d = [2, "Region", 4, 2, 621, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 1, 1, 1, 1, "Polyline", 4, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [1445.5476870961775, -414.05675626156443], 0, [2311.4623870961777, -414.05675626156443], 0, [2311.4623870961777, 21.589743738435573], 0, [1445.5476870961775, 21.589743738435573], 0, true, 0, "Region", 4, 2, 622, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 1, 1, 1, 1, "Polyline", 4, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [1833.6495890686276, 21.589743738435573], 0, [2041.7917890686276, 21.589743738435573], 0, [2041.7917890686276, 206.17484373843558], 0, [1833.6495890686276, 206.17484373843558], 0, true, 0]
let d = [2, "Region", 4, 2, 621, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 1, 1, 1, 1, "Polyline", 4, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [1445.5476870961775, -414.05675626156443], 0, [2311.4623870961777, -414.05675626156443], 0, [2311.4623870961777, 21.589743738435573], 0, [1445.5476870961775, 21.589743738435573], 0, true, 0, "Region", 4, 2, 622, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 1, 1, 1, 1, "Polyline", 4, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [1833.6495890686276, 21.589743738435573], 0, [2041.7917890686276, 21.589743738435573], 0, [2041.7917890686276, 206.17484373843558], 0, [1833.6495890686276, 206.17484373843558], 0, true, 0];
let regs = LoadRegionsFromFileData(d);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Subtract);
@ -64,69 +64,69 @@ test('简单差集', () =>
test("多无洞面域,互不相交", () =>
{
let data =
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-4.711014253295126, -24.920368119197704], 0, [5.1917279358166155, -24.920368119197704], 0, [5.1917279358166155, -16.88167151862464], 0, [-4.711014253295126, -16.88167151862464], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [7.948962035530085, -25.735888064183378], 0, [14.084778764469913, -25.735888064183378], 0, [14.084778764469913, -19.716574184527214], 0, [7.948962035530085, -19.716574184527214], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-14.225413611461313, -24.182516740401145], 0, [-8.90511682750716, -24.182516740401145], 0, [-8.90511682750716, -16.609831536962744], 0, [-14.225413611461313, -16.609831536962744], 0, true, 0]
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-4.711014253295126, -24.920368119197704], 0, [5.1917279358166155, -24.920368119197704], 0, [5.1917279358166155, -16.88167151862464], 0, [-4.711014253295126, -16.88167151862464], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [7.948962035530085, -25.735888064183378], 0, [14.084778764469913, -25.735888064183378], 0, [14.084778764469913, -19.716574184527214], 0, [7.948962035530085, -19.716574184527214], 0, true, 0, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-14.225413611461313, -24.182516740401145], 0, [-8.90511682750716, -24.182516740401145], 0, [-8.90511682750716, -16.609831536962744], 0, [-14.225413611461313, -16.609831536962744], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(3);
testRegionsBool(regs, 3, 0, 0, 0, 1, 0);
})
});
test('2面域,各有一个洞,不相交', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.59187156135242, -39.71001649292836], 0, [-10.261209993169047, -39.71001649292836], 0, [-10.261209993169047, -32.47907298072205], 0, [-22.59187156135242, -32.47907298072205], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-19.318918182143253, -36.28483272398853], 0, [-14.523660905627494, -36.28483272398853], 0, [-14.523660905627494, -34.38195285235529], 0, [-19.318918182143253, -34.38195285235529], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.59187156135242, -39.71001649292836], 0, [-10.261209993169047, -39.71001649292836], 0, [-10.261209993169047, -32.47907298072205], 0, [-22.59187156135242, -32.47907298072205], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-19.318918182143253, -36.28483272398853], 0, [-14.523660905627494, -36.28483272398853], 0, [-14.523660905627494, -34.38195285235529], 0, [-19.318918182143253, -34.38195285235529], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true];
let regs = LoadRegionsFromFileData(data);
testBool(regs[0], regs[1], 2, 2, 0, 0, 1, 1);
})
});
test('2面域,各有一个洞,相交', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.081717492410313, -43.85068309360228], 0, [15.009034702120339, -43.85068309360228], 0, [15.009034702120339, -32.98143326683323], 0, [-1.081717492410313, -32.98143326683323], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.484132877203438, -41.29321254612721], 0, [12.345002881833807, -41.29321254612721], 0, [12.345002881833807, -36.81763908804584], 0, [6.484132877203438, -36.81763908804584], 0, true]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-1.081717492410313, -43.85068309360228], 0, [15.009034702120339, -43.85068309360228], 0, [15.009034702120339, -32.98143326683323], 0, [-1.081717492410313, -32.98143326683323], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.484132877203438, -41.29321254612721], 0, [12.345002881833807, -41.29321254612721], 0, [12.345002881833807, -36.81763908804584], 0, [6.484132877203438, -36.81763908804584], 0, true];
let regs = LoadRegionsFromFileData(data);
testBool(regs[0], regs[1], 1, 2, 1, 0, 1, 0);
testBool(regs[1], regs[0], 1, 2, 1, 0, 2, 1);
})
});
test('2面域,包含关系,小的有洞', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.04124423071174, -72.72878802550831], 0, [12.451564154645265, -72.72878802550831], 0, [12.451564154645265, -54.08056528350259], 0, [-15.04124423071174, -54.08056528350259], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-9.286935498892833, -69.21226602273008], 0, [9.041603424678508, -69.21226602273008], 0, [9.041603424678508, -59.08894510564126], 0, [-9.286935498892833, -59.08894510564126], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.180849509079643, -77.41748402921259], 0, [19.591169433013167, -77.41748402921259], 0, [19.591169433013167, -48.32625655168367], 0, [-22.180849509079643, -48.32625655168367], 0, true, 0]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.04124423071174, -72.72878802550831], 0, [12.451564154645265, -72.72878802550831], 0, [12.451564154645265, -54.08056528350259], 0, [-15.04124423071174, -54.08056528350259], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-9.286935498892833, -69.21226602273008], 0, [9.041603424678508, -69.21226602273008], 0, [9.041603424678508, -59.08894510564126], 0, [-9.286935498892833, -59.08894510564126], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.180849509079643, -77.41748402921259], 0, [19.591169433013167, -77.41748402921259], 0, [19.591169433013167, -48.32625655168367], 0, [-22.180849509079643, -48.32625655168367], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
testBool(regs[1], regs[0], 1, 0, 1, 1, 2, 1);
testBool(regs[0], regs[1], 1, 0, 1, 1, 0, 0);
})
});
test('2面域,包含关系,大的有洞被小的包含,小的有洞', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-46.60469323746657, -127.77834155990918], 0, [24.855296309899348, -127.77834155990918], 0, [24.855296309899348, -89.28840982040936], 0, [-46.60469323746657, -89.28840982040936], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-24.077640165123658, -113.60569227598484], 0, [3.6709152749808487, -113.60569227598484], 0, [3.6709152749808487, -102.26757284884535], 0, [-24.077640165123658, -102.26757284884535], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-59.58385626590253, -133.178866865994], 0, [39.83354881627835, -133.178866865994], 0, [39.83354881627835, -84.72332489316635], 0, [-59.58385626590253, -84.72332489316635], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.723236376705094, -111.24855692139529], 0, [-1.5207499363935426, -111.24855692139529], 0, [-1.5207499363935426, -105.60933436421276], 0, [-15.723236376705094, -105.60933436421276], 0, true]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-46.60469323746657, -127.77834155990918], 0, [24.855296309899348, -127.77834155990918], 0, [24.855296309899348, -89.28840982040936], 0, [-46.60469323746657, -89.28840982040936], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-24.077640165123658, -113.60569227598484], 0, [3.6709152749808487, -113.60569227598484], 0, [3.6709152749808487, -102.26757284884535], 0, [-24.077640165123658, -102.26757284884535], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-59.58385626590253, -133.178866865994], 0, [39.83354881627835, -133.178866865994], 0, [39.83354881627835, -84.72332489316635], 0, [-59.58385626590253, -84.72332489316635], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.723236376705094, -111.24855692139529], 0, [-1.5207499363935426, -111.24855692139529], 0, [-1.5207499363935426, -105.60933436421276], 0, [-15.723236376705094, -105.60933436421276], 0, true];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
testBool(regs[0], regs[1], 1, 1, 1, 1, 0, 0);
testBool(regs[1], regs[0], 1, 1, 1, 1, 2, 2);
})
});
test('2面域,各有洞,形状和洞都相交', () =>
{
let data =
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-55.41885848474738, -244.74737129761687], 0, [79.76223873944839, -244.74737129761687], 0, [79.76223873944839, -181.20070166231113], 0, [-55.41885848474738, -181.20070166231113], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-27.689402643886723, -225.97221890536744], 0, [58.38744986211828, -225.97221890536744], 0, [58.38744986211828, -196.79852057279527], 0, [-27.689402643886723, -196.79852057279527], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.846614211852472, -278.5426456036658], 0, [52.032782898587726, -278.5426456036658], 0, [52.032782898587726, -158.95936728995414], 0, [-15.846614211852472, -158.95936728995414], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [3.2173866787392393, -273.0545241351621], 0, [37.87920647981508, -273.0545241351621], 0, [37.87920647981508, -164.1586402601155], 0, [3.2173866787392393, -164.1586402601155], 0, true]
[2, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-55.41885848474738, -244.74737129761687], 0, [79.76223873944839, -244.74737129761687], 0, [79.76223873944839, -181.20070166231113], 0, [-55.41885848474738, -181.20070166231113], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-27.689402643886723, -225.97221890536744], 0, [58.38744986211828, -225.97221890536744], 0, [58.38744986211828, -196.79852057279527], 0, [-27.689402643886723, -196.79852057279527], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-15.846614211852472, -278.5426456036658], 0, [52.032782898587726, -278.5426456036658], 0, [52.032782898587726, -158.95936728995414], 0, [-15.846614211852472, -158.95936728995414], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [3.2173866787392393, -273.0545241351621], 0, [37.87920647981508, -273.0545241351621], 0, [37.87920647981508, -164.1586402601155], 0, [3.2173866787392393, -164.1586402601155], 0, true];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
testBool(regs[0], regs[1], 1, 5, 4, 0, 4, 0);
testBool(regs[1], regs[0], 1, 5, 4, 0, 4, 0);
})
});
test("多都有洞面域,互不相交", () =>
{
let data =
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.59187156135242, -39.71001649292836], 0, [-10.261209993169047, -39.71001649292836], 0, [-10.261209993169047, -32.47907298072205], 0, [-22.59187156135242, -32.47907298072205], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-19.318918182143253, -36.28483272398853], 0, [-14.523660905627494, -36.28483272398853], 0, [-14.523660905627494, -34.38195285235529], 0, [-19.318918182143253, -34.38195285235529], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-32.341023130284626, -29.89099796417434], 0, [-20.945903228429888, -29.89099796417434], 0, [-20.945903228429888, -23.98549786905254], 0, [-32.341023130284626, -23.98549786905254], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-28.59810053478489, -28.809709214363306], 0, [-22.276720151274237, -28.809709214363306], 0, [-22.276720151274237, -25.73219508028575], 0, [-28.59810053478489, -25.73219508028575], 0, true]
[3, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-22.59187156135242, -39.71001649292836], 0, [-10.261209993169047, -39.71001649292836], 0, [-10.261209993169047, -32.47907298072205], 0, [-22.59187156135242, -32.47907298072205], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-19.318918182143253, -36.28483272398853], 0, [-14.523660905627494, -36.28483272398853], 0, [-14.523660905627494, -34.38195285235529], 0, [-19.318918182143253, -34.38195285235529], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-6.759911029363891, -42.52627870294555], 0, [4.048446641512894, -42.52627870294555], 0, [4.048446641512894, -34.9147592164126], 0, [-6.759911029363891, -34.9147592164126], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-3.7153032347507127, -40.69951402617764], 0, [1.308299626361034, -40.69951402617764], 0, [1.308299626361034, -37.42656064696847], 0, [-3.7153032347507127, -37.42656064696847], 0, true, "Region", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-32.341023130284626, -29.89099796417434], 0, [-20.945903228429888, -29.89099796417434], 0, [-20.945903228429888, -23.98549786905254], 0, [-32.341023130284626, -23.98549786905254], 0, true, 1, "Polyline", 1, 1, -1, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-28.59810053478489, -28.809709214363306], 0, [-22.276720151274237, -28.809709214363306], 0, [-22.276720151274237, -25.73219508028575], 0, [-28.59810053478489, -25.73219508028575], 0, true];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(3);
testRegionsBool(regs, 3, 3, 0, 0, 1, 1);
})
});
test("有问题面域测试", () =>
{
let data =
[2, "Region", 1, 1, 7, false, 7, 0, [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 995.4564695921745, 866.7576945200351, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 995.4564695921745, 866.7576945200351, 0, 1], 2, 12, [1151.784316715255, 505.6870652512325], 0, [-48.215683284744955, 505.6870652512325], 0, [-48.215683284744955, 436.3728364140229], 0, [-322.28257444753535, 436.3728364140229], 0, [-322.28257444753535, 255.1386559489065], 0, [-48.215683284744955, 255.13865594890694], 0, [-48.215683284744955, 160.58169222797642], 0, [-310.4629539824191, 160.58169222797642], 0, [-310.4629539824191, -12.772741260395605], 0, [-48.215683284744955, -12.772741260395605], 0, [-48.215683284744955, -94.31293474876725], 0, [1151.784316715255, -94.31293474876725], 0, true, 0, "Region", 1, 1, 6, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -983.721937321937, -229.2831908831909, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -983.721937321937, -229.2831908831909, 0, 1], 2, 5, [1966.4056656537157, 1219.4025937658553], 0, [2139.7600991420877, 1219.4025937658553], 0, [2139.7600991420877, 1275.3802040368082], 0, [1966.4056656537157, 1275.3802040368082], 0, [1966.4056656537157, 1219.4025937658553], 0, true, 0]
[2, "Region", 1, 1, 7, false, 7, 0, [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 995.4564695921745, 866.7576945200351, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 995.4564695921745, 866.7576945200351, 0, 1], 2, 12, [1151.784316715255, 505.6870652512325], 0, [-48.215683284744955, 505.6870652512325], 0, [-48.215683284744955, 436.3728364140229], 0, [-322.28257444753535, 436.3728364140229], 0, [-322.28257444753535, 255.1386559489065], 0, [-48.215683284744955, 255.13865594890694], 0, [-48.215683284744955, 160.58169222797642], 0, [-310.4629539824191, 160.58169222797642], 0, [-310.4629539824191, -12.772741260395605], 0, [-48.215683284744955, -12.772741260395605], 0, [-48.215683284744955, -94.31293474876725], 0, [1151.784316715255, -94.31293474876725], 0, true, 0, "Region", 1, 1, 6, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -983.721937321937, -229.2831908831909, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -983.721937321937, -229.2831908831909, 0, 1], 2, 5, [1966.4056656537157, 1219.4025937658553], 0, [2139.7600991420877, 1219.4025937658553], 0, [2139.7600991420877, 1275.3802040368082], 0, [1966.4056656537157, 1275.3802040368082], 0, [1966.4056656537157, 1219.4025937658553], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
testRegionsBool(regs, 1, 0, 1, 0, 2, 0);
});
@ -134,7 +134,7 @@ test("有问题面域测试", () =>
test("有交点时", () =>
{
let data =
[2, "Region", 1, 1, 5, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 2, 6, [89.29853006702479, 1021.4029398659504], 0, [0, 1021.4029398659504], 0, [0, 1039.4029398659504], 0, [80.29853006702479, 1039.4029398659504], 0, [600, 1039.4029398659504], 0, [600, 1021.4029398659504], 0, true, 0, "Region", 1, 1, 6, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0]
[2, "Region", 1, 1, 5, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 2, 6, [89.29853006702479, 1021.4029398659504], 0, [0, 1021.4029398659504], 0, [0, 1039.4029398659504], 0, [80.29853006702479, 1039.4029398659504], 0, [600, 1039.4029398659504], 0, [600, 1021.4029398659504], 0, true, 0, "Region", 1, 1, 6, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 1, 1, 1, 1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.957264957253415, -392.4501424501543, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0];
let regs = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
@ -173,7 +173,7 @@ function testRegion(reg)
let shapeCount = reg.ShapeManager.ShapeList.length;
let holeCount = reg.ShapeManager.ShapeList.map(s => s.Holes.length).reduce((c1, c2) => c1 + c2, 0);
return { shapeCount, holeCount };
} else return { shapeCount: 0, holeCount: 0 }
} else return { shapeCount: 0, holeCount: 0 };
}
function testBool(reg1, reg2, uShapeCount, uHoleCount, iShapeCount, iHoleCount, sShapeCount, sHoleCount)

@ -5,7 +5,7 @@ import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util";
test("#IRFL2面域消失", () =>
{
let data =
[2, "Region", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -284.847850497852, -347.14497813089565, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -284.847850497852, -347.14497813089565, 0, 1], 0, 2, 4, [258.7734554093699, 1.1368683772161603e-13], 0, [674.3301771838924, 5.684341886080802e-14], 0, [674.3301771838924, 1091.0460568668868], 0, [258.7734554093699, 1091.0460568668868], 0, true, 0, "Region", 2, 1, 103, false, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 389.4823496974607, -74.09892126400852, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 389.4823496974607, -74.09892126400852, 0, 1], 0, 2, 4, [0, 0], 0, [415.5567321777343, 0], 0, [415.5567321777343, 18], 0, [0, 18], 0, true, 0]
[2, "Region", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -284.847850497852, -347.14497813089565, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -284.847850497852, -347.14497813089565, 0, 1], 0, 2, 4, [258.7734554093699, 1.1368683772161603e-13], 0, [674.3301771838924, 5.684341886080802e-14], 0, [674.3301771838924, 1091.0460568668868], 0, [258.7734554093699, 1091.0460568668868], 0, true, 0, "Region", 2, 1, 103, false, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 389.4823496974607, -74.09892126400852, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 389.4823496974607, -74.09892126400852, 0, 1], 0, 2, 4, [0, 0], 0, [415.5567321777343, 0], 0, [415.5567321777343, 18], 0, [0, 18], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
@ -21,7 +21,7 @@ test("#IRFL2面域消失", () =>
test('#IR8AN交集错误', () =>
{
let data =
[2, "Region", 2, 1, 104, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 111.34512004857766, 13.95089482226993, 0, 1], 0, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 111.34512004857766, 13.95089482226993, 0, 1], 0, 2, 4, [-97.39422719143477, -0.0000019651270122267306], 0, [674.3281411676799, -0.0000019651270122267306], 0, [674.3281421679894, 1199.9999984537135], 0, [-97.3942261911252, 1199.9999984537135], 0, true, 0, "Region", 2, 1, 105, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.95089285714289, 113.95089285714292, 0, 1], 0, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.95089285714289, 113.95089285714292, 0, 1], 0, 2, 13, [314.3387826639938, -99.99999883531063], 0, [318, -100], 0, [318, 0], 0, [579.5436603415255, 67.84500522108829], 0, [530.3246820683962, 361.2662670472655], 0, [446.27460696874186, 251.38290037066872], 0, [495.4935852418712, 1057.9616385444915], 0, [151.43841386299755, 1055.5264270248226], 0, [151.43841386299755, 155.52640117119142], 0, [0, 200], 0, [0, 0], 0, [140.39432277924786, -16.215571265653125], 0, [140.3943227792479, -100], 0, true, 0]
[2, "Region", 2, 1, 104, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 111.34512004857766, 13.95089482226993, 0, 1], 0, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 111.34512004857766, 13.95089482226993, 0, 1], 0, 2, 4, [-97.39422719143477, -0.0000019651270122267306], 0, [674.3281411676799, -0.0000019651270122267306], 0, [674.3281421679894, 1199.9999984537135], 0, [-97.3942261911252, 1199.9999984537135], 0, true, 0, "Region", 2, 1, 105, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.95089285714289, 113.95089285714292, 0, 1], 0, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.95089285714289, 113.95089285714292, 0, 1], 0, 2, 13, [314.3387826639938, -99.99999883531063], 0, [318, -100], 0, [318, 0], 0, [579.5436603415255, 67.84500522108829], 0, [530.3246820683962, 361.2662670472655], 0, [446.27460696874186, 251.38290037066872], 0, [495.4935852418712, 1057.9616385444915], 0, [151.43841386299755, 1055.5264270248226], 0, [151.43841386299755, 155.52640117119142], 0, [0, 200], 0, [0, 0], 0, [140.39432277924786, -16.215571265653125], 0, [140.3943227792479, -100], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
expect(regs.length).toBe(2);
@ -37,7 +37,7 @@ test('#IR8AN交集错误', () =>
test('布尔错误', () =>
{
let data =
[2, "Region", 2, 1, 117, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [-112.67605633802839, -202.8168633802817], 0, [357.7464436619716, -202.8168633802817], 0, [357.7464436619716, 173.23943661971833], 0, [-112.67605633802839, 173.23943661971833], 0, true, 0, "Region", 2, 1, 116, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [25.35211267605621, -202.81687464788737], 0, [225.3521126760562, -202.81687464788737], 0, [225.3521126760562, -49.295774647887384], 0, [25.35211267605621, -49.295774647887384], 0, true, 0]
[2, "Region", 2, 1, 117, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [-112.67605633802839, -202.8168633802817], 0, [357.7464436619716, -202.8168633802817], 0, [357.7464436619716, 173.23943661971833], 0, [-112.67605633802839, 173.23943661971833], 0, true, 0, "Region", 2, 1, 116, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [25.35211267605621, -202.81687464788737], 0, [225.3521126760562, -202.81687464788737], 0, [225.3521126760562, -49.295774647887384], 0, [25.35211267605621, -49.295774647887384], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
@ -52,7 +52,7 @@ test('布尔错误', () =>
test("包含差集的对象,差一点就可以切断", () =>
{
let data =
[2, "Region", 2, 1, 103, false, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 7844.613399859296, 9627.014177659035, -0.000003860448487102985, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 7844.613399859296, 9627.014177659035, -0.000003860448487102985, 1], 0, 2, 5, [7094.5404957357605, -503.2636790371175], 0, [7942.380560966396, -503.2636790371175], 0, [7942.380560966396, 768.496418808835], 0, [7094.5404957357605, 768.496418808835], 0, [7094.5404957357605, -503.2636790371175], 0, true, 0, "Region", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7341.349720822179, 1684.633616692639, -0.000003860448487102985, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7341.349720822179, 1684.633616692639, -0.000003860448487102985, 1], 0, 2, 6, [485.26368725963897, 323.50923230733497], 0, [485.26368725963886, 847.8400336226459], 0, [503.26368725963897, 847.8400336226459], 0, [503.26368725963897, 335.5092294277747], 0, [503.26368725963897, 0.00018987264593306463], 0, [485.26368725963897, 0.00018987264593306463], 0, true, 0]
[2, "Region", 2, 1, 103, false, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 7844.613399859296, 9627.014177659035, -0.000003860448487102985, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 7844.613399859296, 9627.014177659035, -0.000003860448487102985, 1], 0, 2, 5, [7094.5404957357605, -503.2636790371175], 0, [7942.380560966396, -503.2636790371175], 0, [7942.380560966396, 768.496418808835], 0, [7094.5404957357605, 768.496418808835], 0, [7094.5404957357605, -503.2636790371175], 0, true, 0, "Region", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7341.349720822179, 1684.633616692639, -0.000003860448487102985, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7341.349720822179, 1684.633616692639, -0.000003860448487102985, 1], 0, 2, 6, [485.26368725963897, 323.50923230733497], 0, [485.26368725963886, 847.8400336226459], 0, [503.26368725963897, 847.8400336226459], 0, [503.26368725963897, 335.5092294277747], 0, [503.26368725963897, 0.00018987264593306463], 0, [485.26368725963897, 0.00018987264593306463], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(data);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Subtract);
@ -64,7 +64,7 @@ test("包含差集的对象,差一点就可以切断", () =>
test('矩形只有尖角重合并进行并集', () =>
{
let d =
[2, "Region", 2, 1, 114, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1010.1971830985912, 770.3662408450699], 0, [1188.676083098591, 770.3662408450699], 0, [1188.676083098591, 1153.69014084507], 0, [1010.1971830985912, 1153.69014084507], 0, true, 0, "Region", 2, 1, 115, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1188.676083098591, 1153.69014084507], 0, [1273.859183098591, 1153.69014084507], 0, [1273.859183098591, 1315.94364084507], 0, [1188.676083098591, 1315.94364084507], 0, true, 0]
[2, "Region", 2, 1, 114, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1010.1971830985912, 770.3662408450699], 0, [1188.676083098591, 770.3662408450699], 0, [1188.676083098591, 1153.69014084507], 0, [1010.1971830985912, 1153.69014084507], 0, true, 0, "Region", 2, 1, 115, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1188.676083098591, 1153.69014084507], 0, [1273.859183098591, 1153.69014084507], 0, [1273.859183098591, 1315.94364084507], 0, [1188.676083098591, 1315.94364084507], 0, true, 0];
let regs: Region[] = LoadRegionsFromFileData(d);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Union);

@ -21,7 +21,7 @@ test('布尔_误差共线_误差交点', () =>
test('误差打断', () =>
{
let d = [2, "Region", 3, 2, 780, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1270.0801901174855, 251.0534593864627, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1270.0801901174855, 251.0534593864627, 0, 1], 2, 7, [337.0932869688667, -418.03134104109404], 0, [482, -246.84009191289078], 0, [482, -146.84009191289078], 0, [582, -146.84009191289078], 0, [582, 573.0000000000002], 0, [0, 573.0000000000002], 0, [0, -418.03134104109404], 0, true, 0, "Region", 3, 2, 779, false, 1, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, -872.726286511064, -95.7866325264281, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, -872.726286511064, -95.7866325264281, 0, 1], 2, 4, [0, 0], 0, [397.3539036064214, 0], 0, [397.3539036064214, 18], 0, [0, 18], 0, true, 0]
let d = [2, "Region", 3, 2, 780, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1270.0801901174855, 251.0534593864627, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1270.0801901174855, 251.0534593864627, 0, 1], 2, 7, [337.0932869688667, -418.03134104109404], 0, [482, -246.84009191289078], 0, [482, -146.84009191289078], 0, [582, -146.84009191289078], 0, [582, 573.0000000000002], 0, [0, 573.0000000000002], 0, [0, -418.03134104109404], 0, true, 0, "Region", 3, 2, 779, false, 1, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, -872.726286511064, -95.7866325264281, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, -872.726286511064, -95.7866325264281, 0, 1], 2, 4, [0, 0], 0, [397.3539036064214, 0], 0, [397.3539036064214, 18], 0, [0, 18], 0, true, 0];
let regs = LoadRegionsFromFileData(d);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Subtract);
expect(regs[0].ShapeManager.ShapeList.length).toBe(2);

@ -4,7 +4,7 @@ import { BoolOpeartionType } from "../../src/GraphicsSystem/BoolOperateUtils";
test('交点大于等于2_但是还是分离', () =>
{
let d = [2, "Region", 3, 2, 629, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [5842.2632447015285, -382.81544021645357], 0, [6075.449244701528, -382.81544021645357], 0, [6075.449244701528, -210.8902402164536], 0, [5842.2632447015285, -210.8902402164536], 0, true, 0, "Region", 3, 2, 630, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [5622.910304827508, -210.8902402164536], 0, [5842.2632447015285, -210.8902402164536], 0, [5842.2632447015285, -13.274942384012917], 0, [6075.449244701528, -13.274942384012888], 0, [6075.449244701528, -210.8902402164536], 0, [6253.303004827509, -210.8902402164536], 0, [6253.303004827509, 291.05255978354637], 0, [5622.910304827508, 291.05255978354637], 0, true, 0]
let d = [2, "Region", 3, 2, 629, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [5842.2632447015285, -382.81544021645357], 0, [6075.449244701528, -382.81544021645357], 0, [6075.449244701528, -210.8902402164536], 0, [5842.2632447015285, -210.8902402164536], 0, true, 0, "Region", 3, 2, 630, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [5622.910304827508, -210.8902402164536], 0, [5842.2632447015285, -210.8902402164536], 0, [5842.2632447015285, -13.274942384012917], 0, [6075.449244701528, -13.274942384012888], 0, [6075.449244701528, -210.8902402164536], 0, [6253.303004827509, -210.8902402164536], 0, [6253.303004827509, 291.05255978354637], 0, [5622.910304827508, 291.05255978354637], 0, true, 0];
let [reg1, reg2] = LoadRegionsFromFileData(d);
@ -26,4 +26,4 @@ test(`#I118PO`, () =>
reg.BooleanOper(reg2.Clone(), BoolOpeartionType.Intersection);
expect(reg.ShapeManager.ShapeCount).toBe(1);
expect(reg.Area).toMatchSnapshot();
})
});

@ -5,7 +5,7 @@ import "../Utils/jest.util";
test('并集错误,错误的曲线包含', () =>
{
let regsData =
[2, "Region", 5, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 1, 1, 1, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [100, 0], 0, [100, 100], 0, [0, 100], 0, true, 0, "Region", 5, 2, 104, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 100.0001, 0, 1], 0, 0, 1, 1, 1, 1, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 100.0001, 0, 1], 0, 0, 2, 4, [0, 0], 0, [100, 0], 0, [100, 100], 0, [0, 100], 0, true, 0]
[2, "Region", 5, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 1, 1, 1, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [100, 0], 0, [100, 100], 0, [0, 100], 0, true, 0, "Region", 5, 2, 104, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 100.0001, 0, 1], 0, 0, 1, 1, 1, 1, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 100.0001, 0, 1], 0, 0, 2, 4, [0, 0], 0, [100, 0], 0, [100, 100], 0, [0, 100], 0, true, 0];
let regs = LoadRegionsFromFileData(regsData);

File diff suppressed because one or more lines are too long

@ -15,7 +15,7 @@ function testBrSealing(br: Board, sealingSize: number[])
for (let i = 0; i < calcCus.length; i++)
{
let cu = calcCus[i];
offsetCus.push(...cu.GetOffsetCurves(sealingSize[i] * dir))
offsetCus.push(...cu.GetOffsetCurves(sealingSize[i] * dir));
}
CalcEdgeSealing(offsetCus);
let pl = new Polyline();
@ -31,23 +31,23 @@ function testBrSealing(br: Board, sealingSize: number[])
test("常规板件,常规坐标系", () =>
{
let data =
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 145.29914529914527, -290.5982905982906, 0, 1], 0, 1, 1200, 600, 1, true, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0]
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 145.29914529914527, -290.5982905982906, 0, 1], 0, 1, 1200, 600, 1, true, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0];
let layerBr = LoadBoardsFromFileData(data)[0];
let sealingSize = [1, 1, 1, 1];
testBrSealing(layerBr, sealingSize);
sealingSize = [3, 2, 3, 2];
testBrSealing(layerBr, sealingSize);
data =
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -292.022792022792, -213.67521367521368, 0, 1], 0, 1, 1200, 600, 1, true, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0]
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -292.022792022792, -213.67521367521368, 0, 1], 0, 1, 1200, 600, 1, true, "Polyline", 2, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0];
let vBr = LoadBoardsFromFileData(data)[0];
sealingSize = [2, 2, 2, 2];
testBrSealing(vBr, sealingSize);
})
});
test("异型板件,常规坐标系", () =>
{
let data =
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 3681.8686077049847, -1396.263281011676, 0, 1], 0, 1, 1336.1737079222257, 2039.4230278812934, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 1396.2632810116759, 3681.8686077049847, 0, 1], 0, 2, 5, [2345.694899782759, -1396.263281011676], 0, [3681.8686077049847, -1396.263281011676], 0, [3681.8686077049847, 443.1597468696174], 0.41421356237309503, [3481.8686077049847, 643.1597468696174], 0, [2345.694899782759, 643.1597468696174], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0]
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 3681.8686077049847, -1396.263281011676, 0, 1], 0, 1, 1336.1737079222257, 2039.4230278812934, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 1396.2632810116759, 3681.8686077049847, 0, 1], 0, 2, 5, [2345.694899782759, -1396.263281011676], 0, [3681.8686077049847, -1396.263281011676], 0, [3681.8686077049847, 443.1597468696174], 0.41421356237309503, [3481.8686077049847, 643.1597468696174], 0, [2345.694899782759, 643.1597468696174], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0];
//第三段为圆弧
let br = LoadBoardsFromFileData(data)[0];
let sealingSize = [1, 1, 1];
@ -58,18 +58,18 @@ test("异型板件,常规坐标系", () =>
testBrSealing(br, sealingSize);
// 2,4,6,8段为圆弧
data =
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 6239.212423224621, -1330.0896939146003, 0, 1], 0, 1, 1275.546950115211, 2125.911583525353, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 1330.0896939146, 6239.212423224621, 0, 1], 0, 2, 8, [5263.6654731094095, -1330.0896939146003], 0, [5939.212423224621, -1330.0896939146003], 0.41421356237309503, [6239.212423224621, -1030.0896939146003], 0, [6239.212423224621, 495.8218896107525], 0.41421356237309503, [5939.212423224621, 795.8218896107526], 0, [5263.6654731094095, 795.8218896107526], 0.4142135623730949, [4963.6654731094095, 495.8218896107527], 0, [4963.6654731094095, -1030.0896939146003], 0.4142135623730949, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0]
[1, "Board", 2, 1, 0, false, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 6239.212423224621, -1330.0896939146003, 0, 1], 0, 1, 1275.546950115211, 2125.911583525353, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 1330.0896939146, 6239.212423224621, 0, 1], 0, 2, 8, [5263.6654731094095, -1330.0896939146003], 0, [5939.212423224621, -1330.0896939146003], 0.41421356237309503, [6239.212423224621, -1030.0896939146003], 0, [6239.212423224621, 495.8218896107525], 0.41421356237309503, [5939.212423224621, 795.8218896107526], 0, [5263.6654731094095, 795.8218896107526], 0.4142135623730949, [4963.6654731094095, 495.8218896107527], 0, [4963.6654731094095, -1030.0896939146003], 0.4142135623730949, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0];
br = LoadBoardsFromFileData(data)[0];
sealingSize = [1];
testBrSealing(br, sealingSize);
sealingSize = [5];
testBrSealing(br, sealingSize);
})
});
test("异型板件,非常规坐标系", () =>
{
let data =
[1, "Board", 2, 1, 0, false, 7, 0, [0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 15844.064994449893, 0, -2833.834144511985, 1], 0, 1, 10835.306755747779, 7823.377849356992, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 2833.8341445119845, 15844.064994449893, 0, 1], 0, 2, 6, [5008.758238702114, -2833.834144511985], 0, [5008.758238702114, 2775.380162574158], -0.414213562373095, [7222.921780972962, 4989.543704845006], 0, [13759.976048629745, 4989.543704845006], -0.8565683416116343, [14392.594203564273, 919.700241432878], 0, [14076.28512609701, -2833.834144511985], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0]
[1, "Board", 2, 1, 0, false, 7, 0, [0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 15844.064994449893, 0, -2833.834144511985, 1], 0, 1, 10835.306755747779, 7823.377849356992, 1, false, "Polyline", 2, 1, 0, true, 7, 0, [6.123233995736766e-17, -1, 0, 0, 1, 6.123233995736766e-17, 0, 0, 0, 0, 1, 0, 2833.8341445119845, 15844.064994449893, 0, 1], 0, 2, 6, [5008.758238702114, -2833.834144511985], 0, [5008.758238702114, 2775.380162574158], -0.414213562373095, [7222.921780972962, 4989.543704845006], 0, [13759.976048629745, 4989.543704845006], -0.8565683416116343, [14392.594203564273, 919.700241432878], 0, [14076.28512609701, -2833.834144511985], 0, true, 0, null, null, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], null, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"knifeRad\":\"0\",\"grooveAddLength\":\"0\",\"grooveAddWidth\":\"0\",\"grooveAddDepth\":\"0\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0];
//第2,4段为圆弧
let br = LoadBoardsFromFileData(data)[0];
let sealingSize = [1, 1, 1, 1, 1, 1];
@ -78,23 +78,23 @@ test("异型板件,非常规坐标系", () =>
testBrSealing(br, sealingSize);
sealingSize = [10, 5, 5, 5, 10, 5];
testBrSealing(br, sealingSize);
})
});
test("异型板件,非相切圆弧", () =>
{
let data =
[1, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 112.87179487179475, -263.53276353276357, 0, 1], 2, 1200, 600.0000000000001, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [300, 1200], -0.563703247863248, [0, 900], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 112.87179487179475, -263.53276353276357, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[{\"size\":1},{\"size\":2},{\"size\":3},{\"size\":4},{\"size\":5}],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0, 0]
[1, "Board", 3, 2, 102, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 112.87179487179475, -263.53276353276357, 0, 1], 2, 1200, 600.0000000000001, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [300, 1200], -0.563703247863248, [0, 900], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 112.87179487179475, -263.53276353276357, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[{\"size\":1},{\"size\":2},{\"size\":3},{\"size\":4},{\"size\":5}],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\"}", 0, 0];
//第3段为圆弧
let br = LoadBoardsFromFileData(data)[0];
let sealingSize = [1, 1, 1, 1, 1];
testBrSealing(br, sealingSize);
sealingSize = [3, 5, 3, 3, 3];
testBrSealing(br, sealingSize);
})
});
test("丢失线段板件", () =>
{
let data =
[1, "Board", 3, 2, 101, false, 1, 1, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 817.4143763202346, -26.547581507291397, -408.40778761079696, 1], 2, 1200.0000000000002, 600, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1025.70079227525, -1279.6056228760524, 0, 1], 2, 54, [1025.70079227525, 2058.576017106141], 0, [1325.865855638082, 2058.576017106141], 0.41421356237309503, [1345.865855638082, 2078.576017106141], 0, [1345.865855638082, 2097.321917106141], 0.41421356237309503, [1325.865855638082, 2117.321917106141], 0, [1025.70079227525, 2137.2691008583533], 0, [1025.70079227525, 2137.2691008583533], -0.41421356237309503, [1045.70079227525, 2157.2691008583533], 0, [1325.865855638082, 2157.2691008583533], 0.41421356237309503, [1345.865855638082, 2177.2691008583533], 0, [1345.865855638082, 2196.0150008583532], 0.41421356237309503, [1325.865855638082, 2216.0150008583532], 0, [1025.70079227525, 2216.0150008583532], 0, [1025.70079227525, 2248.912678628265], 0, [1325.865855638082, 2248.912678628265], 0.41421356237309503, [1345.865855638082, 2268.912678628265], 0, [1345.865855638082, 2287.658578628265], 0.41421356237309503, [1325.865855638082, 2307.658578628265], 0, [1045.70079227525, 2307.658578628265], -0.41421356237309503, [1025.70079227525, 2327.658578628265], 0, [1025.70079227525, 2479.6056228760526], 0, [1625.70079227525, 2479.6056228760526], 0, [1625.70079227525, 1279.6056228760524], 0, [1025.70079227525, 1279.6056228760524], 0, [1025.70079227525, 1375.9224547698577], -0.41421356237309503, [1045.70079227525, 1395.9224547698577], 0, [1345.865855638082, 1395.9224547698577], 0, [1345.865855638082, 1404.6683547698576], 0.41421356237309503, [1295.865855638082, 1454.6683547698576], 0, [1025.70079227525, 1454.6683547698576], 0, [1025.70079227525, 1522.813562451274], 0, [1325.865855638082, 1522.813562451274], 0.41421356237309503, [1345.865855638082, 1542.813562451274], 0, [1345.865855638082, 1561.559462451274], 0.41421356237309503, [1325.865855638082, 1581.559462451274], 0, [1045.70079227525, 1581.559462451274], -0.41421356237309503, [1025.70079227525, 1601.559462451274], 0, [1025.70079227525, 1652.6155645751674], -0.41421356237309503, [1045.70079227525, 1672.6155645751674], 0, [1345.865855638082, 1672.6155645751674], 0, [1345.865855638082, 1701.988514575167], 0, [1045.70079227525, 1731.3614645751672], -0.41421356237309503, [1025.70079227525, 1751.3614645751672], 0, [1025.70079227525, 1761.8829073008312], -0.41421356237309503, [1045.70079227525, 1781.8829073008312], 0, [1363.4896205938342, 1781.8829073008312], 0, [1363.4896205938342, 1840.628807300831], 0, [1025.70079227525, 1881.684909424725], 0, [1025.70079227525, 1881.684909424725], -0.41421356237309503, [1075.70079227525, 1931.684909424725], 0, [1345.865855638082, 1931.684909424725], 0, [1345.865855638082, 1990.4308094247249], 0, [1075.70079227525, 1990.4308094247249], -0.41421356237309503, [1025.70079227525, 2040.4308094247249], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -401.8444990614662, -7520.408091226085, -408.40778761079696, 1], 0, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0]
[1, "Board", 3, 2, 101, false, 1, 1, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 817.4143763202346, -26.547581507291397, -408.40778761079696, 1], 2, 1200.0000000000002, 600, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1025.70079227525, -1279.6056228760524, 0, 1], 2, 54, [1025.70079227525, 2058.576017106141], 0, [1325.865855638082, 2058.576017106141], 0.41421356237309503, [1345.865855638082, 2078.576017106141], 0, [1345.865855638082, 2097.321917106141], 0.41421356237309503, [1325.865855638082, 2117.321917106141], 0, [1025.70079227525, 2137.2691008583533], 0, [1025.70079227525, 2137.2691008583533], -0.41421356237309503, [1045.70079227525, 2157.2691008583533], 0, [1325.865855638082, 2157.2691008583533], 0.41421356237309503, [1345.865855638082, 2177.2691008583533], 0, [1345.865855638082, 2196.0150008583532], 0.41421356237309503, [1325.865855638082, 2216.0150008583532], 0, [1025.70079227525, 2216.0150008583532], 0, [1025.70079227525, 2248.912678628265], 0, [1325.865855638082, 2248.912678628265], 0.41421356237309503, [1345.865855638082, 2268.912678628265], 0, [1345.865855638082, 2287.658578628265], 0.41421356237309503, [1325.865855638082, 2307.658578628265], 0, [1045.70079227525, 2307.658578628265], -0.41421356237309503, [1025.70079227525, 2327.658578628265], 0, [1025.70079227525, 2479.6056228760526], 0, [1625.70079227525, 2479.6056228760526], 0, [1625.70079227525, 1279.6056228760524], 0, [1025.70079227525, 1279.6056228760524], 0, [1025.70079227525, 1375.9224547698577], -0.41421356237309503, [1045.70079227525, 1395.9224547698577], 0, [1345.865855638082, 1395.9224547698577], 0, [1345.865855638082, 1404.6683547698576], 0.41421356237309503, [1295.865855638082, 1454.6683547698576], 0, [1025.70079227525, 1454.6683547698576], 0, [1025.70079227525, 1522.813562451274], 0, [1325.865855638082, 1522.813562451274], 0.41421356237309503, [1345.865855638082, 1542.813562451274], 0, [1345.865855638082, 1561.559462451274], 0.41421356237309503, [1325.865855638082, 1581.559462451274], 0, [1045.70079227525, 1581.559462451274], -0.41421356237309503, [1025.70079227525, 1601.559462451274], 0, [1025.70079227525, 1652.6155645751674], -0.41421356237309503, [1045.70079227525, 1672.6155645751674], 0, [1345.865855638082, 1672.6155645751674], 0, [1345.865855638082, 1701.988514575167], 0, [1045.70079227525, 1731.3614645751672], -0.41421356237309503, [1025.70079227525, 1751.3614645751672], 0, [1025.70079227525, 1761.8829073008312], -0.41421356237309503, [1045.70079227525, 1781.8829073008312], 0, [1363.4896205938342, 1781.8829073008312], 0, [1363.4896205938342, 1840.628807300831], 0, [1025.70079227525, 1881.684909424725], 0, [1025.70079227525, 1881.684909424725], -0.41421356237309503, [1075.70079227525, 1931.684909424725], 0, [1345.865855638082, 1931.684909424725], 0, [1345.865855638082, 1990.4308094247249], 0, [1075.70079227525, 1990.4308094247249], -0.41421356237309503, [1025.70079227525, 2040.4308094247249], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -401.8444990614662, -7520.408091226085, -408.40778761079696, 1], 0, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0];
//第3段为圆弧
let br = LoadBoardsFromFileData(data)[0];
let sealingSize = [];
@ -107,4 +107,4 @@ test("丢失线段板件", () =>
for (let i = 0; i < 9; i++)
sealingSize.push(1);
testBrSealing(br, sealingSize);
})
});

File diff suppressed because one or more lines are too long

@ -16,7 +16,7 @@ import { RemoveObjectData } from '../../src/DatabaseServices/RemoveObjectData';
function CadObjectToString(obj: CADObject)
{
let file = new CADFiler();
file.WriteObject(obj)
file.WriteObject(obj);
return file.ToString();
}
@ -84,11 +84,11 @@ test('clone object', () =>
db.ModelSpace.Append(line);
line.StartPoint = new THREE.Vector3(9, 9, 8);
CadObjectToString(line)/*?*/
CadObjectToString(line);/*?*/
let line2 = line.Clone();
CadObjectToString(line2) /*?*/
CadObjectToString(line2); /*?*/
});

File diff suppressed because one or more lines are too long

@ -13,7 +13,7 @@ test('多段线首尾倒角有圆弧', () =>
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 375.4375364613715, 208.47861732064138, 0, 1], 2, 10, [-171.7455621301774, 180.2537770455558], -0.40012702806387124, [171.7455621301774, 180.2537770455558], 0, [221.74556213017775, 180.2537770455558], 0, [221.74556213017775, -72.32657236535573], 0, [-3.441731405810515, -260.5746253213081], 0, [-137.90517157255817, -260.5746253213081], 0, [-137.90517157255817, -37.838102302837456], 0, [-221.7455621301774, -37.838102302837456], 0, [-221.7455621301774, 180.2537770455558], 0, [-171.7455621301774, 180.2537770455558], 0, false]
, 50,
[new Vector3(178, 388), new Vector3(224, 460)]
)
);
});
test('多段线闭合标志首尾有弧', () =>
@ -90,7 +90,7 @@ function TestFilletPolyline(
test('法向量相反EqualPolyline', () =>
{
let d =
[2, "Polyline", 2, 1, 103, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.112676056338046, 2.1126760563380316, 0, 1], 1, 2, 6, [0, 0], 0, [5, 0], 1, [5, 5], -1, [5, 10], 0, [0, 10], 0, [0, 0], 0, false, "Polyline", 2, 1, 104, false, 7, 0, [-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1], 1, 2, 6, [-7.112676056338046, 7.112676056338032], 0.9999999999999999, [-7.112676056338046, 2.1126760563380316], 0, [-2.112676056338046, 2.1126760563380316], 0, [-2.112676056338046, 12.112676056338032], 0, [-7.112676056338046, 12.112676056338032], -0.9999999999999999, [-7.112676056338046, 7.112676056338032], 0, false]
[2, "Polyline", 2, 1, 103, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.112676056338046, 2.1126760563380316, 0, 1], 1, 2, 6, [0, 0], 0, [5, 0], 1, [5, 5], -1, [5, 10], 0, [0, 10], 0, [0, 0], 0, false, "Polyline", 2, 1, 104, false, 7, 0, [-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1], 1, 2, 6, [-7.112676056338046, 7.112676056338032], 0.9999999999999999, [-7.112676056338046, 2.1126760563380316], 0, [-2.112676056338046, 2.1126760563380316], 0, [-2.112676056338046, 12.112676056338032], 0, [-7.112676056338046, 12.112676056338032], -0.9999999999999999, [-7.112676056338046, 7.112676056338032], 0, false];
let pls = LoadEntityFromFileData(d) as Polyline[];

@ -4,7 +4,7 @@ import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util";
test('EdgeGeometry生成', () =>
{
let d = [3, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 842.2974778978387, -349.77794462809106, 5.207248635008, 1], 2, 1200, 1287.9139521874604, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1287.9139521874604, 0], 0, [1287.9139521874604, 1200], 0, [0, 1200], 0, true, 1, 2, 650.3947318524762, 368.7144637049523, 18, false, "Polyline", 3, 2, 0, false, 0, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1827.9668979500452, -289.76232632197764, 0, 1], 2, 4, [1827.9668979500452, 755.7998263219777], 0, [1827.9668979500452, 289.76232632197764], 0, [2196.6813616549975, 289.76232632197764], 0, [2196.6813616549975, 755.7998263219777], 0.9999999999999999, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 842.2974778978387, -132.52737566129053, 492.2690189409713, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -331.4882673815591, 22.964750159997493, 5.207248635008, 1], 1, "左侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[\"three\",\"three\",\"three\",\"three\",\"three\",\"three\"]}", 0, 0, "Board", 3, 2, 211, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1743.9852053204086, 1058.889397823259, -54.29958601640169, 1], 2, 1230.761278665225, 896.6684244728249, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5.684341886080802e-14, 30.761278665225063, 0, 1], 2, 6, [0, 0], 0, [300, 0], 1.44245572325029, [315.9503077287227, 816.1221829065471], 0, [600, 1200], 0, [300, 1200], 0.41421356237309503, [0, 900], 0, true, 1, 2, 385.96920000000006, 177.84615384615404, 10, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -422.15384615384596, -402.0513128205126, 0, 1], 2, 5, [597.7122651988514, 788.0205128205126], 0, [422.15384615384596, 788.0205128205126], 0, [422.15384615384596, 402.05131282051263], 0, [600, 402.0513128205126], 0, [599.9999999999998, 786.9320348416215], 0.0014989901540299988, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1751.9852053204086, 1481.043243977105, 378.51300546933595, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -17.633213176275603, 262.61914493865333, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0, "Board", 3, 2, 212, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1111.9162051636208, 2117.9319139518834, -423.9845986472139, 1], 2, 484.63826594239083, 642.7439363026181, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 54.03714224287984, -40.88462318428341, 0, 1], 2, 6, [226.89796571085776, 338.3121692475904], 0, [248.97426264670497, 525.5228891266743], 0, [-54.03714224287984, 287.9783168893773], 0, [141.82369879876416, 40.88462318428341], 0, [588.7067940597382, 306.7620304373949], 0, [320.72013691164284, 378.99785818408446], 0, true, 1, 2, 63.40599363597872, 232.13273756151398, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -58.35238007400439, -234.55749771884788, 0, 1], 2, 4, [236.13305395456487, 234.55749771884788], 0, [83.25375055383591, 272.608758187791], 0, [58.35238007400439, 297.9634913548266], 0, [290.48511763551835, 268.97109344254164], 0, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1111.9162051636208, 2230.3214362687672, -230.31172411264944, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -776.2476068199197, 3557.665244594688, -46.81305616698228, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0]
let d = [3, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 842.2974778978387, -349.77794462809106, 5.207248635008, 1], 2, 1200, 1287.9139521874604, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1287.9139521874604, 0], 0, [1287.9139521874604, 1200], 0, [0, 1200], 0, true, 1, 2, 650.3947318524762, 368.7144637049523, 18, false, "Polyline", 3, 2, 0, false, 0, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1827.9668979500452, -289.76232632197764, 0, 1], 2, 4, [1827.9668979500452, 755.7998263219777], 0, [1827.9668979500452, 289.76232632197764], 0, [2196.6813616549975, 289.76232632197764], 0, [2196.6813616549975, 755.7998263219777], 0.9999999999999999, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 842.2974778978387, -132.52737566129053, 492.2690189409713, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -331.4882673815591, 22.964750159997493, 5.207248635008, 1], 1, "左侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[\"three\",\"three\",\"three\",\"three\",\"three\",\"three\"]}", 0, 0, "Board", 3, 2, 211, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1743.9852053204086, 1058.889397823259, -54.29958601640169, 1], 2, 1230.761278665225, 896.6684244728249, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5.684341886080802e-14, 30.761278665225063, 0, 1], 2, 6, [0, 0], 0, [300, 0], 1.44245572325029, [315.9503077287227, 816.1221829065471], 0, [600, 1200], 0, [300, 1200], 0.41421356237309503, [0, 900], 0, true, 1, 2, 385.96920000000006, 177.84615384615404, 10, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -422.15384615384596, -402.0513128205126, 0, 1], 2, 5, [597.7122651988514, 788.0205128205126], 0, [422.15384615384596, 788.0205128205126], 0, [422.15384615384596, 402.05131282051263], 0, [600, 402.0513128205126], 0, [599.9999999999998, 786.9320348416215], 0.0014989901540299988, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1751.9852053204086, 1481.043243977105, 378.51300546933595, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -17.633213176275603, 262.61914493865333, 0, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0, "Board", 3, 2, 212, false, 1, 2, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1111.9162051636208, 2117.9319139518834, -423.9845986472139, 1], 2, 484.63826594239083, 642.7439363026181, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 54.03714224287984, -40.88462318428341, 0, 1], 2, 6, [226.89796571085776, 338.3121692475904], 0, [248.97426264670497, 525.5228891266743], 0, [-54.03714224287984, 287.9783168893773], 0, [141.82369879876416, 40.88462318428341], 0, [588.7067940597382, 306.7620304373949], 0, [320.72013691164284, 378.99785818408446], 0, true, 1, 2, 63.40599363597872, 232.13273756151398, 18, false, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -58.35238007400439, -234.55749771884788, 0, 1], 2, 4, [236.13305395456487, 234.55749771884788], 0, [83.25375055383591, 272.608758187791], 0, [58.35238007400439, 297.9634913548266], 0, [290.48511763551835, 268.97109344254164], 0, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1111.9162051636208, 2230.3214362687672, -230.31172411264944, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -776.2476068199197, 3557.665244594688, -46.81305616698228, 1], 1, "右侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0];
let brs = LoadBoardsFromFileData(d);
for (let br of brs)
@ -17,7 +17,7 @@ test('EdgeGeometry生成', () =>
test('EdgeGeometry生成2', () =>
{
let d = { "file": [1, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 3652.4820542036323, 5394.829497889616, 0, 1], 0, 0, 2, 577.5, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 200, 0, 1], 0, 0, 2, 4, [0, -200], 0, [600, -200], 0, [600, 377.49999999999994], 0, [0, 377.5], 0, true, 1, 2, 9, 577.5, 10.759448803828036, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [577.5, 0], 0, [577.5, 9], 0, [0, 9], 0, true, 0, 3, 0, 0, 0, [0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 3652.4820542036323, 5974.829497889616, 0, 1], 3, 0, 0, 0, 5, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3652.4820542036323, 5394.829497889616, 200, 1], 1, "立板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0], "basePt": { "x": 3652.4820542036323, "y": 5394.829497889616, "z": 0 } }
let d = { "file": [1, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 3652.4820542036323, 5394.829497889616, 0, 1], 0, 0, 2, 577.5, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 200, 0, 1], 0, 0, 2, 4, [0, -200], 0, [600, -200], 0, [600, 377.49999999999994], 0, [0, 377.5], 0, true, 1, 2, 9, 577.5, 10.759448803828036, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [577.5, 0], 0, [577.5, 9], 0, [0, 9], 0, true, 0, 3, 0, 0, 0, [0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 3652.4820542036323, 5974.829497889616, 0, 1], 3, 0, 0, 0, 5, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3652.4820542036323, 5394.829497889616, 200, 1], 1, "立板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0], "basePt": { "x": 3652.4820542036323, "y": 5394.829497889616, "z": 0 } };
let brs = LoadBoardsFromFileData(d);
for (let br of brs)

@ -38,7 +38,7 @@ describe('排序测试', () =>
new Vector3(3, 3, 1),
new Vector3(1, 3, 1),
new Vector3(1, 2, 1),
]
];
test('排序点xyz', () =>
{
pts.sort(comparePoint("xyz"));

@ -3,37 +3,37 @@ import { Vector3 } from "three";
test('俯视图', () =>
{
//逆时针
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)) //?
expect(v).toEqual(Math.PI * 0.5)
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)); //?
expect(v).toEqual(Math.PI * 0.5);
//顺时针
let v2 = angleTo(new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)) //?
expect(v2).toEqual(Math.PI * -0.5)
let v2 = angleTo(new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)); //?
expect(v2).toEqual(Math.PI * -0.5);
});
test('仰视', () =>
{
//顺时针
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, -1)) //?
expect(v).toEqual(Math.PI * -0.5)
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, -1)); //?
expect(v).toEqual(Math.PI * -0.5);
});
test('右视图', () =>
{
let v = angleTo(new Vector3(0, 0, 1), new Vector3(0, 1, 0), new Vector3(1, 0, 0)) //?
expect(v).toEqual(Math.PI * -0.5)
let v = angleTo(new Vector3(0, 0, 1), new Vector3(0, 1, 0), new Vector3(1, 0, 0)); //?
expect(v).toEqual(Math.PI * -0.5);
v = angleTo(new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)) //?
expect(v).toEqual(Math.PI * 0.5)
v = angleTo(new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); //?
expect(v).toEqual(Math.PI * 0.5);
});
test('0向量', () =>
{
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)) //?
expect(v).toEqual(0)
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); //?
expect(v).toEqual(0);
});
test('变量补全', () =>
{
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 0, 1)) //?
expect(v).toEqual(Math.PI * 0.5)
let v = angleTo(new Vector3(1, 0, 0), new Vector3(0, 0, 1)); //?
expect(v).toEqual(Math.PI * 0.5);
});

@ -16,7 +16,7 @@ test("三点共线", () =>
expect(arc.StartAngle).toMatchSnapshot();
expect(arc.EndAngle).toMatchSnapshot();
expect(arc.Radius).toMatchSnapshot();
})
});
test("三点圆心", () =>
{
@ -29,7 +29,7 @@ test("三点圆心", () =>
expect(arc.Center.toArray()).toMatchObject([5, 0, 0]);
expect(arc.StartAngle).toMatchSnapshot();
expect(arc.EndAngle).toMatchSnapshot();
})
});
test("三点同一位置", () =>
{
@ -42,7 +42,7 @@ test("三点同一位置", () =>
expect(arc.Center.toArray()).toMatchObject([5, 5, 0]);
expect(arc.StartAngle).toMatchSnapshot();
expect(arc.EndAngle).toMatchSnapshot();
})
});
test('圆弧参数', () =>
{
@ -122,7 +122,7 @@ test("由距离得到对应点", () =>
test("由参数得到距离", () =>
{
let arc = new Arc(new Vector3(5, 0, 0), 5, Math.PI, 0);
equaln(arc.GetDistAtParam(0.5), 0.5 * Math.PI * 5)
equaln(arc.GetDistAtParam(0.5), 0.5 * Math.PI * 5);
expect(equaln(arc.GetDistAtParam(0.5), 0.5 * Math.PI * 5)).toBeTruthy();
}
);
@ -259,7 +259,7 @@ test('容差相接', () =>
arc2.EndAngle = 0.5;
expect(arc.Join(arc2)).toBeTruthy();
arc.StartAngle //?
arc.StartAngle; //?
expect(arc.EndAngle).toBe(0.5);
//终点对起点

@ -1,5 +1,5 @@
import { Box3Ext } from "../../src/Geometry/Box"
import { Box3Ext } from "../../src/Geometry/Box";
import { Vector3 } from "three";
test('盒子相减', () =>

@ -7,7 +7,7 @@ test('圆参数', () =>
let circle = new Circle(new Vector3(5, 0, 0), 5);
circle.GetParamAtPoint(new Vector3(0, 0, 0))/*?*/
circle.GetParamAtPoint(new Vector3(0, 0, 0));/*?*/
expect(equaln(circle.GetParamAtPoint(new Vector3(0, 0, 0))/*?*/, 0.5)).toBeTruthy();
expect(equaln(circle.GetParamAtPoint(new Vector3(5, 5, 0)), 0.25)).toBeTruthy();
@ -44,8 +44,8 @@ test("圆的切割2", () =>
for (let c of cs)
{
expect(c.StartPoint).toMatchSnapshot()
expect(c.EndPoint).toMatchSnapshot()
expect(c.StartPoint).toMatchSnapshot();
expect(c.EndPoint).toMatchSnapshot();
}
});
@ -83,11 +83,11 @@ test('圆偏移', () =>
let arcs3 = circle.GetOffsetCurves(10);
let arcs = circle.GetOffsetCurves(-3);
arcs3[0].StartPoint //?
arcs3[0].EndPoint //?
arcs3[0].StartPoint; //?
arcs3[0].EndPoint; //?
arcs[0].StartPoint //?
arcs[0].EndPoint //?
arcs[0].StartPoint; //?
arcs[0].EndPoint; //?
// expect(arcs.length).toBe(1);
// expect(arcs.length).toBe(Math.PI * 2);
@ -97,22 +97,22 @@ test('圆偏移', () =>
let circle2 = new Circle(new Vector3(10, 0, 0), 10);
let circles2 = circle2.GetOffsetCurves(-5)[0]; //?
circles2.StartPoint //?
circles2.EndPoint //?
circles2.StartPoint; //?
circles2.EndPoint; //?
expect(circles2.StartPoint).toMatchSnapshot();
expect(circles2.EndPoint).toMatchSnapshot();
circles2 = circle2.GetOffsetCurves(10)[0]; //?
circles2.StartPoint //?
circles2.EndPoint //?
circles2.StartPoint; //?
circles2.EndPoint; //?
expect(circles2.StartPoint).toMatchSnapshot();
expect(circles2.EndPoint).toMatchSnapshot();
expect(circles2.StartPoint).toMatchSnapshot();
expect(circles2.EndPoint).toMatchSnapshot();
circles2 = circle2.GetOffsetCurves(-5)[0]; //?
circles2.StartPoint //?
circles2.EndPoint //?
circles2.StartPoint; //?
circles2.EndPoint; //?
expect(circles2.StartPoint).toMatchSnapshot();
expect(circles2.EndPoint).toMatchSnapshot();
});

@ -26,14 +26,14 @@ describe('完整椭圆', () =>
expect(el.Length).toBeCloseTo(1150.66);
expect(el.Area).toMatchSnapshot();
expect(el.Area).toBeCloseTo(78539.82);
})
});
test("PtOnCurve", () =>
{
let pt = new Vector3(160.20983328761838, 76.76750283077186);
[pt, new Vector3(250), new Vector3(0, -100)].forEach(p =>
{
expect(el.PtOnCurve(p)).toBeTruthy();
})
});
});
test("GetPointAtParam", () =>
{
@ -144,7 +144,7 @@ describe('完整椭圆', () =>
expect(pts.length).toBe(0);
let data =
{ "file": [2, "Ellipse", 3, 2, 833, false, 0, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 11102.861204896697, 0, 2032.2646535460103, 1], 1, 3731.0773801284895, 1822.1540693650747, -0.7853981633972875, 0, 6.283185307179586, "Circle", 3, 2, 842, false, 1, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 11102.861204896697, 0, 2032.2646535460103, 1], 1, 3001.2505191312093], "basePt": { "x": 20324.11883779178, "y": 0, "z": 2875.7945530299553 } }
{ "file": [2, "Ellipse", 3, 2, 833, false, 0, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 11102.861204896697, 0, 2032.2646535460103, 1], 1, 3731.0773801284895, 1822.1540693650747, -0.7853981633972875, 0, 6.283185307179586, "Circle", 3, 2, 842, false, 1, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 11102.861204896697, 0, 2032.2646535460103, 1], 1, 3001.2505191312093], "basePt": { "x": 20324.11883779178, "y": 0, "z": 2875.7945530299553 } };
let cus = LoadCurvesFromFileData(data) as Curve[];
pts = cus[0].IntersectWith(cus[1], 0);
expect(pts.length).toBe(4);
@ -155,7 +155,7 @@ describe('完整椭圆', () =>
let pl = LoadCurvesFromFileData(data)[0];
let pts = el.IntersectWith(pl, 0);
expect(pts.length).toBe(2);
data = { "file": [1, "Polyline", 3, 2, 113, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-410.1219439207879, -125.67070828328724], 0, [-173.79584080236958, -1.6724443014010655], 0.2825944770646096, [-68.76201719418361, 174.84273148457797], -2.140757839596393, [63.989065421717896, 66.8913016650536], 0, [441.8190697900534, -102.32985859257917], 0, false], "basePt": { "x": 435.98385736737646, "y": -78.98900890187124, "z": 0 } }
data = { "file": [1, "Polyline", 3, 2, 113, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-410.1219439207879, -125.67070828328724], 0, [-173.79584080236958, -1.6724443014010655], 0.2825944770646096, [-68.76201719418361, 174.84273148457797], -2.140757839596393, [63.989065421717896, 66.8913016650536], 0, [441.8190697900534, -102.32985859257917], 0, false], "basePt": { "x": 435.98385736737646, "y": -78.98900890187124, "z": 0 } };
pl = LoadCurvesFromFileData(data)[0];
pts = el.IntersectWith(pl, 0);
expect(pts.length).toBe(4);
@ -172,18 +172,18 @@ describe('完整椭圆', () =>
let el3 = LoadCurvesFromFileData(data)[0];
pts = el.IntersectWith(el3, 0);
expect(pts.length).toBe(4);
data = { "file": [1, "Ellipse", 3, 2, 115, false, 1, 7, 0, [-0.4190581774617472, -0.9079593845004515, 0, 0, 0.9079593845004515, -0.4190581774617472, 0, 0, 0, 0, 1, 0, 187.7445845668207, 364.27473348939463, 0, 1], 1, 250, 100, 0, 0, 6.283185307179586], "basePt": { "x": 317.9344290644616, "y": 379.38531948896275, "z": 0 } }
data = { "file": [1, "Ellipse", 3, 2, 115, false, 1, 7, 0, [-0.4190581774617472, -0.9079593845004515, 0, 0, 0.9079593845004515, -0.4190581774617472, 0, 0, 0, 0, 1, 0, 187.7445845668207, 364.27473348939463, 0, 1], 1, 250, 100, 0, 0, 6.283185307179586], "basePt": { "x": 317.9344290644616, "y": 379.38531948896275, "z": 0 } };
el3 = LoadCurvesFromFileData(data)[0];
pts = el.IntersectWith(el3, 0);
expect(pts.length).toBe(0);
})
});
});
describe("非完整椭圆", () =>
{
let data = { "file": [1, "Ellipse", 3, 2, 121, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 250, 100, 0, 3.2624068331327574, 1.8128125175408325], "basePt": { "x": 948.626520974941, "y": -75.40395225389025, "z": 0 } };
let el = LoadCurvesFromFileData(data)[0] as Ellipse;
data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 334.56716843563856, "y": 365.4059797015151, "z": 0 } }
data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 334.56716843563856, "y": 365.4059797015151, "z": 0 } };
let el2 = LoadCurvesFromFileData(data)[0] as Ellipse;
test("几何参数", () =>
{
@ -195,12 +195,12 @@ describe("非完整椭圆", () =>
test("PtOnCurve", () =>
{
let p = new Vector3(-283.26124450979813, 673.4306820783466);
let data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 2681.2570394768845, "y": -1593.4506532289088, "z": 0 } }
let data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 2681.2570394768845, "y": -1593.4506532289088, "z": 0 } };
let l = LoadCurvesFromFileData(data)[0] as Ellipse;
expect(l.PtOnCurve(p)).toBeTruthy();
p = new Vector3(2397.1610323469677, 85.35748381925586);
data = { "file": [1, "Ellipse", 3, 2, 444, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2079.1139796352218, 127.64566779152159, 0, 1], 1, 225.54490978414742, 418.1552083854798, -2.2679288522075365, 5.505791307943451, 2.904018399381034], "basePt": { "x": 3700.685116502911, "y": -68.9791965641534, "z": 0 } }
data = { "file": [1, "Ellipse", 3, 2, 444, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2079.1139796352218, 127.64566779152159, 0, 1], 1, 225.54490978414742, 418.1552083854798, -2.2679288522075365, 5.505791307943451, 2.904018399381034], "basePt": { "x": 3700.685116502911, "y": -68.9791965641534, "z": 0 } };
l = LoadCurvesFromFileData(data)[0] as Ellipse;
expect(l.PtOnCurve(p)).toBeTruthy();
});
@ -211,7 +211,7 @@ describe("非完整椭圆", () =>
});
test("GetParamAtPoint", () =>
{
let data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 2681.2570394768845, "y": -1593.4506532289088, "z": 0 } }
let data = { "file": [1, "Ellipse", 3, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 2681.2570394768845, "y": -1593.4506532289088, "z": 0 } };
let l = LoadCurvesFromFileData(data)[0] as Ellipse;
let p = new Vector3(246.01582144145584, 746.3383795723034);
expect(l.GetParamAtPoint(p)).toBeCloseTo(1);
@ -239,17 +239,17 @@ describe("非完整椭圆", () =>
test("GetFistDeriv", () =>
{
let p = new Vector3(3245.070906808509, -20.406490193093504);
let data = { "file": [1, "Ellipse", 3, 2, 131, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096328, 62.245373351688414, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 3893.631897322025, "y": -235.90267753572692, "z": 0 } }
let data = { "file": [1, "Ellipse", 3, 2, 131, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096328, 62.245373351688414, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 3893.631897322025, "y": -235.90267753572692, "z": 0 } };
let el = LoadCurvesFromFileData(data)[0] as Ellipse;
let derv = el.GetFistDeriv(p);
expect(derv.x < 0).toBeTruthy();
expect(derv.y > 0).toBeTruthy();
derv = el.GetFistDeriv(0.2)
derv = el.GetFistDeriv(0.2);
expect(derv.x > 0).toBeTruthy();
expect(derv.y < 0).toBeTruthy();
derv = el.GetFistDeriv(0.5)
derv = el.GetFistDeriv(0.5);
expect(derv.x > 0).toBeTruthy();
expect(derv.y > 0).toBeTruthy();
@ -286,7 +286,7 @@ describe("非完整椭圆", () =>
test("join", () =>
{
expect(el.Join(el2)).toBeFalsy();
let data = { "file": [2, "Ellipse", 3, 2, 834, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096328, 62.245373351688414, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 6.343188564109003, 7.616407379765725, "Ellipse", 3, 2, 833, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096327, 62.24537335168705, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 6.34318856410901], "basePt": { "x": 3070.6075022402556, "y": -251.35268998703185, "z": 0 } }
let data = { "file": [2, "Ellipse", 3, 2, 834, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096328, 62.245373351688414, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 6.343188564109003, 7.616407379765725, "Ellipse", 3, 2, 833, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096327, 62.24537335168705, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 6.34318856410901], "basePt": { "x": 3070.6075022402556, "y": -251.35268998703185, "z": 0 } };
let els = LoadCurvesFromFileData(data) as Ellipse[];
expect(els[0].Join(els[1])).toBeTruthy();
expect(els[0].StartAngle).toBeCloseTo(el2.StartAngle);
@ -302,18 +302,18 @@ describe("非完整椭圆", () =>
});
test("椭圆和直线相交", () =>
{
let data = { "file": [1, "Line", 3, 2, 835, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [40.99635967060419, 828.344303500637, 0], [419.2963252629038, 79.65300513942876, 0]], "basePt": { "x": 1547.6371722986987, "y": 505.9487058831845, "z": 0 } }
let data = { "file": [1, "Line", 3, 2, 835, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [40.99635967060419, 828.344303500637, 0], [419.2963252629038, 79.65300513942876, 0]], "basePt": { "x": 1547.6371722986987, "y": 505.9487058831845, "z": 0 } };
let l = LoadCurvesFromFileData(data)[0] as Line;
let intPts = el2.IntersectWith(l, 0);
expect(intPts.length).toBe(1);
data = { "file": [1, "Line", 3, 2, 836, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [-508.03376696505734, 378.26728108419354, 0], [1506.1407092390264, 857.0726240804099, 0]], "basePt": { "x": 819.8530509444495, "y": 697.4708430816711, "z": 0 } }
data = { "file": [1, "Line", 3, 2, 836, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [-508.03376696505734, 378.26728108419354, 0], [1506.1407092390264, 857.0726240804099, 0]], "basePt": { "x": 819.8530509444495, "y": 697.4708430816711, "z": 0 } };
l = LoadCurvesFromFileData(data)[0] as Line;
intPts = el2.IntersectWith(l, 0);
expect(intPts.length).toBe(2);
});
test("椭圆和圆弧相交", () =>
{
let data = { "file": [1, "Circle", 3, 2, 837, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 240.28658436372382], "basePt": { "x": 1747.976477968104, "y": 478.1948499374774, "z": 0 } }
let data = { "file": [1, "Circle", 3, 2, 837, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 29.61201700564709, 641.6901339885158, 0, 1], 1, 240.28658436372382], "basePt": { "x": 1747.976477968104, "y": 478.1948499374774, "z": 0 } };
let cir = LoadCurvesFromFileData(data)[0] as Circle;
let intPts = el2.IntersectWith(cir, 0);
expect(intPts.length).toBe(3);
@ -321,12 +321,12 @@ describe("非完整椭圆", () =>
let cus = el2.GetSplitCurvesByPts(intPts);
expect(cus.length).toBe(3);
data = { "file": [1, "Circle", 3, 2, 829, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 187.80449653238327, 687.2252854417625, 0, 1], 1, 142.38840109430407], "basePt": { "x": 230.04137781057622, "y": 568.9620178628227, "z": 0 } }
data = { "file": [1, "Circle", 3, 2, 829, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 187.80449653238327, 687.2252854417625, 0, 1], 1, 142.38840109430407], "basePt": { "x": 230.04137781057622, "y": 568.9620178628227, "z": 0 } };
cir = LoadCurvesFromFileData(data)[0] as Circle;
intPts = el2.IntersectWith(cir, 0);
expect(intPts.length).toBe(1);
data = { "file": [1, "Arc", 3, 2, 830, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 23.981256652944406, 734.2425700250855, 0, 1], 2, 380.9050292698399, 3.8973798333988365, 0.296805111427033, false], "basePt": { "x": 676.8826456844006, "y": 686.8100446096855, "z": 0 } }
data = { "file": [1, "Arc", 3, 2, 830, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 23.981256652944406, 734.2425700250855, 0, 1], 2, 380.9050292698399, 3.8973798333988365, 0.296805111427033, false], "basePt": { "x": 676.8826456844006, "y": 686.8100446096855, "z": 0 } };
let arc = LoadCurvesFromFileData(data)[0] as Arc;
@ -337,7 +337,7 @@ describe("非完整椭圆", () =>
test("椭圆和多段线相交", () =>
{
let data =
{ "file": [1, "Polyline", 3, 2, 831, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-199.7615585356133, 411.90419659644084], 0, [67.50801592170811, 509.64849811226117], 0, [316.4505338448129, 443.97654553131935], 0, [316.4505338448129, 828.844732749862], 0, false], "basePt": { "x": 1289.3117848694626, "y": 358.45028170497653, "z": 0 } }
{ "file": [1, "Polyline", 3, 2, 831, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-199.7615585356133, 411.90419659644084], 0, [67.50801592170811, 509.64849811226117], 0, [316.4505338448129, 443.97654553131935], 0, [316.4505338448129, 828.844732749862], 0, false], "basePt": { "x": 1289.3117848694626, "y": 358.45028170497653, "z": 0 } };
let l = LoadCurvesFromFileData(data)[0] as Polyline;
let pts = el2.IntersectWith(l, 0);
@ -347,12 +347,12 @@ describe("非完整椭圆", () =>
test("椭圆椭圆相交", () =>
{
let data =
{ "file": [1, "Ellipse", 3, 2, 121, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 280.916829323563, 321.0478049412151, 0, 1], 1, 250, 100, 0, 3.2624068331327574, 1.8128125175408325], "basePt": { "x": 217.06597636418695, "y": 243.35797242008385, "z": 0 } }
{ "file": [1, "Ellipse", 3, 2, 121, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 280.916829323563, 321.0478049412151, 0, 1], 1, 250, 100, 0, 3.2624068331327574, 1.8128125175408325], "basePt": { "x": 217.06597636418695, "y": 243.35797242008385, "z": 0 } };
let l = LoadCurvesFromFileData(data)[0] as Ellipse;
let pts = el2.IntersectWith(l, 0);
expect(pts.length).toBe(1);
})
})
});
});

@ -30,7 +30,7 @@ test('相交测试', () =>
new THREE.Vector3(0.5, 8));
expect(ins).toMatchSnapshot();
})
});
test('三维空间直线相交测试', () =>
{
let p1 = new THREE.Vector3();
@ -54,65 +54,65 @@ test('三维空间直线相交测试', () =>
new Vector3(1, 1, 4),
new Vector3(2, 2, 2),
new Vector3(2, 2, 10)
)
);
expect(res).toBeUndefined();
res = IntersectLine3AndLine3(
new Vector3(1, 0, 1),
new Vector3(1, 0, 4),
new Vector3(0.5, 0, 3),
new Vector3(0.5, 0, 10)
)
);
expect(res).toBeUndefined();
})
});
test('三维空间圆圆相交测试', () =>
{
let data =
[2, "Circle", 1, 1, 0, false, 7, 0, [-0.1485675258840154, -0.98346692600856, 0.10353982663678746, 0, 0.8068528994682419, -0.18108783903750572, -0.5623127183093208, 0, 0.5717657639911589, 0, 0.8204169129946106, 0, 5.585923427922135, -0.5874251796993211, -0.834443475807827, 1], 1, 2.1223349919617873, "Circle", 1, 1, 0, false, 7, 0, [-0.1485675258840154, -0.98346692600856, 0.10353982663678746, 0, 0.8068528994682419, -0.18108783903750572, -0.5623127183093208, 0, 0.5717657639911589, 0, 0.8204169129946106, 0, 3.2540542870196947, -1.8996318241962369, 0.7906850652516981, 1], 1, 1.5840127550993974]
[2, "Circle", 1, 1, 0, false, 7, 0, [-0.1485675258840154, -0.98346692600856, 0.10353982663678746, 0, 0.8068528994682419, -0.18108783903750572, -0.5623127183093208, 0, 0.5717657639911589, 0, 0.8204169129946106, 0, 5.585923427922135, -0.5874251796993211, -0.834443475807827, 1], 1, 2.1223349919617873, "Circle", 1, 1, 0, false, 7, 0, [-0.1485675258840154, -0.98346692600856, 0.10353982663678746, 0, 0.8068528994682419, -0.18108783903750572, -0.5623127183093208, 0, 0.5717657639911589, 0, 0.8204169129946106, 0, 3.2540542870196947, -1.8996318241962369, 0.7906850652516981, 1], 1, 1.5840127550993974];
testCirAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.5, 0, 0, 1], 1, 5]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.5, 0, 0, 1], 1, 5];
testCirAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5];
testCirAndCirIntersect(data);
data =
[2, "Arc", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, -7.223901135674274, -7.066640793063616, 1], 2, 4.787455889013074, 2.4468553886273967, 0.7203768859081977, true, "Arc", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, -12.887397630639091, -5.59172322768673, 1], 2, 4.265691675276281, 3.020045238916937, 0.9631807673370143, true]
[2, "Arc", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, -7.223901135674274, -7.066640793063616, 1], 2, 4.787455889013074, 2.4468553886273967, 0.7203768859081977, true, "Arc", 1, 1, 0, false, 7, 0, [0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, -12.887397630639091, -5.59172322768673, 1], 2, 4.265691675276281, 3.020045238916937, 0.9631807673370143, true];
testCirAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.5, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.5, 0, 0, 1], 1, 5, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5];
testCirAndCirIntersect(data);
})
});
test('三维空间直线和圆相交测试', () =>
{
let data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [2.4219301113484804, 0, 6.278428496635537], [9.19486541121855, 0, -0.38347507700715716]]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2.5, 0, 0, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [2.4219301113484804, 0, 6.278428496635537], [9.19486541121855, 0, -0.38347507700715716]];
testLineAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [-3.6226270297054635, 5.273119429622456, 0], [-3.6226270297054652, -5.297100907223948, 0]]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [-3.6226270297054635, 5.273119429622456, 0], [-3.6226270297054652, -5.297100907223948, 0]];
testLineAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.418897659897576, -9.71681408534522, 4.841809080303142, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [9.796270630192113, -4.443694655722764, 4.841809080303142], [9.796270630192112, -15.013914992569168, 4.841809080303142]]
[2, "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.418897659897576, -9.71681408534522, 4.841809080303142, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [9.796270630192113, -4.443694655722764, 4.841809080303142], [9.796270630192112, -15.013914992569168, 4.841809080303142]];
testLineAndCirIntersect(data);
data =
[2, "Circle", 1, 1, 0, false, 7, 0, [0.8517840265050032, 0, -0.5238930923298417, 0, 0, 1, 0, 0, 0.5238930923298417, 0, 0.8517840265050032, 0, 15.469956975945145, -9.71681408534522, 4.4481472148971575, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [12.384261138056765, -4.443694655722764, 6.346016491847221], [12.384261138056765, -15.013914992569168, 6.346016491847222]]
[2, "Circle", 1, 1, 0, false, 7, 0, [0.8517840265050032, 0, -0.5238930923298417, 0, 0, 1, 0, 0, 0.5238930923298417, 0, 0.8517840265050032, 0, 15.469956975945145, -9.71681408534522, 4.4481472148971575, 1], 1, 5, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [12.384261138056765, -4.443694655722764, 6.346016491847221], [12.384261138056765, -15.013914992569168, 6.346016491847222]];
testLineAndCirIntersect(data);
})
});
test('补充相交测试', () =>
{
let data =
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.3934337707580937, 0.039495588796686576, 0, 1], 1, [12.270990240675426, 8.520323796959827, 0], [12.270990240675426, 4.4951100391838885, 0], "Arc", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.662687223232803, 4.584664645783669, 0, 1], 2, 0.003163048700428762, 6.156784789283385, 3.3367334474492862, true]
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.3934337707580937, 0.039495588796686576, 0, 1], 1, [12.270990240675426, 8.520323796959827, 0], [12.270990240675426, 4.4951100391838885, 0], "Arc", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.662687223232803, 4.584664645783669, 0, 1], 2, 0.003163048700428762, 6.156784789283385, 3.3367334474492862, true];
let cus = LoadEntityFromFileData(data);
let [cu1, cu2] = cus[0] instanceof Line ? cus : cus.reverse();
let pts = cu1.IntersectWith(cu2, 0);
expect(pts.length).toBe(1);
data =
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.3934337707580937, 0.039495588796686576, 0, 1], 1, [12.270990240675426, 8.520323796959827, 0], [12.270990240675426, 4.4951100391838885, 0], "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.662687223232803, 4.584664645783669, 0, 1], 1, 0.0031630487004287015]
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.3934337707580937, 0.039495588796686576, 0, 1], 1, [12.270990240675426, 8.520323796959827, 0], [12.270990240675426, 4.4951100391838885, 0], "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.662687223232803, 4.584664645783669, 0, 1], 1, 0.0031630487004287015];
cus = LoadEntityFromFileData(data);
[cu1, cu2] = cus[0] instanceof Line ? cus : cus.reverse();
pts = cu1.IntersectWith(cu2, 0);
expect(pts.length).toBe(2);
})
});
function testCirAndCirIntersect(data)
{
@ -143,7 +143,7 @@ test('直线和圆 圆心和直线重合的时候', () =>
test('直线和圆相切', () =>
{
let data =
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.33854166666666696, 0, 1], 1, [23700.893770110895, 6917.069643795053, 0], [34450.21257120082, 3606.4429407977773, 0], "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 34567.94904695702, 3989.061644487676, 0, 1], 1, 400]
[2, "Line", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0.33854166666666696, 0, 1], 1, [23700.893770110895, 6917.069643795053, 0], [34450.21257120082, 3606.4429407977773, 0], "Circle", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 34567.94904695702, 3989.061644487676, 0, 1], 1, 400];
let cus = LoadEntityFromFileData(data) as Array<Curve>;
let pts = cus[0].IntersectWith(cus[1], 0);
expect(pts).toMatchSnapshot();

@ -18,7 +18,7 @@ test('坐标系对齐', () =>
new Vector3(-1),
new Vector3(0, -1),
new Vector3(0, 0, 1)
)
);
let m3 = matrixAlignCoordSys(m1, m2);

@ -69,7 +69,7 @@ test("", () =>
let newD = orb.UpdateDirection();
expect(equalv3(newD, new THREE.Vector3(0, 0, -1))).toBe(true);
})
});
test("测试求向量", () =>
@ -88,4 +88,4 @@ test("测试求向量", () =>
dir.x = 1;
Orbit.ComputUpDirection(dir, up);
expect(up).toMatchSnapshot();
})
});

@ -94,26 +94,26 @@ test('直线偏移', () =>
let l2 = new Line(new Vector3(0, 0, 0), new Vector3(5, 5, 0));
let lines2 = l2.GetOffsetCurves(-10)[0]; //?
lines2.StartPoint //?
lines2.EndPoint //?
lines2.StartPoint; //?
lines2.EndPoint; //?
expect(lines2.StartPoint).toMatchSnapshot();
expect(lines2.EndPoint).toMatchSnapshot();
lines2 = l2.GetOffsetCurves(10)[0]; //?
lines2.StartPoint //?
lines2.EndPoint //?
lines2.StartPoint; //?
lines2.EndPoint; //?
expect(lines2.StartPoint).toMatchSnapshot();
expect(lines2.EndPoint).toMatchSnapshot();
l2.EndPoint = l2.EndPoint.negate();
lines2 = l2.GetOffsetCurves(10)[0]; //?
lines2.StartPoint //?
lines2.EndPoint //?
lines2.StartPoint; //?
lines2.EndPoint; //?
expect(lines2.StartPoint).toMatchSnapshot();
expect(lines2.EndPoint).toMatchSnapshot();
lines2 = l2.GetOffsetCurves(-10)[0]; //?
lines2.StartPoint //?
lines2.EndPoint //?
lines2.StartPoint; //?
lines2.EndPoint; //?
expect(lines2.StartPoint).toMatchSnapshot();
expect(lines2.EndPoint).toMatchSnapshot();
});

@ -9,7 +9,7 @@ import "../Utils/jest.util";
//#IOX9F 倒角半径100
test('', () =>
{
[1, "Polyline", 2, 1, 104, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5438.7151791877595, -4532.723515247859, -1.344596967101097e-7, 1], 1, 2, 4, [-272.5963980009974, 125.26453527188733], -0.6297899607010771, [268.45496627781176, 133.9101604837315], 0, [286.92760827694747, 96.87732841911384], 0, [648.509529180903, 718.346254972786], 0, false]
[1, "Polyline", 2, 1, 104, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5438.7151791877595, -4532.723515247859, -1.344596967101097e-7, 1], 1, 2, 4, [-272.5963980009974, 125.26453527188733], -0.6297899607010771, [268.45496627781176, 133.9101604837315], 0, [286.92760827694747, 96.87732841911384], 0, [648.509529180903, 718.346254972786], 0, false];
});
function excepeRes(fres: FilletRes)
@ -24,7 +24,7 @@ function excepeRes(fres: FilletRes)
test('首尾缺口倒角', () =>
{
let f = [1, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [547.6394707904332, 156.420708807656], 0, [1451.8754993607672, 156.420708807656], 0, [1451.8754993607672, 1354.8058069129183], 0, [563.9810857645957, 249.02319366124436], 0, false]
let f = [1, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [547.6394707904332, 156.420708807656], 0, [1451.8754993607672, 156.420708807656], 0, [1451.8754993607672, 1354.8058069129183], 0, [563.9810857645957, 249.02319366124436], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -51,7 +51,7 @@ test('首尾缺口倒角', () =>
test('首尾开口and跨越直线1', () =>
{
let f = [1, "Polyline", 5, 2, 109, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [1912.1643211330174, 150.15642306756], 0, [3347.5028363636384, 555.9731949259332], 0, [3347.5028363636384, 584.026300631579], 0, [1923.0587311157924, 1605.3772365167458], 0, false]
let f = [1, "Polyline", 5, 2, 109, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [1912.1643211330174, 150.15642306756], 0, [3347.5028363636384, 555.9731949259332], 0, [3347.5028363636384, 584.026300631579], 0, [1923.0587311157924, 1605.3772365167458], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -79,7 +79,7 @@ test('首尾开口and跨越直线1', () =>
test('首尾开口and跨越直线2', () =>
{
let f = [1, "Polyline", 5, 2, 145, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 7, [1765.3076108911919, 1872.4190121644488], 0, [3504.2406116319507, 2310.4177043718623], 0, [3458.7468373285233, 2322.549377519443], 0, [3495.1418567712653, 2377.141906683556], 0, [3431.0761383900667, 2352.76623008148], 0, [3520.0042980366775, 2441.6943897280908], 0, [1849.090982571283, 3377.7802807451185], 0, false]
let f = [1, "Polyline", 5, 2, 145, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 7, [1765.3076108911919, 1872.4190121644488], 0, [3504.2406116319507, 2310.4177043718623], 0, [3458.7468373285233, 2322.549377519443], 0, [3495.1418567712653, 2377.141906683556], 0, [3431.0761383900667, 2352.76623008148], 0, [3520.0042980366775, 2441.6943897280908], 0, [1849.090982571283, 3377.7802807451185], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -109,7 +109,7 @@ test('首尾开口and跨越直线2', () =>
test('首尾且点重叠', () =>
{
let f = [1, "Polyline", 5, 2, 110, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 5, [4475.389771693963, 292.48317396453035], 0, [5793.726681473572, 292.48317396453035], 0, [5793.726681473572, 1165.0966523424624], 0, [4475.389771693963, 1165.0966523424624], 0, [4475.389771693963, 292.48317396453035], 0, false]
let f = [1, "Polyline", 5, 2, 110, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 5, [4475.389771693963, 292.48317396453035], 0, [5793.726681473572, 292.48317396453035], 0, [5793.726681473572, 1165.0966523424624], 0, [4475.389771693963, 1165.0966523424624], 0, [4475.389771693963, 292.48317396453035], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -137,7 +137,7 @@ test('首尾且点重叠', () =>
test('首尾重复并且closemark', () =>
{
let f = [1, "Polyline", 5, 2, 111, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1914.7274165846702, 12.555589616967154, 0, 1], 0, 0, 2, 5, [4475.389771693963, 292.48317396453035], 0, [5793.726681473572, 292.48317396453035], 0, [5793.726681473572, 1165.0966523424624], 0, [4475.389771693963, 1165.0966523424624], 0, [4475.389771693963, 292.48317396453035], 0, true]
let f = [1, "Polyline", 5, 2, 111, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1914.7274165846702, 12.555589616967154, 0, 1], 0, 0, 2, 5, [4475.389771693963, 292.48317396453035], 0, [5793.726681473572, 292.48317396453035], 0, [5793.726681473572, 1165.0966523424624], 0, [4475.389771693963, 1165.0966523424624], 0, [4475.389771693963, 292.48317396453035], 0, true];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -165,7 +165,7 @@ test('首尾重复并且closemark', () =>
test('只有closemark', () =>
{
let f = [1, "Polyline", 5, 2, 112, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [8430.400501032793, 279.92758434758196], 0, [9723.626231578504, 279.92758434758196], 0, [9723.626231578504, 1309.485932937372], 0, [8430.400501032793, 1309.485932937372], 0, true]
let f = [1, "Polyline", 5, 2, 112, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [8430.400501032793, 279.92758434758196], 0, [9723.626231578504, 279.92758434758196], 0, [9723.626231578504, 1309.485932937372], 0, [8430.400501032793, 1309.485932937372], 0, true];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -194,7 +194,7 @@ test('只有closemark', () =>
test('跨越首尾且首尾重叠', () =>
{
let f = [1, "Polyline", 5, 2, 121, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 6, [12032.496266837241, 1167.7503167910863], 0, [10719.863427339778, 1167.7503167910863], 0, [10719.863427339778, 374.5161686031184], 0, [12222.34222567228, 374.5161686031184], 0, [12222.34222567228, 990.022185115731], 0, [12032.496266837241, 1167.7503167910868], 0, false]
let f = [1, "Polyline", 5, 2, 121, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 6, [12032.496266837241, 1167.7503167910863], 0, [10719.863427339778, 1167.7503167910863], 0, [10719.863427339778, 374.5161686031184], 0, [12222.34222567228, 374.5161686031184], 0, [12222.34222567228, 990.022185115731], 0, [12032.496266837241, 1167.7503167910868], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -237,7 +237,7 @@ test('跨越首尾且首尾重叠', () =>
test('圆弧跨越分割线', () =>
{
let f = [1, "Polyline", 5, 2, 150, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 17932.217574766102, 923.3102914449528, -1.344596967101097e-7, 1], 0, 0, 2, 4, [-272.5963980009974, 125.26453527188733], -0.6297899607010771, [268.45496627781176, 133.9101604837315], 0, [286.92760827694747, 96.87732841911384], 0, [648.509529180903, 718.346254972786], 0, false]
let f = [1, "Polyline", 5, 2, 150, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 17932.217574766102, 923.3102914449528, -1.344596967101097e-7, 1], 0, 0, 2, 4, [-272.5963980009974, 125.26453527188733], -0.6297899607010771, [268.45496627781176, 133.9101604837315], 0, [286.92760827694747, 96.87732841911384], 0, [648.509529180903, 718.346254972786], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -266,7 +266,7 @@ test('圆弧跨越分割线', () =>
test('自交多段线', () =>
{
let f = [1, "Polyline", 5, 2, 147, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 5, [7963.40305968292, 5219.86997448622], 0, [8839.024211760872, 2266.977365882911], 0, [12322.878582794428, 3217.119467073881], 0, [5243.388417057789, 4055.4801445953253], 0, [6538.189907896463, 6756.864549942202], 0, false]
let f = [1, "Polyline", 5, 2, 147, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 5, [7963.40305968292, 5219.86997448622], 0, [8839.024211760872, 2266.977365882911], 0, [12322.878582794428, 3217.119467073881], 0, [5243.388417057789, 4055.4801445953253], 0, [6538.189907896463, 6756.864549942202], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -297,7 +297,7 @@ test('自交多段线', () =>
test('多段线双圆R0', () =>
{
let f = [1, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1571.0622009569374, 642.1282296650719, 0, 1], 0, 0, 2, 3, [-454.206027432087, 320.6147368421051], -2.9766539744084812, [-431.6922770664303, -350.340837980916], -2.8993396583254722, [-518.3394309084008, 201.0501410134426], 0, false]
let f = [1, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1571.0622009569374, 642.1282296650719, 0, 1], 0, 0, 2, 3, [-454.206027432087, 320.6147368421051], -2.9766539744084812, [-431.6922770664303, -350.340837980916], -2.8993396583254722, [-518.3394309084008, 201.0501410134426], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -324,7 +324,7 @@ test('多段线双圆R0', () =>
test('自交多段线R0', () =>
{
let f = [1, "Polyline", 5, 2, 106, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 7, [4276.596835215311, 1149.2698457416268], 0, [4814.832566507177, -666.4651513875599], 0, [6251.870712226028, 1084.2122721667558], -0.5612019988173412, [6572.455012671152, 1039.2528815304759], 0, [7078.0165450717695, -128.2294200956936], 0, [9088.294577607654, 1700.475112727273], 0, [5906.768985493756, 210.08998230825014], 0, false]
let f = [1, "Polyline", 5, 2, 106, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 7, [4276.596835215311, 1149.2698457416268], 0, [4814.832566507177, -666.4651513875599], 0, [6251.870712226028, 1084.2122721667558], -0.5612019988173412, [6572.455012671152, 1039.2528815304759], 0, [7078.0165450717695, -128.2294200956936], 0, [9088.294577607654, 1700.475112727273], 0, [5906.768985493756, 210.08998230825014], 0, false];
let pl = LoadEntityFromFileData(f)[0] as Polyline;
@ -350,7 +350,7 @@ test('自交多段线R0', () =>
test('多段线平行倒圆弧', () =>
{
let f = [1, "Polyline", 5, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [697.5655502392347, 300.3177033492824], 0, [1666.4995215311, 300.3177033492824], 0, [1666.4995215311, 1182.5990430622012], 0, [697.5655502392347, 1182.5990430622012], 0, true]
let f = [1, "Polyline", 5, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [697.5655502392347, 300.3177033492824], 0, [1666.4995215311, 300.3177033492824], 0, [1666.4995215311, 1182.5990430622012], 0, [697.5655502392347, 1182.5990430622012], 0, true];
let pl = LoadEntityFromFileData(f)[0] as Polyline;

@ -14,7 +14,7 @@ describe("相交", () =>
pt: new Vector2(26.7, -4),
bul: 0.32
},
])
]);
let p2 = new Polyline([
{
pt: new Vector2(26, -3),
@ -24,7 +24,7 @@ describe("相交", () =>
pt: new Vector2(9.5, -8.2),
bul: 2.01
},
])
]);
let pts = pl.IntersectWith(p2, IntersectOption.OnBothOperands);
expect(pts.length).toBe(0);
let pts1 = pl.IntersectWith(p2, IntersectOption.ExtendBoth);
@ -33,7 +33,7 @@ describe("相交", () =>
expect(pts2.length).toBe(0);
let pts3 = pl.IntersectWith(p2, IntersectOption.ExtendArg);
expect(pts3.length).toBe(1);
})
});
test("相交曲线", () =>
{
let pl = new Polyline([
@ -45,7 +45,7 @@ describe("相交", () =>
pt: new Vector2(0, 5),
bul: 0.32
},
])
]);
let p2 = new Polyline([
{
pt: new Vector2(-1, 0),
@ -55,7 +55,7 @@ describe("相交", () =>
pt: new Vector2(4, 0),
bul: 0
},
])
]);
let p3 = new Polyline([
{
pt: new Vector2(0, 0),
@ -65,7 +65,7 @@ describe("相交", () =>
pt: new Vector2(3, 3),
bul: 0
},
])
]);
let p4 = new Polyline([
{
pt: new Vector2(0, 0),
@ -75,7 +75,7 @@ describe("相交", () =>
pt: new Vector2(1, 1),
bul: 0
},
])
]);
let p5 = new Polyline([
{
pt: new Vector2(1, 0),
@ -85,7 +85,7 @@ describe("相交", () =>
pt: new Vector2(1, 0.5),
bul: 0
},
])
]);
let p6 = new Polyline([
{
pt: new Vector2(0, 0),
@ -95,7 +95,7 @@ describe("相交", () =>
pt: new Vector2(3, 3),
bul: 0
},
])
]);
let pts = pl.IntersectWith(p2, IntersectOption.OnBothOperands);
expect(pts.length).toBe(1);
let pts1 = pl.IntersectWith(p2, IntersectOption.ExtendBoth);
@ -113,6 +113,6 @@ describe("相交", () =>
expect(pts6.length).toBe(2);
let pts7 = p5.IntersectWith(p6, IntersectOption.ExtendThis);
expect(pts7.length).toBe(1);
})
})
});
});

@ -69,7 +69,7 @@ describe("", () =>
pt: new Vector2(5, 5),
bul: 0
},
])
]);
pl.CloseMark = true;
@ -101,7 +101,7 @@ describe("", () =>
pt: new Vector2(0, 10),
bul: 0
},
])
]);
pl.CloseMark = true;
@ -138,7 +138,7 @@ describe("", () =>
pt: new Vector2(5, 5),
bul: 0
}]
)
);
pl.CloseMark = true;
expect(IsPointInPolyLine(pl, new Vector3(5, 2))).toBeTruthy();
@ -148,7 +148,7 @@ describe("", () =>
test('点在曲线外精度问题', () =>
{
let plData =
[1, "Polyline", 1, 1, 0, false, 3, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-3, 3.6739403974420594e-16], 0.9999999999999999, [3, 3.6739403974420594e-16], 0, [3, 10], 0.9999999999999999, [-3, 10], 0, [-3, -3.6739403974420594e-16], 0, false]
[1, "Polyline", 1, 1, 0, false, 3, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-3, 3.6739403974420594e-16], 0.9999999999999999, [3, 3.6739403974420594e-16], 0, [3, 10], 0.9999999999999999, [-3, 10], 0, [-3, -3.6739403974420594e-16], 0, false];
let pl = LoadCurvesFromFileData(plData)[0] as Polyline;
let p = new Vector3(-3, -0.16000000000000014, 0);
expect(pl.PtInCurve(p)).toBeFalsy();
@ -158,7 +158,7 @@ describe("", () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.7938671363300003, 0.39666461398798525, 0, 1], 2, 5, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.23362472371057, 8.552710046188702], 0, [12.233990240675425, 8.552758322014249], 0, [12.414545456418505, 8.796498405316765], 0, false]
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.7938671363300003, 0.39666461398798525, 0, 1], 2, 5, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.23362472371057, 8.552710046188702], 0, [12.233990240675425, 8.552758322014249], 0, [12.414545456418505, 8.796498405316765], 0, false];
let p = new Vector3().fromArray([13.027857377005425, 8.947146562082409, 0]);
@ -172,7 +172,7 @@ describe("", () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.1413261486708848, -0.2136470533821324, 0, 1], 2, 5, [376.7856405585377, -104.2720901386406], -0.9999999999999999, [378.6693614887703, -104.2720901386406], 0, [378.4693614887703, -104.2720901386406], 0.9999999999999999, [376.9856405585377, -104.2720901386406], 0, [376.7856405585377, -104.2720901386406], 0, false]
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2.1413261486708848, -0.2136470533821324, 0, 1], 2, 5, [376.7856405585377, -104.2720901386406], -0.9999999999999999, [378.6693614887703, -104.2720901386406], 0, [378.4693614887703, -104.2720901386406], 0.9999999999999999, [376.9856405585377, -104.2720901386406], 0, [376.7856405585377, -104.2720901386406], 0, false];
let p = new Vector3().fromArray([380.6106876374412, -106.61364416876692, 0]);
@ -185,7 +185,7 @@ describe("", () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 6, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [5135.438782795266, 1651.835443234731], -0.9999915853997117, [5470.58864251807, 1651.8382633987026], 0, [5370.588642280742, 1651.8413831024218], 0.9999560507337252, [5235.438782795266, 1651.835443234731], 0, [5135.438782795266, 1651.835443234731], 0, false]
[1, "Polyline", 1, 1, 0, false, 6, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [5135.438782795266, 1651.835443234731], -0.9999915853997117, [5470.58864251807, 1651.8382633987026], 0, [5370.588642280742, 1651.8413831024218], 0.9999560507337252, [5235.438782795266, 1651.835443234731], 0, [5135.438782795266, 1651.835443234731], 0, false];
f.Read();
@ -202,7 +202,7 @@ describe("", () =>
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [5.113122171945702, 3.235294117647059], 2.037852023242286, [6.69683257918552, 0.7918552036199095], 0, [5.113122171945702, 3.235294117647059], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [5.113122171945702, 3.235294117647059], 2.037852023242286, [6.69683257918552, 0.7918552036199095], 0, [5.113122171945702, 3.235294117647059], 0, false];
let p = new Vector3().fromArray([5.113122171945701, 0.7239819004524888, 0]);
f.Read();
@ -210,4 +210,4 @@ describe("", () =>
expect(pl.PtInCurve(p)).toBeTruthy();
});
})
});

@ -9,7 +9,7 @@ test('2个大圆中间', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [108.37693694676932, 28.257776463252547], 0.4472440944881872, [108.37693694676932, 17.68555707305448], 3.5940684866260213, [111.70676982557188, 14.089337563947739], 0.5086040192926764, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [108.37693694676932, 28.257776463252547], 0.4472440944881872, [108.37693694676932, 17.68555707305448], 3.5940684866260213, [111.70676982557188, 14.089337563947739], 0.5086040192926764, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -28,7 +28,7 @@ test('点在端点且端点平行', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 43.1743189069092, -3.552713678800501e-15, 0, 1], 2, 3, [35.26780526232293, 5.878508963172803], -0.8898689681740283, [35.26780526232293, 13.326990467988661], 0, [35.26780526232293, 23.770222268555234], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 43.1743189069092, -3.552713678800501e-15, 0, 1], 2, 3, [35.26780526232293, 5.878508963172803], -0.8898689681740283, [35.26780526232293, 13.326990467988661], 0, [35.26780526232293, 23.770222268555234], 0, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -57,7 +57,7 @@ test('点在端点上且点在圆心上', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [17.513342658829444, 9.06588623278316], 0, [19.513342658829444, 9.06588623278316], 0.9999999999999999, [19.513342658829444, 7.06588623278316], -0.9999999999999999, [19.513342658829444, 5.06588623278316], 0, [17.513342658829444, 5.06588623278316], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [17.513342658829444, 9.06588623278316], 0, [19.513342658829444, 9.06588623278316], 0.9999999999999999, [19.513342658829444, 7.06588623278316], -0.9999999999999999, [19.513342658829444, 5.06588623278316], 0, [17.513342658829444, 5.06588623278316], 0, true];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -72,7 +72,7 @@ test('存在精度误差,并且点在圆内', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [2, 0], 1, [2, 2], -1, [2, 4], 0, [0, 4], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [2, 0], 1, [2, 2], -1, [2, 4], 0, [0, 4], 0, true];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -104,7 +104,7 @@ test('大于1凸度的圆', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1, 0], 3.7050811739160006, [1, 1.7149500468022372], 0, [0, 1.7149500468022374], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1, 0], 3.7050811739160006, [1, 1.7149500468022372], 0, [0, 1.7149500468022374], 0, true];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -119,7 +119,7 @@ test('盲区计算', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [0, 0], 0, [1, 0], 0.6998085535161632, [1, -1], -1.9959956751332304, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [0, 0], 0, [1, 0], 0.6998085535161632, [1, -1], -1.9959956751332304, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -141,7 +141,7 @@ test('参数点在终点上', () =>
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [26.388805509867886, 5.284389892538414], 0, [28.388805509867886, 5.284389892538414], 0.9999999999999999, [28.388805509867886, 7.284389892538414], -0.9999999999999999, [28.388805509867886, 9.284389892538414], 0, [24.129449189553043, 9.284389892538414], 0, [24.129449189553043, 13.772242014802323], 0, [33.10581078647962, 13.772242014802321], 0, [33.10581078647962, 0.368763303745288], 0, [27.762738407356657, 0.36876330374528865], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [26.388805509867886, 5.284389892538414], 0, [28.388805509867886, 5.284389892538414], 0.9999999999999999, [28.388805509867886, 7.284389892538414], -0.9999999999999999, [28.388805509867886, 9.284389892538414], 0, [24.129449189553043, 9.284389892538414], 0, [24.129449189553043, 13.772242014802323], 0, [33.10581078647962, 13.772242014802321], 0, [33.10581078647962, 0.368763303745288], 0, [27.762738407356657, 0.36876330374528865], 0, true];
f.Read();
let pl = f.ReadObject() as Polyline;
let pt = new Vector3().fromArray([24.40481807693597, 4.679455426066854, 0]);
@ -166,7 +166,7 @@ test('点在小角内', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -47.5997122622927, 10.897558314909338, 0, 1], 2, 4, [-0.906131771640112, 6.969061295372345], 3.7897716494829594, [4.660056657223795, 6.487252124645892], 0, [20.106696883852685, 18.393201133144473], 0, [9.169563739376775, 22.583048158640217], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -47.5997122622927, 10.897558314909338, 0, 1], 2, 4, [-0.906131771640112, 6.969061295372345], 3.7897716494829594, [4.660056657223795, 6.487252124645892], 0, [20.106696883852685, 18.393201133144473], 0, [9.169563739376775, 22.583048158640217], 0, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -185,7 +185,7 @@ test('首尾点相等', () =>
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -203,7 +203,7 @@ test('点在圆弧的弦中心上', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -227,7 +227,7 @@ test('圆弧过大导致直线小角错误', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -0.028011204481791063, 0.028011204481792618, 0, 1], 2, 4, [-2241.358078364921, -214.80916327845875], -1.1401903887488165, [-2190.503423306555, -220.10318099746846], -1.1044015866963386, [-2231.667025600985, -212.01859443849355], 0, [-2241.358078364921, -214.80916327845875], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -0.028011204481791063, 0.028011204481792618, 0, 1], 2, 4, [-2241.358078364921, -214.80916327845875], -1.1401903887488165, [-2190.503423306555, -220.10318099746846], -1.1044015866963386, [-2231.667025600985, -212.01859443849355], 0, [-2241.358078364921, -214.80916327845875], 0, false];
f.Read();
let pl = f.ReadObject() as Polyline;

@ -6,7 +6,7 @@ import { Line } from "../../src/DatabaseServices/Entity/Line";
test('多段线与多段线Join', () =>
{
let data =
[2, "Polyline", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [-60.26785714285711, 58.03571428571427], 0.4847381535042383, [-241.07142857142856, 58.03571428571427], -1.124793513518748, [-340.9598214285714, 157.9241071428571], 0, false, "Polyline", 2, 1, 103, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [181.36160714285717, 6.138392857142875], -0.7890083669838478, [389.50892857142867, -121.65178571428574], 1.286428411698261, [556.9196428571429, -132.81250000000003], 0, false]
[2, "Polyline", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [-60.26785714285711, 58.03571428571427], 0.4847381535042383, [-241.07142857142856, 58.03571428571427], -1.124793513518748, [-340.9598214285714, 157.9241071428571], 0, false, "Polyline", 2, 1, 103, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [181.36160714285717, 6.138392857142875], -0.7890083669838478, [389.50892857142867, -121.65178571428574], 1.286428411698261, [556.9196428571429, -132.81250000000003], 0, false];
let pls = LoadEntityFromFileData(data) as Polyline[];
@ -45,7 +45,7 @@ test('多段线与多段线Join', () =>
test('一定精度容差内的直线Join', () =>
{
let data =
[2, "Line", 2, 1, 168, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -97.39422719143477, 40.30682517259278, 0, 1], 1, 1, [140.3943227792479, -100, 0], [314.3387826639938, -99.99999883531063, 0], "Line", 2, 1, 169, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -97.39422719143477, 40.30682517259278, 0, 1], 1, 1, [314.3387826639938, -99.99999883531063, 0], [318, -100, 0]]
[2, "Line", 2, 1, 168, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -97.39422719143477, 40.30682517259278, 0, 1], 1, 1, [140.3943227792479, -100, 0], [314.3387826639938, -99.99999883531063, 0], "Line", 2, 1, 169, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -97.39422719143477, 40.30682517259278, 0, 1], 1, 1, [314.3387826639938, -99.99999883531063, 0], [318, -100, 0]];
let lines = LoadEntityFromFileData(data) as Line[];
expect(lines[0].Join(lines[1])).toBe(1);
});

@ -57,7 +57,7 @@ describe("闭合多段线", () =>
test('闭合多段线偏移测试1', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.059716713881022, 3.983456090651555], 1.1217395195062214, [6.383002832861191, 4.064022662889515], 0, [4.929178470254959, 8.399433427762037], 1.2642365052895204, [5.750708215297452, 4.050991501416427], 0.7171789779484218, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.059716713881022, 3.983456090651555], 1.1217395195062214, [6.383002832861191, 4.064022662889515], 0, [4.929178470254959, 8.399433427762037], 1.2642365052895204, [5.750708215297452, 4.050991501416427], 0.7171789779484218, true];
let cus = loadFile(data);
for (let i = 1; i < 10; i += 1)
{
@ -71,11 +71,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试2', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [8.176442643449754, 4.003694129881114], 0.6482011490054378, [8.554554536583165, 4.090460859042256], 0, [7.7292787370841225, 8.733182129315965], 0, [7.8227800907745895, 4.037582052934876], 1.223388515290821, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [8.176442643449754, 4.003694129881114], 0.6482011490054378, [8.554554536583165, 4.090460859042256], 0, [7.7292787370841225, 8.733182129315965], 0, [7.8227800907745895, 4.037582052934876], 1.223388515290821, true];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(-0.1799).length).toBe(2);
@ -96,11 +96,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试3', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [12.52535684411379, 4.512623511896158], 0.39558516940595195, [13.121416971132648, 4.487590129452889], 0, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.015990240675425, 4.4951100391838885], 0.8508932598252141, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [12.52535684411379, 4.512623511896158], 0.39558516940595195, [13.121416971132648, 4.487590129452889], 0, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.015990240675425, 4.4951100391838885], 0.8508932598252141, true];
let cus = loadFile(data);
for (let i = 0.5; i < 10; i += 1)
@ -115,11 +115,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试4', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [17.138593827490823, 4.9429359111242475], 0.6262511063576436, [18.12066066115083, 4.8347623552068075], 0, [18.12066066115083, 10.450468898178228], 0, [16.250318720818097, 10.450468898178228], 0, [16.250318720818097, 4.952028938447833], 0.8739221457690426, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [17.138593827490823, 4.9429359111242475], 0.6262511063576436, [18.12066066115083, 4.8347623552068075], 0, [18.12066066115083, 10.450468898178228], 0, [16.250318720818097, 10.450468898178228], 0, [16.250318720818097, 4.952028938447833], 0.8739221457690426, true];
let cus = loadFile(data);
for (let i = 1; i < 10; i += 2)
{
@ -135,7 +135,7 @@ describe("闭合多段线", () =>
}
//变换曲线顺序
data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [22.178278439318607, -1.9155229050126357], 0, [22.83746943877066, -1.800164480108526], 0, [23.79329638797614, -6.11786552651948], -0.871731137783436, [23.348342463346004, -6.282663276382493], -0.7430788314178012, [22.903388538715866, -6.267501883395095], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [22.178278439318607, -1.9155229050126357], 0, [22.83746943877066, -1.800164480108526], 0, [23.79329638797614, -6.11786552651948], -0.871731137783436, [23.348342463346004, -6.282663276382493], -0.7430788314178012, [22.903388538715866, -6.267501883395095], 0, true];
cus = loadFile(data);
for (let i = 0.01; i <= 0.33; i += 0.08)
{
@ -145,11 +145,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试5', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [0, 0], 0, [5, 0], 0.9999999999999999, [5, 5], -0.9999999999999999, [5, 10], 0, [0, 10], 0, [0, 0], 0, false];
let cus = loadFile(data);
for (let i = 0.5; i < 10; i += 1.5)
{
@ -187,11 +187,11 @@ describe("闭合多段线", () =>
let len = cus[0].GetOffsetCurves(i).length;
expect(len).toBe(0);
}
})
});
test('闭合多段线偏移测试6', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2.007355593658339, -15.226898894860806, 0, 1], 2, 6, [0.06393073988345588, -13.474722415885717], 0, [0.06393073988345643, -4.4950563800695225], 0, [6.069811270331949, -4.495056380069524], -0.9999999999999999, [6.0698112703319484, -9.101508437403805], 0.8261854469247998, [6.069811270331948, -13.53303193559881], 0, [0.06393073988345588, -13.474722415885717], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2.007355593658339, -15.226898894860806, 0, 1], 2, 6, [0.06393073988345588, -13.474722415885717], 0, [0.06393073988345643, -4.4950563800695225], 0, [6.069811270331949, -4.495056380069524], -0.9999999999999999, [6.0698112703319484, -9.101508437403805], 0.8261854469247998, [6.069811270331948, -13.53303193559881], 0, [0.06393073988345588, -13.474722415885717], 0, false];
let cus = loadFile(data);
for (let i = 0.5; i < 10; i += 1)//i+=0.5
{
@ -206,11 +206,11 @@ describe("闭合多段线", () =>
let len = cus[0].GetOffsetCurves(i).length;
expect(len).toBe(0);
}
})
});
test('闭合多段线偏移测试7', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [7.068575921553821, 19.385189367549113], 0, [17.866251977281493, 27.179961431447197], -0.7242773730087224, [27.449988121418478, 20.215779833374317], -0.5496546648274403, [21.06083069199382, 18.554598901723907], 0.7351204491094537, [17.802360402987244, 16.70174324719076], -1.609719383557213, [7.068575921553821, 19.385189367549113], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [7.068575921553821, 19.385189367549113], 0, [17.866251977281493, 27.179961431447197], -0.7242773730087224, [27.449988121418478, 20.215779833374317], -0.5496546648274403, [21.06083069199382, 18.554598901723907], 0.7351204491094537, [17.802360402987244, 16.70174324719076], -1.609719383557213, [7.068575921553821, 19.385189367549113], 0, true];
let cus = loadFile(data);
//外偏移
for (let i = 0.5; i < 5.5; i += 1)
@ -232,11 +232,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试8', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [-35.77751476623335, 275.4953263952156], 0, [220.87993293360785, 358.6317790975911], 0, [317.8724610863793, 154.43698298649332], 0, [128.26300755464567, 91.72000989522755], 0, [202.6482547094027, 193.81740795077644], 0, [96.90452100901277, 149.33211308371583], 0, [167.64343251892882, 238.30270281783706], 0, [-5.9221441755043855, 147.87357882577945], 0, [115.1361992332179, 265.2855865896607], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [-35.77751476623335, 275.4953263952156], 0, [220.87993293360785, 358.6317790975911], 0, [317.8724610863793, 154.43698298649332], 0, [128.26300755464567, 91.72000989522755], 0, [202.6482547094027, 193.81740795077644], 0, [96.90452100901277, 149.33211308371583], 0, [167.64343251892882, 238.30270281783706], 0, [-5.9221441755043855, 147.87357882577945], 0, [115.1361992332179, 265.2855865896607], 0, true];
let cus = loadFile(data);
//外偏移 -
for (let i = 20; i < 200; i += 100)
@ -260,11 +260,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试9', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2494.1602062139054, -154.37421492307953, 0, 1], 2, 4, [-835.9056689963722, -81.71614968554674], -1.404257507243489, [-2.5205246091134654, -224.3682931983378], -0.7704346688180675, [-677.9527382520764, -55.635630094036955], 0, [-835.9056689963722, -81.71614968554674], 0, false]
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2494.1602062139054, -154.37421492307953, 0, 1], 2, 4, [-835.9056689963722, -81.71614968554674], -1.404257507243489, [-2.5205246091134654, -224.3682931983378], -0.7704346688180675, [-677.9527382520764, -55.635630094036955], 0, [-835.9056689963722, -81.71614968554674], 0, false];
let cus = loadFile(data);
//外偏移 -
//内偏移+
@ -285,11 +285,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试10', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -38.7066882611841, -36.73336766355714, 0, 1], 2, 10, [57.916496677407835, -1.0361149153581897], 0, [57.916496677407835, 9.149866136686853], 0, [63.00948720343037, 6.40233177396418], 0, [67.96845166297861, 11.696361399698116], 0, [67.96845166297861, 5.866227508067071], 0, [76.41209385085804, 8.144670638129776], -0.6438035714487224, [82.13500688930966, 1.215523001409662], -0.16133386709235895, [73.7315725213725, -7.388950466238915], -0.24328993833238707, [62.473382937533245, -7.388950466238914], 0.16864648307761998, [53.5472469103464, -6.102300228085856], -1.9523252757782097, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -38.7066882611841, -36.73336766355714, 0, 1], 2, 10, [57.916496677407835, -1.0361149153581897], 0, [57.916496677407835, 9.149866136686853], 0, [63.00948720343037, 6.40233177396418], 0, [67.96845166297861, 11.696361399698116], 0, [67.96845166297861, 5.866227508067071], 0, [76.41209385085804, 8.144670638129776], -0.6438035714487224, [82.13500688930966, 1.215523001409662], -0.16133386709235895, [73.7315725213725, -7.388950466238915], -0.24328993833238707, [62.473382937533245, -7.388950466238914], 0.16864648307761998, [53.5472469103464, -6.102300228085856], -1.9523252757782097, true];
let cus = loadFile(data);
//外偏移 -
for (let i = 5; i < 20; i += 5)
@ -311,11 +311,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试11', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [8.533519553072624, 3.044692737430166], 0, [8.198324022346368, 5.782122905027932], 0, [9.483240223463685, 4.594972067039105], 0, [10.293296089385473, 4.958100558659217], 0, [11.298882681564244, 3.50558659217877], 0, [11.648044692737429, 3.1424581005586587], 0, [9.525139664804467, 2.3324022346368705], 0, [9.748603351955305, 3.589385474860334], 0, [8.519553072625698, 1.3268156424580995], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 9, [8.533519553072624, 3.044692737430166], 0, [8.198324022346368, 5.782122905027932], 0, [9.483240223463685, 4.594972067039105], 0, [10.293296089385473, 4.958100558659217], 0, [11.298882681564244, 3.50558659217877], 0, [11.648044692737429, 3.1424581005586587], 0, [9.525139664804467, 2.3324022346368705], 0, [9.748603351955305, 3.589385474860334], 0, [8.519553072625698, 1.3268156424580995], 0, true];
let cus = loadFile(data);
//外偏移 -
for (let i = 0.1; i <= 0.3; i += 0.1)
@ -335,11 +335,11 @@ describe("闭合多段线", () =>
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试12', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 12, [13.549363225511495, 3.33570646745377], 0, [14.34284463241268, 4.996139781895137], 0, [14.523074259257426, 3.9557232996550056], 0, [15.838887129162556, 4.9814356943054605], 0, [15.943612070431213, 3.9627476292376005], 0, [17.33950450111622, 4.461280640196535], 0, [18.123624596131165, 2.7156799524846913], 0, [17.99903152781382, 1.6177035379380693], 0, [16.03466125512531, 2.900960499995888], 0, [15.014220997727234, 1.7794865537465168], 0, [14.332835411729478, 2.6268506799232134], 0, [13.549363225511495, 3.33570646745377], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 12, [13.549363225511495, 3.33570646745377], 0, [14.34284463241268, 4.996139781895137], 0, [14.523074259257426, 3.9557232996550056], 0, [15.838887129162556, 4.9814356943054605], 0, [15.943612070431213, 3.9627476292376005], 0, [17.33950450111622, 4.461280640196535], 0, [18.123624596131165, 2.7156799524846913], 0, [17.99903152781382, 1.6177035379380693], 0, [16.03466125512531, 2.900960499995888], 0, [15.014220997727234, 1.7794865537465168], 0, [14.332835411729478, 2.6268506799232134], 0, [13.549363225511495, 3.33570646745377], 0, false];
let cus = loadFile(data);
//外偏移 -
for (let i = 0.5; i <= 2; i += 0.5)
@ -363,11 +363,11 @@ describe("闭合多段线", () =>
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试13', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.053732578466253, -1.845982384833612, 0, 1], 2, 12, [10.73237450059647, 5.925995426719515], 0, [14.934000173256667, 9.279899014962986], 0, [15.443475259425389, 6.338838290261696], 0, [16.902963217271246, 7.476549375511614], 0, [17.07910144494388, 5.7632047972414195], 0, [18.04054823840169, 6.106578652047782], 0, [19.469515702452366, 2.925424892792106], 0, [19.064111106000592, -0.6472031134391991], 0, [17.253277279358528, 2.956832838161076], 0, [14.95258895308757, 3.1324290048358128], 0, [13.37431523183268, 1.7225442000746034], 0, [10.73237450059647, 5.925995426719515], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 13.053732578466253, -1.845982384833612, 0, 1], 2, 12, [10.73237450059647, 5.925995426719515], 0, [14.934000173256667, 9.279899014962986], 0, [15.443475259425389, 6.338838290261696], 0, [16.902963217271246, 7.476549375511614], 0, [17.07910144494388, 5.7632047972414195], 0, [18.04054823840169, 6.106578652047782], 0, [19.469515702452366, 2.925424892792106], 0, [19.064111106000592, -0.6472031134391991], 0, [17.253277279358528, 2.956832838161076], 0, [14.95258895308757, 3.1324290048358128], 0, [13.37431523183268, 1.7225442000746034], 0, [10.73237450059647, 5.925995426719515], 0, false];
let cus = loadFile(data);
//外偏移 -
for (let i = 0.5; i <= 2; i += 0.5)
@ -377,11 +377,11 @@ describe("闭合多段线", () =>
//内偏移+
expect(cus[0].GetOffsetCurves(1).length).toBe(1);
expect(cus[0].GetOffsetCurves(1.2).length).toBe(3);
})
});
test('闭合多段线偏移测试14', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 14, [340.820007357324, -3.870032999900914], 0, [431.6163856609081, 116.2815653567217], 0, [485.54806901416487, 54.84040710617603], 0, [533.3356365423672, 67.81131829240235], 0, [624.1320148459513, 40.504136847715344], 0, [656.9006325795757, 23.43714844478601], -0.783383849320176, [633.0068488154745, -74.86870475608706], 0.4462700081240285, [605.0169878346704, -106.27196341747704], -0.8416099256631104, [529.9222388617812, -128.11770857322662], 0, [510.1245323143834, -22.98506001118185], 0, [430.251026588674, -129.48306764546098], 0, [430.251026588674, -65.99387078656383], 0, [351.74287993519897, -145.86737651227318], 0, [303.2726328708796, -87.83961594231337], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 14, [340.820007357324, -3.870032999900914], 0, [431.6163856609081, 116.2815653567217], 0, [485.54806901416487, 54.84040710617603], 0, [533.3356365423672, 67.81131829240235], 0, [624.1320148459513, 40.504136847715344], 0, [656.9006325795757, 23.43714844478601], -0.783383849320176, [633.0068488154745, -74.86870475608706], 0.4462700081240285, [605.0169878346704, -106.27196341747704], -0.8416099256631104, [529.9222388617812, -128.11770857322662], 0, [510.1245323143834, -22.98506001118185], 0, [430.251026588674, -129.48306764546098], 0, [430.251026588674, -65.99387078656383], 0, [351.74287993519897, -145.86737651227318], 0, [303.2726328708796, -87.83961594231337], 0, true];
let cus = loadFile(data);
//外偏移 -
for (let i = 10; i <= 90; i += 10)
@ -403,11 +403,11 @@ describe("闭合多段线", () =>
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试15', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [-3.096429035694039, 1.977370035127478], 0, [2.646251476487261, 5.186031066288948], -0.5113280232193118, [8.158566581303122, 2.619102241359773], 0.23700604598013766, [11.103952861189804, -1.2148363240793185], -1.4842976346055852, [7.994019861756378, -4.028585228328609], 0.5402454464135219, [3.1398916351274853, -2.8932128634560885], -1.0879771453350477, [1.4615150957507161, -0.803469525212464], -0.082022192610066, [-3.096429035694039, 1.977370035127478], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [-3.096429035694039, 1.977370035127478], 0, [2.646251476487261, 5.186031066288948], -0.5113280232193118, [8.158566581303122, 2.619102241359773], 0.23700604598013766, [11.103952861189804, -1.2148363240793185], -1.4842976346055852, [7.994019861756378, -4.028585228328609], 0.5402454464135219, [3.1398916351274853, -2.8932128634560885], -1.0879771453350477, [1.4615150957507161, -0.803469525212464], -0.082022192610066, [-3.096429035694039, 1.977370035127478], 0, true];
let cus = loadFile(data);
//外偏移 -
for (let i = 0.5; i <= 5.5; i += 1)
@ -432,11 +432,11 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
test('闭合多段线偏移测试16', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-6.203966005665723, -0.056657223796033884], 0, [-1.8834846458923415, -0.923353563739375], -1.4125691360015384, [-1.9069913201133035, -1.5932937790368253], 0, [-6.189801699716714, -2.2096317280453257], -2.3881275241710798, [-6.203966005665723, -0.056657223796033884], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-6.203966005665723, -0.056657223796033884], 0, [-1.8834846458923415, -0.923353563739375], -1.4125691360015384, [-1.9069913201133035, -1.5932937790368253], 0, [-6.189801699716714, -2.2096317280453257], -2.3881275241710798, [-6.203966005665723, -0.056657223796033884], 0, true];
let cus = loadFile(data);
//外偏移 -
//内偏移+
@ -449,15 +449,15 @@ describe("闭合多段线", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(0);
}
})
});
})
});
describe("补圆弧测试", () =>
{
test("补圆弧测试1", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-99.60068327971061, 80.69599512140186], 0, [-48.362234971168355, 80.69599512140186], -0.9874208089640422, [-14.972250883848176, 88.46675505445091], -1.1745224194600496, [18.29631507951812, 78.51046889023182], 0, [89.44733571649859, 78.5104688902318], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-99.60068327971061, 80.69599512140186], 0, [-48.362234971168355, 80.69599512140186], -0.9874208089640422, [-14.972250883848176, 88.46675505445091], -1.1745224194600496, [18.29631507951812, 78.51046889023182], 0, [89.44733571649859, 78.5104688902318], 0, false];
let cus = loadFile(data);
// 向上-
// 向下+
@ -467,11 +467,11 @@ describe("补圆弧测试", () =>
if (i === 0) continue;
EntityToMatchSnapshot(cus[0].GetOffsetCurves(i));
}
})
});
test("补圆弧测试2", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-869.4193524531552, -50.92359793870933], 0, [-609.861025770732, -50.92359793870939], -0.8167984427288847, [-480.7149315189898, -23.068558002059024], -1.4042575072434897, [-317.9835774160859, -50.92359793870939], 0, [-92.77019349218811, -50.92359793870939], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-869.4193524531552, -50.92359793870933], 0, [-609.861025770732, -50.92359793870939], -0.8167984427288847, [-480.7149315189898, -23.068558002059024], -1.4042575072434897, [-317.9835774160859, -50.92359793870939], 0, [-92.77019349218811, -50.92359793870939], 0, false];
let cus = loadFile(data);
// 向上-
// 向下+
@ -481,11 +481,11 @@ describe("补圆弧测试", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
})
});
test("补圆弧测试3", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-894.3165541673695, -331.80629190023], 0, [-671.3300245231958, -331.80629190023], -1.0058680701224356, [-535.7124860261546, -329.1982623137485], 0, [-214.92484688892245, -329.1982623137485], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [-894.3165541673695, -331.80629190023], 0, [-671.3300245231958, -331.80629190023], -1.0058680701224356, [-535.7124860261546, -329.1982623137485], 0, [-214.92484688892245, -329.1982623137485], 0, false];
let cus = loadFile(data);
// 向上-
// 向下+
@ -494,11 +494,11 @@ describe("补圆弧测试", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
})
});
test("补圆弧测试4", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 23, [-25.572010711696727, -62.383195892823124], 0, [-10.312959798454724, -40.55427583637971], 0, [0.28360333574111785, -55.81332674962171], 0, [9.820510156517361, -48.18380129300071], 0, [18.721623189241864, -65.13830230771404], 0, [29.530117586121616, -60.47581452866788], 0, [39.06702440689787, -79.97349069558823], 0, [51.78290016793288, -70.64851513749588], -0.6227891115113805, [70.85671380948538, -80.60928448363998], 0.3759603135798005, [86.75155851077912, -99.68309812519247], -1.1383492019405204, [81.45327694368122, -117.6972554533254], 0.6271394112393051, [57.2931129977147, -138.2545879336653], -1.2933960333754264, [21.68866086681669, -138.2545879336653], -0.8106183277649434, [-17.73055399239181, -132.9563063665674], 0, [-43.37423677714574, -105.82910474302606], 0, [-51.003762233766736, -83.5763221612148], 0, [-48.67251834424364, -64.07864599429448], 0, [-62.65998168138215, -50.09118265715597], 0, [-86.39628310198083, -65.35023357039795], 0, [-86.39628310198083, -33.13668164244262], 0, [-73.68040734094582, -13.639005475522275], 0, [-43.16230551446182, -13.639005475522275], 0, [-33.62539869368556, -11.307761585999202], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 23, [-25.572010711696727, -62.383195892823124], 0, [-10.312959798454724, -40.55427583637971], 0, [0.28360333574111785, -55.81332674962171], 0, [9.820510156517361, -48.18380129300071], 0, [18.721623189241864, -65.13830230771404], 0, [29.530117586121616, -60.47581452866788], 0, [39.06702440689787, -79.97349069558823], 0, [51.78290016793288, -70.64851513749588], -0.6227891115113805, [70.85671380948538, -80.60928448363998], 0.3759603135798005, [86.75155851077912, -99.68309812519247], -1.1383492019405204, [81.45327694368122, -117.6972554533254], 0.6271394112393051, [57.2931129977147, -138.2545879336653], -1.2933960333754264, [21.68866086681669, -138.2545879336653], -0.8106183277649434, [-17.73055399239181, -132.9563063665674], 0, [-43.37423677714574, -105.82910474302606], 0, [-51.003762233766736, -83.5763221612148], 0, [-48.67251834424364, -64.07864599429448], 0, [-62.65998168138215, -50.09118265715597], 0, [-86.39628310198083, -65.35023357039795], 0, [-86.39628310198083, -33.13668164244262], 0, [-73.68040734094582, -13.639005475522275], 0, [-43.16230551446182, -13.639005475522275], 0, [-33.62539869368556, -11.307761585999202], 0, false];
let cus = loadFile(data);
// 向外-
// 向内+
@ -509,11 +509,11 @@ describe("补圆弧测试", () =>
}
//需要删除一个无效的线段 ref #IKO6L
expect(cus[0].GetOffsetCurves(27.3).length).toBe(1);
})
});
test("补圆弧测试5", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 10, [-5.637393767705383, -1.586402266288952], 0, [-0.84985835694051, 1.954674220963173], -0.5207626681247078, [1.728045325779038, 1.0906515580736542], -1.2136457904456304, [4.060938624362605, 1.3838754084985838], -1.0694858869096764, [6.891142200566573, -0.047681051558073895], -1.4716493502287318, [9.178341602266286, -2.976612659490083], -1.5003222663355726, [8.09233325325779, -7.040916632294616], -0.9628743606456998, [4.53257790368272, -7.478753541076488], -1.076087427994497, [2.3229461756373926, -7.478753541076488], 0, [-5.39660056657224, -7.478753541076487], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 10, [-5.637393767705383, -1.586402266288952], 0, [-0.84985835694051, 1.954674220963173], -0.5207626681247078, [1.728045325779038, 1.0906515580736542], -1.2136457904456304, [4.060938624362605, 1.3838754084985838], -1.0694858869096764, [6.891142200566573, -0.047681051558073895], -1.4716493502287318, [9.178341602266286, -2.976612659490083], -1.5003222663355726, [8.09233325325779, -7.040916632294616], -0.9628743606456998, [4.53257790368272, -7.478753541076488], -1.076087427994497, [2.3229461756373926, -7.478753541076488], 0, [-5.39660056657224, -7.478753541076487], 0, false];
let cus = loadFile(data);
// 向外-
// 向内+
@ -532,15 +532,15 @@ describe("补圆弧测试", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
})
})
});
});
describe("不规则不闭合多段线测试", () =>
{
test("test1", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [16.034190840579708, -16.545186318840567], 0, [36.985943188405784, -16.545186318840567], 0, [31.311510260869554, -12.507609043478254], 0, [48.334809043478245, -12.507609043478254], 0, [43.969860637681144, -16.6543100289855], 0, [56.84645843478259, -16.654310028985503], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [16.034190840579708, -16.545186318840567], 0, [36.985943188405784, -16.545186318840567], 0, [31.311510260869554, -12.507609043478254], 0, [48.334809043478245, -12.507609043478254], 0, [43.969860637681144, -16.6543100289855], 0, [56.84645843478259, -16.654310028985503], 0, false];
let cus = loadFile(data);
for (let i = 1.27; i <= 2.96; i += 0.2)
{
@ -552,11 +552,11 @@ describe("不规则不闭合多段线测试", () =>
expect(cus[0].GetOffsetCurves(-i).length).toBe(1);
}
})
});
test("test2-共线线段", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 7, [15.642409533480423, -31.01626057276902], 0, [38.129771973149346, -31.016260572769028], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [45.33685543194063, -31.016260572769028], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 7, [15.642409533480423, -31.01626057276902], 0, [38.129771973149346, -31.016260572769028], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [45.33685543194063, -31.016260572769028], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false];
let cus = loadFile(data);
for (let i = 1.82; i <= 3.37; i += 0.3)
{
@ -570,34 +570,34 @@ describe("不规则不闭合多段线测试", () =>
cus[0].Reverse();
expect(cus[0].GetOffsetCurves(-18).length).toBe(2);
data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 7, [21.944751443449043, -31.01626057276902], 0, [38.129771973149346, -31.016260572769028], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [45.33685543194063, -31.016260572769028], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 7, [21.944751443449043, -31.01626057276902], 0, [38.129771973149346, -31.016260572769028], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [45.33685543194063, -31.016260572769028], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false];
cus = loadFile(data);
expect(cus[0].GetOffsetCurves(11.4).length).toBe(1);
data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -56.21146708819905, -48.62279820279199, 0, 1], 2, 7, [26.333787338902418, -31.01626057276902], 0, [35.05226039203026, -31.016260572769013], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [41.54871106124796, -31.016260572769013], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -56.21146708819905, -48.62279820279199, 0, 1], 2, 7, [26.333787338902418, -31.01626057276902], 0, [35.05226039203026, -31.016260572769013], 0, [32.85929640135194, -26.50707591689791], 0, [47.440945483324754, -26.50707591689791], 0, [41.54871106124796, -31.016260572769013], 0, [61.52187596164093, -31.016260572769035], 0, [70.31099992504923, -35.88209931313313], 0, false];
cus = loadFile(data);
expect(cus[0].GetOffsetCurves(5.2).length).toBe(1);
data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [-3.158640226628895, -0.9915014164305944], 0, [-1.0906515580736538, -0.991501416430595], 0, [-1.983002832861189, 0.18413597733711037], 0, [1.0906515580736549, 0.3966005665722377], 0, [0.2974504249291776, -0.9915014164305944], 0, [3.966005665722378, -0.9915014164305953], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 6, [-3.158640226628895, -0.9915014164305944], 0, [-1.0906515580736538, -0.991501416430595], 0, [-1.983002832861189, 0.18413597733711037], 0, [1.0906515580736549, 0.3966005665722377], 0, [0.2974504249291776, -0.9915014164305944], 0, [3.966005665722378, -0.9915014164305953], 0, false];
cus = loadFile(data);
expect(cus[0].GetOffsetCurves(2.01133).length).toBe(1);
})
});
test("test3", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-41.52354973772388, -163.989590203395], 0, [-41.5235497377239, -231.3399374277236], 0, [21.016058399152634, -231.3399374277236], 0, [21.016058399152623, -294.68133541250876], 1.378670046466899, [261.5530127717545, -216.10593031745873], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [-41.52354973772388, -163.989590203395], 0, [-41.5235497377239, -231.3399374277236], 0, [21.016058399152634, -231.3399374277236], 0, [21.016058399152623, -294.68133541250876], 1.378670046466899, [261.5530127717545, -216.10593031745873], 0, false];
let cus = loadFile(data);
for (let i = -100; i <= 181; i += 30)
{
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
expect(cus[0].GetOffsetCurves(-122.6).length).toBe(2);
})
});
test("test4", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -131.50093441946296, -806.1569163328921, 0, 1], 2, 24, [256.5228611988947, -38.705370748164505], 0, [372.1955588024039, 31.844231195771492], 0, [372.1955588024039, -31.54297461172431], 0, [450.9819163032461, 37.57414810492366], 0, [423.0485713711294, -54.10452244151095], 0, [589.216161736542, 52.97329979827009], 0, [611.0614699526845, -2.177150452319474], 0, [672.6580767260702, 61.21005535517633], 0, [678.0298738284004, 13.938240854670997], 0, [735.329042919922, 21.100636991111184], 0, [684.1179105443746, -21.515620020708024], 0, [730.6734854312358, -32.61733403219032], 0, [815.1897598412304, 38.29038771856768], 0, [835.6025888300849, -8.981426781937659], 0, [862.1034545349137, 74.4604882075907], 0, [943.4539498526012, 74.46048820759069], 0, [986.972668777612, -29.064785548515978], 0, [924.5022496755805, -66.26627108118637], 0, [1001.0109652050348, -106.27541589934134], 0, [965.9152241364777, -128.73669018321777], 0, [1006.6262837760039, -176.46689803645526], 0, [904.1467198558175, -189.8032796425069], 0, [981.3573502066429, -242.44689124534239], 0, [1004.5205393118904, -256.48518767276516], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -131.50093441946296, -806.1569163328921, 0, 1], 2, 24, [256.5228611988947, -38.705370748164505], 0, [372.1955588024039, 31.844231195771492], 0, [372.1955588024039, -31.54297461172431], 0, [450.9819163032461, 37.57414810492366], 0, [423.0485713711294, -54.10452244151095], 0, [589.216161736542, 52.97329979827009], 0, [611.0614699526845, -2.177150452319474], 0, [672.6580767260702, 61.21005535517633], 0, [678.0298738284004, 13.938240854670997], 0, [735.329042919922, 21.100636991111184], 0, [684.1179105443746, -21.515620020708024], 0, [730.6734854312358, -32.61733403219032], 0, [815.1897598412304, 38.29038771856768], 0, [835.6025888300849, -8.981426781937659], 0, [862.1034545349137, 74.4604882075907], 0, [943.4539498526012, 74.46048820759069], 0, [986.972668777612, -29.064785548515978], 0, [924.5022496755805, -66.26627108118637], 0, [1001.0109652050348, -106.27541589934134], 0, [965.9152241364777, -128.73669018321777], 0, [1006.6262837760039, -176.46689803645526], 0, [904.1467198558175, -189.8032796425069], 0, [981.3573502066429, -242.44689124534239], 0, [1004.5205393118904, -256.48518767276516], 0, false];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(-100).length).toBe(1);
expect(cus[0].GetOffsetCurves(46.8).length).toBe(2);
@ -606,11 +606,11 @@ describe("不规则不闭合多段线测试", () =>
expect(cus[0].GetOffsetCurves(102.3).length).toBe(2);
expect(cus[0].GetOffsetCurves(110).length).toBe(1);
})
});
test("test5", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 18, [-3.895184135977337, 0.7648725212464592], 0, [0.8215297450424939, 0.7648725212464592], 0, [-2.1246458923512743, -2.1388101983002827], 0, [5.311614730878187, -2.1388101983002827], 0, [1.89801699716714, 3.4844192634560907], 0, [6.671388101983003, 3.4844192634560907], 0, [6.671388101983002, -3.4985835694051], 0, [10.6657223796034, -0.11331444759206824], 0, [8.810198300283286, 1.161473087818697], 0, [14.674220963172807, 3.30028328611898], 0, [16.713881019830033, -2.521246458923512], 0, [11.55807365439094, -5.773371104815864], 0, [3.8441926345609083, -5.773371104815863], 0, [2.3569405099150167, -8.787535410764873], 0, [-1.5297450424929169, -6.090651558073655], 0, [-6.586402266288951, -12.674220963172807], 0, [-8.113314447592067, -8.767705382436262], 0, [-10.929178470254957, -12.436260623229463], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 18, [-3.895184135977337, 0.7648725212464592], 0, [0.8215297450424939, 0.7648725212464592], 0, [-2.1246458923512743, -2.1388101983002827], 0, [5.311614730878187, -2.1388101983002827], 0, [1.89801699716714, 3.4844192634560907], 0, [6.671388101983003, 3.4844192634560907], 0, [6.671388101983002, -3.4985835694051], 0, [10.6657223796034, -0.11331444759206824], 0, [8.810198300283286, 1.161473087818697], 0, [14.674220963172807, 3.30028328611898], 0, [16.713881019830033, -2.521246458923512], 0, [11.55807365439094, -5.773371104815864], 0, [3.8441926345609083, -5.773371104815863], 0, [2.3569405099150167, -8.787535410764873], 0, [-1.5297450424929169, -6.090651558073655], 0, [-6.586402266288951, -12.674220963172807], 0, [-8.113314447592067, -8.767705382436262], 0, [-10.929178470254957, -12.436260623229463], 0, false];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(0.755).length).toBe(3);
expect(cus[0].GetOffsetCurves(1.915).length).toBe(4);
@ -623,11 +623,11 @@ describe("不规则不闭合多段线测试", () =>
expect(cus[0].GetOffsetCurves(-i).length).toBe(1);
}
})
});
test("test6", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -38.54242746474825, 6.4891615215880964, 0, 1], 2, 3, [18.466397865202012, 17.128892766521286], 0, [4.660056657223795, 6.487252124645892], -3.7897716494829594, [-0.906131771640112, 6.969061295372345], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -38.54242746474825, 6.4891615215880964, 0, 1], 2, 3, [18.466397865202012, 17.128892766521286], 0, [4.660056657223795, 6.487252124645892], -3.7897716494829594, [-0.906131771640112, 6.969061295372345], 0, false];
let cus = loadFile(data);
for (let i = -2.766; i <= 4.57; i++)
@ -655,11 +655,11 @@ describe("不规则不闭合多段线测试", () =>
{
expect(cus[0].GetOffsetCurves(-i).length).toBe(1);
}
})
});
test("test7", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -86.54515219838936, -34.782221464287886, 0, 1], 2, 5, [-51.274354719855246, 28.573003242461496], 0, [-13.931531095689206, 15.255196629685734], 3.7897716494829594, [-8.365342666825299, 14.77338745895928], 0, [5.4409985411529185, 25.415028100834675], 0.37399715496699776, [29.033295173881022, 23.38858533792915], 0, false]
[1, "Polyline", 1, 1, 0, false, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -86.54515219838936, -34.782221464287886, 0, 1], 2, 5, [-51.274354719855246, 28.573003242461496], 0, [-13.931531095689206, 15.255196629685734], 3.7897716494829594, [-8.365342666825299, 14.77338745895928], 0, [5.4409985411529185, 25.415028100834675], 0.37399715496699776, [29.033295173881022, 23.38858533792915], 0, false];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(-3.133).length).toBe(2);
for (let i = 10; i <= 60; i += 10)
@ -680,34 +680,34 @@ describe("不规则不闭合多段线测试", () =>
{
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
})
});
test("test8", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [14.442408344729744, 12.584578126613017], 0, [14.442408344729742, 4.502438174603963], 0, [20.086360825183, 4.502438174603963], 0, [20.086360825183, -0.9157562066311582], 0, [26.226981123916133, -0.9157562066311598], 0.4633692494967541, [33.496391918739924, 7.663051563657783], -0.673355221273594, [51.96340443478295, 18.996108144407916], 0.32851266965536, [64.10919017271836, 18.996108144407913], -1.9784627492130062, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 8, [14.442408344729744, 12.584578126613017], 0, [14.442408344729742, 4.502438174603963], 0, [20.086360825183, 4.502438174603963], 0, [20.086360825183, -0.9157562066311582], 0, [26.226981123916133, -0.9157562066311598], 0.4633692494967541, [33.496391918739924, 7.663051563657783], -0.673355221273594, [51.96340443478295, 18.996108144407916], 0.32851266965536, [64.10919017271836, 18.996108144407913], -1.9784627492130062, false];
let cus = loadFile(data);
for (let i = -15; i <= 15; i += 5)
{
if (i === 0) continue;
expect(cus[0].GetOffsetCurves(i).length).toBe(1);
}
})
});
test("test9-2圆弧没交点", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [-245.7800398731897, -124.83507012637789], 0.47532901948537815, [-247.69480466441718, -117.62074637472406], 0.12615539092932912, [-193.96898890583213, -126.5297489543612], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 3, [-245.7800398731897, -124.83507012637789], 0.47532901948537815, [-247.69480466441718, -117.62074637472406], 0.12615539092932912, [-193.96898890583213, -126.5297489543612], 0, false];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(11.22).length).toBe(1);
expect(cus[0].GetOffsetCurves(-11.22).length).toBe(1);
})
});
test("test10-共线部分错误裁剪", () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 13, [37846.488077851434, 5711.914029035103], 0, [28152.473806690192, 5711.914029035104], 0, [31338.416239942802, 10002.31650581529], 0, [39750.51284565329, 10002.316505815288], 0, [39750.51284565329, 17632.65706309083], 0, [45109.026777541825, 17632.65706309083], 0, [45109.02677754183, 10002.31650581529], 0, [54643.39210261924, 10002.31650581529], -0.8704734266845496, [55266.30970531861, 5526.15551510335], 0, [45201.90603450778, 5526.155515103216], 0, [45201.90603450778, 249.9945243911434], 0, [37846.488077851434, 435.75303832303064], 0, [37846.488077851434, 5711.914029035103], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 13, [37846.488077851434, 5711.914029035103], 0, [28152.473806690192, 5711.914029035104], 0, [31338.416239942802, 10002.31650581529], 0, [39750.51284565329, 10002.316505815288], 0, [39750.51284565329, 17632.65706309083], 0, [45109.026777541825, 17632.65706309083], 0, [45109.02677754183, 10002.31650581529], 0, [54643.39210261924, 10002.31650581529], -0.8704734266845496, [55266.30970531861, 5526.15551510335], 0, [45201.90603450778, 5526.155515103216], 0, [45201.90603450778, 249.9945243911434], 0, [37846.488077851434, 435.75303832303064], 0, [37846.488077851434, 5711.914029035103], 0, false];
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(2700).length).toBe(1);
})
})
});
});
test('提前丢失所有的线段', () =>
@ -819,7 +819,7 @@ test('海豚圆选点导致的错误', () =>
let cus = loadFile(
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5.653674874772044, 7.68794016265532, 0, 1], 2, 8, [933.8513988456853, 1095.3110732229222], -0.8740345959811056, [920.2952842385836, 1109.7702508499967], 0, [1041.059365726312, 1258.0770175893115], -0.47531159669542833, [1335.8552450029906, 1258.0770175893115], 0.4755782365532149, [1656.4630038262355, 1258.2164686086066], 0.011876098909362552, [1662.4715751586689, 1265.9781137467012], -0.44350119503715907, [1205.357990246699, 1110.5168645352571], 0.28917769175330255, [933.8513988456853, 1095.3110732229222], 0, false]
)
);
let pl = cus[0] as Polyline;
testOffset(pl, 10);
testOffset(pl, -10);
@ -842,7 +842,7 @@ test('复杂圆盘选点', () =>
test('补充bug测试', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3014.1813078325877, -118.48659432946494, 0, 1], 2, 25, [7212.90932057689, -239.9823077249786], -0.9999999999999921, [7212.9093205768895, 122.19897643916269], 0, [7779.276759343887, 122.19897643916269], 0, [7779.276759344071, 428.1814280252842], 0.1947099739542557, [7740.981455628771, 522.7925370761521], 0, [7304.310456694637, 522.7925370760897], 0, [7489.002384561892, 796.1365903196343], 0, [7742.516525859682, 796.1365903196343], 0, [7742.516525859682, 961.2048135488966], -1.3463056702167695, [8021.98728468389, 876.8699986200176], 0, [8021.987284683929, 789.3738464533299], -0.05161685745547489, [8028.1320183974, 790.0098847386233], 0, [8444.377142303902, 790.0098847389027], -1.1043175340350022, [8413.555740131487, 479.90559801040376], 0, [8049.204632346665, 479.9055980109795], 1.512505548953077, [8054.570478774117, 467.3001115689552], 0.06283615294599319, [8055.684165377956, 468.79464872233984], 0, [8055.684165377962, 182.7089738110588], -0.056342427094734256, [8062.381207162069, 183.46603224647305], 0, [8468.88396462686, 183.4660322464784], -0.20525770195463292, [8655.475816304977, 103.49809581299945], -0.8336853670274493, [8492.531297747215, -120.51154890075377], 0, [8104.435007347477, -120.51154890071338], -0.6646338605614993, [7740.532382653638, -239.9823077249987], 0, [7212.90932057689, -239.9823077249786], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3014.1813078325877, -118.48659432946494, 0, 1], 2, 25, [7212.90932057689, -239.9823077249786], -0.9999999999999921, [7212.9093205768895, 122.19897643916269], 0, [7779.276759343887, 122.19897643916269], 0, [7779.276759344071, 428.1814280252842], 0.1947099739542557, [7740.981455628771, 522.7925370761521], 0, [7304.310456694637, 522.7925370760897], 0, [7489.002384561892, 796.1365903196343], 0, [7742.516525859682, 796.1365903196343], 0, [7742.516525859682, 961.2048135488966], -1.3463056702167695, [8021.98728468389, 876.8699986200176], 0, [8021.987284683929, 789.3738464533299], -0.05161685745547489, [8028.1320183974, 790.0098847386233], 0, [8444.377142303902, 790.0098847389027], -1.1043175340350022, [8413.555740131487, 479.90559801040376], 0, [8049.204632346665, 479.9055980109795], 1.512505548953077, [8054.570478774117, 467.3001115689552], 0.06283615294599319, [8055.684165377956, 468.79464872233984], 0, [8055.684165377962, 182.7089738110588], -0.056342427094734256, [8062.381207162069, 183.46603224647305], 0, [8468.88396462686, 183.4660322464784], -0.20525770195463292, [8655.475816304977, 103.49809581299945], -0.8336853670274493, [8492.531297747215, -120.51154890075377], 0, [8104.435007347477, -120.51154890071338], -0.6646338605614993, [7740.532382653638, -239.9823077249987], 0, [7212.90932057689, -239.9823077249786], 0, false];
let pl = loadFile(data)[0];
@ -852,7 +852,7 @@ test('补充bug测试', () =>
cus = pl.GetOffsetCurves(-10);
expect(cus.length).toBe(1);
expect(cus[0].Length).toMatchSnapshot();
})
});
test('多段线存在0长度线段导致偏移错误', () =>
{

@ -19,7 +19,7 @@ test('补充bug测试#IKWGF', () =>
{
//https://gitee.com/BearCAD/WebThreeJs/issues/IKWGF
let data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1.073087818696886, -6.460623229461753, 0, 1], 2, 13, [2.913294797687863, 5.657009425680781], -0.10216571300036134, [3.0668619767188887, 5.578034682080925], 0, [4.6094463694365295, 5.578034682080925], -2.632498680881094, [4.609446369436524, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 4.990312071734102], -0.11795690250598688, [2.37813156168231, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 6.15606936416185], 0, [2.913294797687864, 6.15606936416185], 0, [2.913294797687864, 5.657009425680784], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1.073087818696886, -6.460623229461753, 0, 1], 2, 13, [2.913294797687863, 5.657009425680781], -0.10216571300036134, [3.0668619767188887, 5.578034682080925], 0, [4.6094463694365295, 5.578034682080925], -2.632498680881094, [4.609446369436524, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 4.990312071734102], -0.11795690250598688, [2.37813156168231, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 6.15606936416185], 0, [2.913294797687864, 6.15606936416185], 0, [2.913294797687864, 5.657009425680784], 0, false];
let pl = loadFile(data)[0];
@ -64,7 +64,7 @@ test('补充bug测试#IKWGF', () =>
test("偏移真交点判断错误", () =>
{
let data =
[1, "Polyline", 5, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1671.5225704902539, 783.1395680459682, 0, 1], 0, 0, 2, 3, [-75, -2.842170943040401e-14], 0.9999999999999997, [75, 0], -0.9999999999999997, [225, -5.684341886080802e-14], 0.9999999999999923, true]
[1, "Polyline", 5, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1671.5225704902539, 783.1395680459682, 0, 1], 0, 0, 2, 3, [-75, -2.842170943040401e-14], 0.9999999999999997, [75, 0], -0.9999999999999997, [225, -5.684341886080802e-14], 0.9999999999999923, true];
let pl = loadFile(data)[0];
@ -72,23 +72,23 @@ test("偏移真交点判断错误", () =>
let cus = pl.GetOffsetCurves(75);
expect(cus.length).toBe(1);
})
});
test("补圆弧错误01", () =>
{
let data =
[1, "Polyline", 5, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, -248.36561743341508, -235.59093395827813, 0, 1], 0, 0, 2, 4, [150, 74.99999999999999], -0.9999999999999997, [300, 74.99999999999903], 0.5398412275759912, [90.31248359508209, 212.61322750888567], 0, [137.41283997485402, 33.411090345222135], 0.14801304447405583, true]
[1, "Polyline", 5, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, -248.36561743341508, -235.59093395827813, 0, 1], 0, 0, 2, 4, [150, 74.99999999999999], -0.9999999999999997, [300, 74.99999999999903], 0.5398412275759912, [90.31248359508209, 212.61322750888567], 0, [137.41283997485402, 33.411090345222135], 0.14801304447405583, true];
let pl = loadFile(data)[0];
let cus = pl.GetOffsetCurves(180);
expect(cus.length).toBe(1);
})
});
test("补圆弧错误02", () =>
{
let data =
[1, "Polyline", 5, 2, 101, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 222.42531269162828, 290.34989003720335, 0, 1], 0, 0, 2, 5, [30.164179214139466, -146.93577608035883], 0, [-2.966375216967549, -20.884369768256875], -0.3337793930899486, [-74.99999999999987, -74.99999999999926], -0.4142135623730949, [-149.99999999999986, 6.821210263296962e-13], 0.4142135623730963, [-2.842170943040401e-14, -149.99999999999986], 0.050662063831163964, true]
[1, "Polyline", 5, 2, 101, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 222.42531269162828, 290.34989003720335, 0, 1], 0, 0, 2, 5, [30.164179214139466, -146.93577608035883], 0, [-2.966375216967549, -20.884369768256875], -0.3337793930899486, [-74.99999999999987, -74.99999999999926], -0.4142135623730949, [-149.99999999999986, 6.821210263296962e-13], 0.4142135623730963, [-2.842170943040401e-14, -149.99999999999986], 0.050662063831163964, true];
let pl = loadFile(data)[0];
@ -98,5 +98,5 @@ test("补圆弧错误02", () =>
cus = pl.GetOffsetCurves(145);
expect(cus.length).toBe(1);
})
});

@ -30,7 +30,7 @@ test("多段线点获取参数", () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetParamAtPoint(new Vector3(5, 0, 0))).toBe(1);
expect(pl.GetParamAtPoint(new Vector3(6, 0, 0)) /*?*/).toBe(NaN);
expect(pl.GetParamAtPoint(new Vector3(-2.5, 0, 0))/*?*/).toBe(-0.5);
@ -50,10 +50,10 @@ test("多段线点获取参数", () =>
pt: new Vector2(1.5, 1.5),
bul: 0
}
])
expect(pl2.GetParamAtPoint(new Vector3(1.5, 5))).toBe(0.5)
]);
expect(pl2.GetParamAtPoint(new Vector3(1.5, 5))).toBe(0.5);
})
});
describe('多段线', () =>
{
@ -85,7 +85,7 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(equalv3(pl.GetPointAtParam(1), new Vector3(5, 0, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtParam(0.5), new Vector3(2.5, 0, 0))).toBeTruthy();
@ -93,7 +93,7 @@ describe('多段线', () =>
expect(equalv3(pl.GetPointAtParam(4.5), new Vector3(0, 5, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtParam(5), new Vector3(0, 0, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtParam(5.5), new Vector3(0, -5, 0))).toBeTruthy();
})
});
test("多段线参数获取弧长", () =>
{
let pl = new Polyline([
@ -121,14 +121,14 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetDistAtParam(1)).toBe(5);
expect(pl.GetDistAtParam(2)).toBe(5 + Math.PI * 2.5);
expect(pl.GetDistAtParam(1.5)).toBe(5 + Math.PI * 2.5 / 2);
expect(pl.GetDistAtParam(3)).toBe(5 + Math.PI * 5);
expect(pl.GetDistAtParam(4)).toBe(5 + Math.PI * 5 + 5);
expect(pl.GetDistAtParam(3.5)).toBe(5 + Math.PI * 5 + 2.5);
})
});
test("多段线弧长获取点", () =>
{
let pl = new Polyline([
@ -156,13 +156,13 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(equalv3(pl.GetPointAtDistance(5), new Vector3(5, 0, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtDistance(2.5), new Vector3(2.5, 0, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtDistance(5 + Math.PI * 2.5), new Vector3(5, 5, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtDistance(5 + Math.PI * 2.5 * 2), new Vector3(5, 10, 0))).toBeTruthy();
expect(equalv3(pl.GetPointAtDistance(0), new Vector3(0, 0, 0))).toBeTruthy();
})
});
test("多段线距离获取参数", () =>
{
let pl = new Polyline([
@ -190,11 +190,11 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetParamAtDist(5)).toBe(1);
expect(pl.GetParamAtDist(5 + Math.PI * 2.5)).toBe(2);
expect(pl.GetParamAtDist(5 + Math.PI * 2.5 / 2)).toBe(1.5);
})
});
test("多段线点获取弧长", () =>
{
let pl = new Polyline([
@ -222,13 +222,13 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetDistAtPoint(new Vector3(0, 0, 0))).toBe(0);
expect(pl.GetDistAtPoint(new Vector3(5, 0, 0))).toBe(5);
expect(pl.GetDistAtPoint(new Vector3(7.5, 2.5, 0))).toBe(5 + Math.PI / 2 * 2.5);
expect(pl.GetDistAtPoint(new Vector3(7.5, 2.5, 0))).toBe(5 + Math.PI / 2 * 2.5);
expect(pl.Length).toMatchSnapshot();
})
});
test("多段线延伸,不闭合", () =>
{
let pl = new Polyline([
@ -256,7 +256,7 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
let pl2 = new Polyline([
{
pt: new Vector2(0, 0),
@ -278,7 +278,7 @@ describe('多段线', () =>
pt: new Vector2(0, 10),
bul: 0
}
])
]);
expect(pl.IsClose).toBeTruthy();
pl.Extend(5.5);
expect(pl.EndPoint).toEqual(new Vector3(0, -5, 0));
@ -287,9 +287,9 @@ describe('多段线', () =>
pl.Extend(-0.5);
expect(pl.StartPoint).toEqual(new Vector3(-2.5, 0, 0));
expect(pl.IsClose).toBeFalsy();
pl2.Extend(4.5)
pl2.Extend(4.5);
expect(pl2.EndPoint).toEqual(new Vector3(-2.5, 10, 0));
pl2.Extend(-0.5)
pl2.Extend(-0.5);
expect(pl2.EndPoint).toEqual(new Vector3(-2.5, 10, 0));
expect(pl2.StartPoint).toEqual(new Vector3(-2.5, 0, 0));
@ -302,13 +302,13 @@ describe('多段线', () =>
pt: new Vector2(0, 5),
bul: 0
}
])
]);
pl3.Extend(1.5);
expect(equalv3(pl3.EndPoint, new Vector3(-2.5, 2.5, 0))).toBeTruthy();
pl3.Extend(1 + 1 / 3);
// expect(pl3.EndPoint).toEqual(new Vector3(0, 0, 0));
expect(equalv3(pl3.EndPoint /*?*/, new Vector3(0, 0, 0))).toBeTruthy();
})
});
test("多段线延伸,闭合", () =>
{
let pl = new Polyline([
@ -336,11 +336,11 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
pl.CloseMark = true;
pl.Extend(5.5);
expect(pl.EndPoint).toEqual(new Vector3());
})
});
test("多段线点在线上", () =>
{
let pl = new Polyline([
@ -368,14 +368,14 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetParamAtPoint(new Vector3())).toBe(0);
expect(pl.PtOnCurve(new Vector3(0, 0, 0))).toBeTruthy();
expect(pl.PtOnCurve(new Vector3(5, 0, 0))).toBeTruthy();
expect(pl.PtOnCurve(new Vector3(7.5, 2.5, 0))).toBeTruthy();
expect(pl.PtOnCurve(new Vector3(7.5, 3.5, 0))).toBeFalsy();
})
});
test("多段线最近点", () =>
{
let pl = new Polyline([
@ -403,14 +403,14 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
]);
expect(pl.GetClosestPointTo(new Vector3(), true)).toEqual(new Vector3());
expect(pl.GetClosestPointTo(new Vector3(3.5, 2.5), true)).toEqual(new Vector3(3.5, 0, 0));
expect(pl.GetClosestPointTo(new Vector3(1.5, 3.5), true)).toEqual(new Vector3(0, 3.5, 0));
expect(equalv3(pl.GetClosestPointTo(new Vector3(1.5, 3.5), true), new Vector3(0, 3.5, 0))).toBeTruthy();
expect(equalv3(pl.GetClosestPointTo(new Vector3(-0.5, -1), true), new Vector3(0, -1, 0))).toBeTruthy();
})
});
test("多段线包围盒", () =>
{
let pl = new Polyline([
@ -438,10 +438,10 @@ describe('多段线', () =>
pt: new Vector2(0, 0),
bul: 0
}
])
expect(pl.BoundingBox.getSize(new Vector3())).toEqual(new Vector3(7.5, 10, 0))
]);
expect(pl.BoundingBox.getSize(new Vector3())).toEqual(new Vector3(7.5, 10, 0));
})
});
test("多段线反转", () =>
{
let pl = new Polyline([
@ -465,17 +465,17 @@ describe('多段线', () =>
pt: new Vector2(0, 10),
bul: 0
}
])
]);
pl.Reverse();
expect(pl.StartPoint).toEqual(new Vector3(0, 10, 0))
})
expect(pl.StartPoint).toEqual(new Vector3(0, 10, 0));
});
//直线和圆的求交的det精度不能为0.1 太大了.请保证这个测试是通过的
test('最近点精度', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [2, 0], 1, [2, 2], -1, [2, 4], 0, [0, 4], 0, true]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [0, 0], 0, [2, 0], 1, [2, 2], -1, [2, 4], 0, [0, 4], 0, true];
f.Read();
let pl = f.ReadObject() as Polyline;
pl.Reverse();
@ -502,7 +502,7 @@ describe('多段线', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -19.17745164184445, -6.335408131680751, 0, 1], 2, 5, [11.884352072596577, -75.64730611519322], -1.9523252757782086, [16.25360183965801, -70.58112080246555], 0, [14.621427950114992, -70.9720172143345], 1.8583004340984604, [11.834326201222096, -73.95002751582643], 0, [11.884352072596577, -75.64730611519322], 0, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -19.17745164184445, -6.335408131680751, 0, 1], 2, 5, [11.884352072596577, -75.64730611519322], -1.9523252757782086, [16.25360183965801, -70.58112080246555], 0, [14.621427950114992, -70.9720172143345], 1.8583004340984604, [11.834326201222096, -73.95002751582643], 0, [11.884352072596577, -75.64730611519322], 0, false];
f.Read();
@ -511,13 +511,13 @@ describe('多段线', () =>
expect(pl.Area2).toMatchSnapshot();
});
})
});
test('最近点参数刚好在端点上', () =>
{
let f = new CADFiler();
f.Data =
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 15.725529745042493, -3.9968028886505635e-15, 0, 1], 2, 3, [13.07875354107649, 3.8181303116147296], 0, [18.159206798866855, 3.8181303116147296], 0.664293193717279, [18.159206798866855, -1.4844192634560907], -0.10977222864644352, false]
[1, "Polyline", 1, 1, 0, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 15.725529745042493, -3.9968028886505635e-15, 0, 1], 2, 3, [13.07875354107649, 3.8181303116147296], 0, [18.159206798866855, 3.8181303116147296], 0.664293193717279, [18.159206798866855, -1.4844192634560907], -0.10977222864644352, false];
f.Read();
let pl = f.ReadObject() as Polyline;
@ -547,7 +547,7 @@ function loadFile(data)
test('点在线上精度', () =>
{
let data =
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6.283029954893735, -0.21450491241551983, 0, 1], 2, 5, [-6.290104635739899, 3.3748564511765324], -0.10216571300036131, [-6.136537456708874, 3.2958817075766764], 0, [-6.236783847999098, 3.0649817075766763], 0.44141445079284647, [-6.5210046357398985, 3.121255471298752], 0, [-6.290104635739899, 3.3748564511765324], 0, false]
[1, "Polyline", 1, 1, 0, false, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6.283029954893735, -0.21450491241551983, 0, 1], 2, 5, [-6.290104635739899, 3.3748564511765324], -0.10216571300036131, [-6.136537456708874, 3.2958817075766764], 0, [-6.236783847999098, 3.0649817075766763], 0.44141445079284647, [-6.5210046357398985, 3.121255471298752], 0, [-6.290104635739899, 3.3748564511765324], 0, false];
let pl = loadFile(data)[0];

@ -5,7 +5,7 @@ import "../Utils/jest.util";
test('多段线面积', () =>
{
let d =
{ "file": [6, "Polyline", 5, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 2, [9.569377990430496, 149.52153110047848], 0, [441.3875598086124, 373.2057416267944], 0, false, "Polyline", 5, 2, 102, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [612.4401913875597, 147.12918660287082], 0, [1139.952153110048, 383.9712918660287], 0, [1203.349282296651, 160.28708133971296], 0, false, "Polyline", 5, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [1493.5406698564593, 8.612440191387606], 0, [2302.3923444976076, 372.0095693779905], 0, [2302.3923444976076, -81.81818181818187], 0, true, "Polyline", 5, 2, 104, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [2601.818181818182, 136.88995215311004], 0, [3033.2057416267944, 495.59808612440185], -1.4100385033366523, [3122.2966507177034, 256.4593301435407], 0, false, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 2, [3438.803827751196, -13.157894736842092], -0.37911328762272817, [3745.933014354067, -285.11961722488024], 0, false, "Polyline", 5, 2, 106, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [4261.253588516746, -110.68899521531104], 0, [5012.899521531101, 99.37799043062196], -0.5470946737007636, [4261.253588516747, -110.68899521531102], 0, false], "basePt": { "x": 9.569377990430496, "y": -285.1196172248802, "z": 0 } }
{ "file": [6, "Polyline", 5, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 2, [9.569377990430496, 149.52153110047848], 0, [441.3875598086124, 373.2057416267944], 0, false, "Polyline", 5, 2, 102, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [612.4401913875597, 147.12918660287082], 0, [1139.952153110048, 383.9712918660287], 0, [1203.349282296651, 160.28708133971296], 0, false, "Polyline", 5, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [1493.5406698564593, 8.612440191387606], 0, [2302.3923444976076, 372.0095693779905], 0, [2302.3923444976076, -81.81818181818187], 0, true, "Polyline", 5, 2, 104, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [2601.818181818182, 136.88995215311004], 0, [3033.2057416267944, 495.59808612440185], -1.4100385033366523, [3122.2966507177034, 256.4593301435407], 0, false, "Polyline", 5, 2, 105, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 2, [3438.803827751196, -13.157894736842092], -0.37911328762272817, [3745.933014354067, -285.11961722488024], 0, false, "Polyline", 5, 2, 106, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 3, [4261.253588516746, -110.68899521531104], 0, [5012.899521531101, 99.37799043062196], -0.5470946737007636, [4261.253588516747, -110.68899521531102], 0, false], "basePt": { "x": 9.569377990430496, "y": -285.1196172248802, "z": 0 } };
let pls = LoadEntityFromFileData(d) as Polyline[];

@ -1,4 +1,4 @@
import { toMatchSnapshot } from "jest-snapshot"
import { toMatchSnapshot } from "jest-snapshot";
// ensure this is parsed as a module.
export { };

@ -36,14 +36,14 @@ const option: IWineRackOption = {
isDrawLy: false,
isDrawVer: false,
brThick2: 18,
}
};
describe("酒格功能测试", () =>
{
test("斜酒格1", () =>
{
let data =
[2, "Board", 5, 2, 102, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 580.3050847457629, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 580.3050847457629, -214.2857142857143, 0, 1], 1, "右侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -601.6949152542372, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -601.6949152542372, -214.2857142857143, 0, 1], 1, "左侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0]
[2, "Board", 5, 2, 102, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 580.3050847457629, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 580.3050847457629, -214.2857142857143, 0, 1], 1, "右侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -601.6949152542372, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -601.6949152542372, -214.2857142857143, 0, 1], 1, "左侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0];
let spaceParse = new ISpaceParse();
spaceParse.Boards = LoadEntityFromFileData(data) as Board[];
@ -53,5 +53,5 @@ describe("酒格功能测试", () =>
ObliqueTool.Parse(spaceParse, option);
expect(UprightTool.boardlist.length).toMatchSnapshot();
expect(ObliqueTool.boardlist.length).toMatchSnapshot();
})
})
});
});

@ -6,4 +6,4 @@ const useGitBranchName = false;
if (useGitBranchName)
outputDir = `../dist_${gitRevisionPlugin.branch()}/`;
else
outputDir = "../dist/"
outputDir = "../dist/";

@ -3,7 +3,7 @@ import * as path from 'path';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import { outputDir } from './outputPath';
const dllName = "dll"
const dllName = "dll";
const vendors = [
"@blueprintjs/core",
"mobx",

@ -279,7 +279,7 @@ export class Command_Array implements Command
{ pt: px2, bul: 0 },
{ pt: px3, bul: 0 },
{ pt: px4, bul: 0 }];
}
};
ptRes = await app.Editor.GetPoint({
Msg: "指定另一个角点:",
@ -319,7 +319,7 @@ export class Command_Array implements Command
let array_angle = option.arrayAngle;
let arrayAngle = THREE.Math.degToRad(array_angle);
//构造矩形阵列
recArray(ss, row_num, col_num, row_offset, col_offset, arrayAngle)
recArray(ss, row_num, col_num, row_offset, col_offset, arrayAngle);
}
else if (option.type === ArrayType.Circle)
{
@ -343,7 +343,7 @@ export class Command_Array implements Command
//构造矩形阵列
function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: number, colOffset: number, arrayAngle: number = 0)
{
let mat = new Matrix4().extractRotation(app.Editor.UCSMatrix)
let mat = new Matrix4().extractRotation(app.Editor.UCSMatrix);
let xVec = rotatePoint(new Vector3(colOffset), arrayAngle).applyMatrix4(mat);
let yVec = rotatePoint(new Vector3(0, rowOffset), arrayAngle).applyMatrix4(mat);

@ -21,7 +21,7 @@ export class BatchModify implements Command
let keyRes = await app.Editor.GetKeyWords({
Msg: "编辑封边还是排钻?",
KeyWordList: [{ msg: "封边", key: "S" }, { msg: "排钻", key: "D" }]
})
});
if (keyRes.Status !== PromptStatus.Keyword) return;

@ -45,7 +45,7 @@ export class BoardBatchCurtail implements Command
let sizeBox = new Box3();
let spaceOcsInv = brs[0].SpaceOCSInv;
let boardBoxCache = new Map<Board, { box: Box3, size: Vector3 }>();
let boardBoxCache = new Map<Board, { box: Box3, size: Vector3; }>();
for (let br of brs)
{
let box = br.BoundingBoxInOCS;
@ -64,8 +64,8 @@ export class BoardBatchCurtail implements Command
let rightBox = new Box3(sizeBox.min.clone().add(new Vector3(size.x / 2, -1, -1)), sizeBox.max.clone().add(v));
let backBox = new Box3(sizeBox.min.clone().add(new Vector3(-1, size.y / 2, -1)), sizeBox.max.clone().add(v));
let leftBox = new Box3(sizeBox.min.clone().sub(v), sizeBox.max.clone().sub(new Vector3(size.x / 2, -1, -1)));
return { front: frontBox, right: rightBox, left: leftBox, back: backBox }
}
return { front: frontBox, right: rightBox, left: leftBox, back: backBox };
};
let curBox = GenCurtailBox(sizeBox);
@ -78,7 +78,7 @@ export class BoardBatchCurtail implements Command
};
for (let key in dx)
{
let d: { box: Box3, index: number, allowDist: number } = dx[key];
let d: { box: Box3, index: number, allowDist: number; } = dx[key];
let minDist = Infinity;
for (let br of brs)
{
@ -133,7 +133,7 @@ export class BoardBatchCurtail implements Command
if (!isParallelTo(d.vec, br.Normal))
br.MoveStretchPoints(d.indexs, d.vec);
else if (store.m_Option.moveBrs)
br.MoveStretchPoints(br.GetStretchPoints().map((v, i) => { return i }), d.vec);
br.MoveStretchPoints(br.GetStretchPoints().map((v, i) => { return i; }), d.vec);
}
}
}

@ -59,13 +59,13 @@ export class ReferenceCuttingStore extends Singleton
}
HasInvailValue()
{
return CheckoutValid.HasInvailValue(this.m_UiOption, CheckObjectType.RC)
return CheckoutValid.HasInvailValue(this.m_UiOption, CheckObjectType.RC);
}
}
@inject("store")
@observer
export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCuttingStore }, {}> {
export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCuttingStore; }, {}> {
private uiOption;
private handleChangeOffsetDir = (e) =>
{
@ -81,7 +81,7 @@ export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCut
store.m_Option.offset = store.m_Option.halfThickness;
this.uiOption["offset"] = store.m_Option.halfThickness.toString();
}
}
};
private getOffsetKeyWord = (): OffsetKeyWord =>
{
switch (this.props.store.m_Option.boardType)
@ -93,7 +93,7 @@ export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCut
case BoardType.Behind:
return { Front: "前偏", Back: "后偏" };
}
}
};
registerEvent()
{
app.Editor.ModalManage.events.push(
@ -142,7 +142,7 @@ export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCut
<RadioGroup
inline={true}
selectedValue={store.m_Option.CuttingPosSelected}
onChange={e => { this.handleChangeOffsetDir(e) }}
onChange={e => { this.handleChangeOffsetDir(e); }}
>
<Radio label={this.getOffsetKeyWord().Front} value={CuttingOffset.Front} />
<Radio label="居中" value={CuttingOffset.Middle} />
@ -171,19 +171,19 @@ export class ReferenceCuttingModal extends React.Component<{ store: ReferenceCut
if (store.HasInvailValue())
AppToaster.show({ message: "存在无效数值,请修正", timeout: 1000 });
else
store.OnOk()
store.OnOk();
}}
/>
<Button
className="LeftRightBtn"
intent="danger"
text="取消"
onClick={() => { store.Cancel() }}
onClick={() => { store.Cancel(); }}
/>
</div>
</div>
</div>
</div>
)
);
}
}

@ -49,7 +49,7 @@ export function deserializationBoardData(file: CADFiler, processData: BoardProce
processData[EBoardKeyList.ComposingFace] = file.Read();
let count = file.Read();
processData[EBoardKeyList.HighSealed].length = 0
processData[EBoardKeyList.HighSealed].length = 0;
for (let i = 0; i < count; i++)
{
let size = file.Read();

@ -59,7 +59,7 @@ export class BoardFindModify implements Command
{
app.Editor.MaskManage.ShowMask();
}
}
};
}
private async GetBoards(otherEnts = [])
{
@ -155,7 +155,7 @@ export class BoardFindModify implements Command
let names = option.brName.split(",");
if (arrayLast(names) === "")
names.pop();
isVail = names.some(n => this.CompareIsEqual(brValue, n, option.compareType.brName))
isVail = names.some(n => this.CompareIsEqual(brValue, n, option.compareType.brName));
break;
case EBoardKeyList.Mat:
brValue = br.BoardProcessOption[EBoardKeyList.Mat];
@ -317,7 +317,7 @@ export class BoardFindModify implements Command
else
return Math.max(br.Height, br.Width) > maxHeight
|| Math.min(br.Height, br.Width) > maxWidth;
}
};
let brs = (await this.GetBoards()).filter(br => isLongBr(br));
@ -332,7 +332,7 @@ export class BoardFindModify implements Command
this.PutSelectList(brs);
}
private async GetBoardOption(option: IBoardFindOption, data: { key: string, content: string })
private async GetBoardOption(option: IBoardFindOption, data: { key: string, content: string; })
{
let brRes = await app.Editor.GetEntity({
Msg: data.content,

@ -15,7 +15,7 @@ export class FeedingCommand implements Command
Msg: "选择板件",
UseSelect: true,
Filter: { filterTypes: [Board] }
})
});
if (brRes.Status === PromptStatus.Cancel)
return;

@ -21,7 +21,7 @@ export async function CreateBoardFromData(data: Object)
color: 0xffffff,
metalness: 0.2,
bumpScale: 0.0005
})
});
for (let board of boardList)
{

@ -28,7 +28,7 @@ export class DrawArc implements Command
arc.FromThreePoint(pt1, pt2, p);
arc.Update();
}
}
};
JigUtils.Draw(arc);
let ptRes3 = await app.Editor.GetPoint({

@ -40,7 +40,7 @@ export abstract class DrawBoardTool implements Command
app.Editor.ModalManage.Callback = async () =>
{
await this.SelectAndBuildBoard();
}
};
}
private async SelectAndBuildBoard()
{
@ -55,7 +55,7 @@ export abstract class DrawBoardTool implements Command
{
this.space = selectSpace.SpaceParse;
if (selectSpace.ParseOK)
this.buildBoard(false)
this.buildBoard(false);
});
if (selectSpace.GetPointRes.Status === PromptStatus.None)
{

@ -48,7 +48,7 @@ export class DrawClosingStrip implements Command
}
useOptionCallback();
useOptionCallback = null;
})
});
let res = await app.Editor.ModalManage.Wait();
if (res.Status !== ModalState.Ok) return;
@ -99,7 +99,7 @@ export class DrawClosingStrip implements Command
BoardType.Behind);
br.BoardProcessOption = this.store.BoardProcessOption;
br.BoardProcessOption.lines = LinesType.Reverse;
pos.set(min.x, min.y + thickness+ frontShrink, max.z);
pos.set(min.x, min.y + thickness + frontShrink, max.z);
br2 = Board.CreateBoard(size.x, DEFAULT_STRIP_WIDTH, thickness,
BoardType.Layer);

@ -113,7 +113,7 @@ export class DrawLeftRightOpenDoor extends DrawDoorTool
private GetColTemplate(lValue: string | number, currentCol: number)
{
let colTemp = new TemplateRecord().InitBaseParams();
colTemp.Name = "门板组"
colTemp.Name = "门板组";
colTemp.SplitType = TemplateSplitType.Z;
app.Database.TemplateTable.Append(colTemp);
this.AppendTemplateParam("ZKM", 0, "左开门", colTemp);

@ -44,7 +44,7 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
let hasVerRight = j === col - 1 ? this.isDrawVerBrS[j - 1] : this.isDrawVerBrS[j];
let colTemplate = this.GetColTemplate(info, this.colWidths[j], hasVerLeft, hasVerRight);
rowTemp.Children.push(colTemplate.Id)
rowTemp.Children.push(colTemplate.Id);
if (j < col - 1)
{
@ -116,7 +116,7 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
private GetRowTemplate(lValue: string | number, currentRow: number)
{
let rowTemp = new TemplateRecord().InitBaseParams();
rowTemp.Name = "门板组"
rowTemp.Name = "门板组";
rowTemp.SplitType = TemplateSplitType.X;
app.Database.TemplateTable.Append(rowTemp);
this.AppendTemplateParam("SKM", 0, "上开门", rowTemp);
@ -164,7 +164,7 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
)
{
let colTemplate = this.GetDoorSpaceTemplate(info, colWidth, hasVerLeft, hasVerRight);
let doorTemplate = this.GetDoorTemp(info)
let doorTemplate = this.GetDoorTemp(info);
for (let id of doorTemplate.Objects)
{
@ -401,6 +401,6 @@ export class DrawUpDownOpenDoor extends DrawDoorTool
temp.HParam.expr = "__H";
temp.PXParam.expr = "_POS";
temp.PYParam.expr = "__MBNS<0?-__MBNS:0";
return temp
return temp;
}
}

@ -148,7 +148,7 @@ export class DrawDrawrer implements Command
let key = j.toString() + "-" + i.toString();
let info = rowColIdMap.get(key);
let rowTemplate = this.GetDrawerTemp(info, idTempMap, rowHeighs[j], store.m_Option);
colTemp.Children.push(rowTemplate.Id)
colTemp.Children.push(rowTemplate.Id);
}
templateSpace.Children.push(colTemp.Id);
if (i < col - 1)
@ -234,7 +234,7 @@ export class DrawDrawrer implements Command
private GetColTemplate(lValue: string | number, currentCol: number, opt: IDrawerConfigOption)
{
let colTemp = new TemplateRecord().InitBaseParams();
colTemp.Name = "抽屉空间"
colTemp.Name = "抽屉空间";
colTemp.SplitType = TemplateSplitType.Z;
app.Database.TemplateTable.Append(colTemp);

@ -102,7 +102,7 @@ export class DrawLayerBoard extends DrawBoardTool
initNails.push({
pos: NailPos.Back,
nail: bNail
})
});
}
return initNails;
}
@ -156,7 +156,7 @@ export class DrawLayerBoard extends DrawBoardTool
let backBr = backBrs[0];
let backPos = backBr.Position.applyMatrix4(this.space.SpaceOCSInv);
if (Math.abs(backPos.y - maxY - backBr.Thickness) < refDist)
this.backBoard = backBr
this.backBoard = backBr;
}
}
@ -188,7 +188,7 @@ export class DrawLayerBoard extends DrawBoardTool
return {
pos: n.pos,
nail: n.nail.Clone()
}
};
});
for (let nailProp of nailProps)
{
@ -212,7 +212,7 @@ export class DrawLayerBoard extends DrawBoardTool
return {
pos: n.pos,
nail: n.nail.Clone()
}
};
});
nails.forEach(n =>
{
@ -224,7 +224,7 @@ export class DrawLayerBoard extends DrawBoardTool
return {
pos: n.pos,
nail: n.nail.Clone()
}
};
});
nails.forEach(n =>
{

@ -36,7 +36,7 @@ export class DrawLeftRight implements Command
{
let vec = v.clone().sub(leftBoard.MinPoint);
leftBoard.ApplyMatrix(MoveMatrix(vec));
rightBoard.ApplyMatrix(MoveMatrix(vec))
rightBoard.ApplyMatrix(MoveMatrix(vec));
}
});
@ -54,16 +54,16 @@ export class DrawLeftRight implements Command
leftBoard.ApplyMatrix(MoveMatrix(vec));
rightBoard.ApplyMatrix(MoveMatrix(vec));
leftBoard.Name = "左侧板"
leftBoard.Name = "左侧板";
leftBoard.BoardProcessOption = store.BoardProcessOption;
rightBoard.Name = "右侧板"
rightBoard.Name = "右侧板";
rightBoard.BoardProcessOption = store.BoardProcessOption;
app.Database.ModelSpace.Append(leftBoard);
app.Database.ModelSpace.Append(rightBoard);
template.Objects = [leftBoard.Id, rightBoard.Id];
}
}
};
}
}

@ -44,6 +44,6 @@ export class DrawSingleBoard implements Command
board.ApplyMatrix(MoveMatrix(vec));
app.Database.ModelSpace.Append(board);
}
}
};
}
}

@ -18,7 +18,7 @@ export async function selectOutlinePosition(cus: Curve[] | Curve)
{
let moveCus: Curve[];
if (!Array.isArray(cus))
moveCus = [cus]
moveCus = [cus];
else
moveCus = cus;
@ -27,7 +27,7 @@ export async function selectOutlinePosition(cus: Curve[] | Curve)
Callback: v =>
{
let vec = v.clone().sub(moveCus[0].StartPoint);
moveCus.forEach(cu => cu.ApplyMatrix(MoveMatrix(vec)))
moveCus.forEach(cu => cu.ApplyMatrix(MoveMatrix(vec)));
}
});
@ -67,7 +67,7 @@ export async function SelectExtrudeContour(selectInside = false, useExtrude = fa
: Promise<{
contour?: ExtureContour,
gourp?: Curve[][],
useCurves?: Curve[]
useCurves?: Curve[];
}>
{
let Msg = useExtrude ? "请选择(拉伸实体,面域或曲线):" : "请选择(面域或曲线):";

@ -68,9 +68,9 @@ export class DrawSpecialShapedBoard implements Command
if (useCurves)
for (let c of useCurves)
c.Erase();
}
};
}
else
app.Editor.Prompt('选择对象无效')
app.Editor.Prompt('选择对象无效');
}
}

@ -11,7 +11,7 @@ export class DrawSpecialShapedBoardByContour implements Command
let brRes = await app.Editor.GetSelection({
Msg: "请选择应用异形轮廓的板件",
Filter: { filterTypes: [Board] }
})
});
if (brRes.Status === PromptStatus.Cancel)
return;

@ -51,7 +51,7 @@ export class EditorBoardTemplate implements Command
thickness: template.GetParam("BH").value,
spaceSize: template.LParam.value
}
}
};
}
else if (template instanceof TemplateTopBottomBoard)
{
@ -60,7 +60,7 @@ export class EditorBoardTemplate implements Command
config = {
topBoardData: template.TopOption,
bottomBoardData: template.BottomOption,
}
};
}
else return;
@ -93,7 +93,7 @@ export class EditorBoardTemplate implements Command
}
await template.UpdateTemplateTree();
app.Editor.UpdateScreen();
}
};
}
}

@ -87,7 +87,7 @@ export class Command_Draw2LineAngularDim
{
let cenPtRes = await app.Editor.GetPoint({
Msg: "指定角的顶点"
})
});
if (cenPtRes.Status === PromptStatus.Cancel)
return;
cenPt = cenPtRes.Point;
@ -98,7 +98,7 @@ export class Command_Draw2LineAngularDim
Msg: "指定角的第一个端点",
BasePoint: cenPt,
AllowDrawRubberBand: true
})
});
if (ptRes.Status === PromptStatus.Cancel)
return;
p1 = ptRes.Point;
@ -108,7 +108,7 @@ export class Command_Draw2LineAngularDim
Msg: "指定角的第二个端点",
BasePoint: cenPt,
AllowDrawRubberBand: true
})
});
if (ptRes.Status === PromptStatus.Cancel)
return;
let p2 = ptRes.Point;

@ -51,7 +51,7 @@ export class DrawRadiusDim implements Command
{
this.UpdateDim(dim, p, startPt, rad);
}
})
});
if (ptRes.Status === PromptStatus.OK)
{
this.UpdateDim(dim, ptRes.Point, startPt, rad);

@ -38,7 +38,7 @@ export class Command_FastDimBrs implements Command
equaln((TMath.radToDeg(b.Rotation.x) + 90) % (DEG90), 0)
&& equaln((TMath.radToDeg(b.Rotation.y) + 90) % (DEG90), 0)
&& equaln((TMath.radToDeg(b.Rotation.z) + 90) % (DEG90), 0)
))
));
if (brs.length === 0)
{

@ -238,7 +238,7 @@ export class DrawDrillingTool extends Singleton
if (ymjEnt && this.CheckModelingCollision(this.m_Face.m_LocalBoard, ymjEnt, dist))
continue;
//新的排钻列表
let newDrillEnts: ObjectId[] = []
let newDrillEnts: ObjectId[] = [];
for (let d of this.drillEnts)
{
let cloneD = d.Clone();
@ -395,7 +395,7 @@ export class DrawDrillingTool extends Singleton
box.union(d.BoundingBox);
}
return box;
}
};
for (let ds of drills)
{
@ -439,7 +439,7 @@ export class DrawDrillingTool extends Singleton
let br = brs[i];
br.ClearDrillList(undefined);//删除仅与自身关联的排钻
for (let j = i + 1; j < brs.length; j++)
br.ClearDrillList(brs[j].Id)
br.ClearDrillList(brs[j].Id);
}
}
StartGangDrill(brs: Board[])

@ -66,7 +66,7 @@ export class DrawFloor implements Command
if (useRef)
{
floorMat.transparent = true;
floorMat.opacity = 0.9
floorMat.opacity = 0.9;
// let ref = new THREE.Reflector(20, 20, {
// clipBias: 0.003,
@ -95,7 +95,7 @@ export class DrawFloor implements Command
{
m.map = map;
m.needsUpdate = true;
})
});
});
this.textureLoader.load("textures/hardwood2_bump.jpg", function (map)
{
@ -108,7 +108,7 @@ export class DrawFloor implements Command
{
(<THREE.MeshStandardMaterial>m).bumpMap = map;
m.needsUpdate = true;
})
});
});
this.textureLoader.load("textures/hardwood2_roughness.jpg", function (map)
{
@ -121,7 +121,7 @@ export class DrawFloor implements Command
{
(<THREE.MeshStandardMaterial>m).roughnessMap = map;
m.needsUpdate = true;
})
});
});
}
@ -159,7 +159,7 @@ export class DrawFloor implements Command
var delta = clock.getDelta();
bulbLight.position.z = Math.cos(time) * 0.75 + 1.25;
app.Viewer.UpdateRender();
})
});
}
private drawHemiLight()
{

@ -57,7 +57,7 @@ export class DrawLine implements Command
}
}
line.EndPoint = p;
}
};
ptRes = await app.Editor.GetPoint({
Msg: "请输入点2:",

@ -27,7 +27,7 @@ export class DrawPolyline
let plJig = JigUtils.Draw(pl);
let Callback = (p: Vector3) =>
this.UpdatePoint(plJig, p)
this.UpdatePoint(plJig, p);
let firstOps: GetPointPrompt = { Msg: "请输入第一个点:", Callback, AllowNone: true };
let keywords = [{ msg: "圆弧", key: "A" }, { msg: "直线", key: "L" }, { msg: "放弃", key: "U" }];

@ -14,7 +14,7 @@ export class DrawSky implements Command
sky.rotateY(Math.PI);
let mat = sky.material as THREE.ShaderMaterial;
mat.uniforms.sub
mat.uniforms.sub;
window["sky"] = sky;
}
}

@ -42,7 +42,7 @@ export class DrawRegTest implements Command
new Line(new Vector3().fromArray([1.306042884990254, -0.30214424951267027, 0]), new Vector3().fromArray([2.348927875243664, -1.042884990253411, 0])),
new Line(new Vector3().fromArray([3.9668615984405444, -1.042884990253411, 0]), new Vector3().fromArray([3.586744639376219, 0.253411306042885, 0])),
new Line(new Vector3().fromArray([3.586744639376219, 0.253411306042885, 0]), new Vector3().fromArray([2.465886939571151, 1.939571150097466, 0])),
]
];
this.Draw(culist);
}
Test2()
@ -152,7 +152,7 @@ export class DrawRegTest implements Command
new Line(new Vector3().fromArray([14.054086973365617, -5.026969104116221, 0]), new Vector3().fromArray([14.054086973365617, -2.0467060532687644, 0])),
new Line(new Vector3().fromArray([18.54122460048426, -5.026969104116222, 0]), new Vector3().fromArray([19.5123215496368, -5.947836900726394, 0])),
new Line(new Vector3().fromArray([14.054086973365617, -2.0467060532687644, 0]), new Vector3().fromArray([18.54122460048426, -5.026969104116222, 0]))
]
];
this.Draw(culist, new Vector3(0, 0, 0));
}
@ -162,7 +162,7 @@ export class DrawRegTest implements Command
if (v)
{
let m = MoveMatrix(v);
culist.forEach(l => { l.ApplyMatrix(m) })
culist.forEach(l => { l.ApplyMatrix(m); });
}
for (let e of culist)
@ -207,6 +207,6 @@ function createReg(r: Set<Route>)
{
let cus: Curve[] = [];
r.forEach(route => cus.push(route.curve.Clone() as Curve));
let re = Region.CreateFromCurves(cus)
let re = Region.CreateFromCurves(cus);
app.Database.ModelSpace.Append(re);
}

@ -94,7 +94,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
{
let lWRData: IWineRackData[] = [];
let rWRData: IWineRackData[] = [];
let res: { width: number, height: number };
let res: { width: number, height: number; };
switch (config.arrayType)
{
case EWRackArrayType.ByWidth:
@ -120,7 +120,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
}
else
return d2.basePt.x - d1.basePt.x;
})
});
for (let data of rWRData)
{
@ -214,7 +214,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
this.GetWineRackData(width, height, gripWidth, Config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
return {
width: width, height: height
}
};
}
private CalcWineRackDataByCount(lWRDataList: IWineRackData[], rWRDataList: IWineRackData[])
{
@ -250,7 +250,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
this.GetWineRackData(width, height, gripWidth, config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
return {
width: width, height: height
}
};
}
CalcWineRackDataByFixed(lWRDataList: IWineRackData[], rWRDataList: IWineRackData[])
{
@ -264,7 +264,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
this.GetWineRackData(width, height, gripWidth, config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
return {
width: width, height: height
}
};
}
/**构建酒格正面多段线组*/
CalculationRectPolylineArr(ptMid: Vector3, rectPl: Polyline, gripWidth: number)
@ -323,7 +323,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
return {
pt: AsVector2(p),
bul: 0
}
};
});
let pl = new Polyline(lineData);
pl.CloseMark = true;
@ -497,14 +497,14 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
pt: new Vector2(0, data.brLength),
bul: 0
},
]
];
let pl = new Polyline(lineData);
pl.CloseMark = true;
let mat = MoveMatrix(new Vector3(thick))
.multiply(new Matrix4().makeRotationZ(0.25 * Math.PI * (isLeft ? 1 : -1)))
.multiply(MoveMatrix(new Vector3(-thick)));
pl.ApplyMatrix(mat)
.ApplyMatrix(MoveMatrix(data.basePt.add(new Vector3(-thick))))
.ApplyMatrix(MoveMatrix(data.basePt.add(new Vector3(-thick))));
return pl;
}
/**根据多段线组构建酒格 */
@ -574,7 +574,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
length,
matInv,
basePt: new Vector3(pts[0].x, 0, pts[0].y),
}
};
}
else if (equaln(an, 3 * Math.PI / 4))
{
@ -586,7 +586,7 @@ export class DrawObliqueWineRackTool extends DrawWineRackTool
length,
matInv,
basePt: new Vector3(pts[0].x, 0, pts[0].y),
}
};
}
else
{

@ -144,7 +144,7 @@ export class DrawUprightWineRackTool extends DrawWineRackTool
{
initPts.push(
...[p1, p2, p3, p4].map(p => p.clone().add(new Vector3(0, (config.gripWidth + br.Thickness) * (i - 1))))
)
);
}
initPts.reverse();
let cu = br.ContourCurve as Polyline;
@ -163,7 +163,7 @@ export class DrawUprightWineRackTool extends DrawWineRackTool
{
initPts.push(
...[p1, p2, p3, p4].map(p => p.clone().add(new Vector3(0, (gripHeight + br.Thickness) * (i - 1))))
)
);
}
let cu = br.ContourCurve as Polyline;
cu.AddVertexAt(2, initPts.map(p => AsVector2(p)));

@ -113,7 +113,7 @@ export class DrawWineRackTool extends Singleton
else
{
length += config.leftCut;
position.add(new Vector3(actWidth, -config.frontCut, actHeight + config.topCut))
position.add(new Vector3(actWidth, -config.frontCut, actHeight + config.topCut));
}
}
else

@ -12,7 +12,7 @@ interface ErpViewProp
{
erpRoute: ErpRouteInfo;
session: string;
cadData: { blockList: OrderDataBlock[], objectList: OrderDataObject[] };
cadData: { blockList: OrderDataBlock[], objectList: OrderDataObject[]; };
store: BoardStore;
}
export class ErpView extends React.Component<ErpViewProp, {}> {
@ -36,7 +36,7 @@ export class ErpView extends React.Component<ErpViewProp, {}> {
channel.port1.onmessage = (e: MessageEvent) =>
{
let data = e.data;
let result: { blockList: OrderDataBlock[], objectList: OrderDataObject[] };
let result: { blockList: OrderDataBlock[], objectList: OrderDataObject[]; };
switch (data.command)
{
case "created":
@ -49,7 +49,7 @@ export class ErpView extends React.Component<ErpViewProp, {}> {
break;
}
};
}
};
iframeLoaded = () =>
{
switch (this.props.erpRoute.RouteType)
@ -64,8 +64,8 @@ export class ErpView extends React.Component<ErpViewProp, {}> {
this.postMessage("showSingle", this.props.session);
break;
}
window.addEventListener('message', this.closeEvent)
}
window.addEventListener('message', this.closeEvent);
};
private closeEvent = (ev) =>
{
switch (ev.data.command)
@ -74,7 +74,7 @@ export class ErpView extends React.Component<ErpViewProp, {}> {
this.props.store.OnOk(ModalState.Cancel);
break;
}
}
};
render()
{
let erpUrl = ErpURL.host + "/#/" + this.props.erpRoute.RouteName;

@ -1,39 +1,39 @@
export class OrderDataObject
{
Name: string;
ObjectID: number;
ObjectType: string;
Model: string;
Spec: string;
Brand: string;
Factory: string;
Units: string;
CostPrice: number;
SalePrice: number;
Name: string;
ObjectID: number;
ObjectType: string;
Model: string;
Spec: string;
Brand: string;
Factory: string;
Units: string;
CostPrice: number;
SalePrice: number;
ModuleTypeName: string;
//所属模块
ModuleName: string;
ModuleID: number;
//所属房间模块
RoomName: string;
//所属柜体模块
BoxName: string;
ProcessGroup: string;
tempModuleID = 0;
tempModuleType = "";
ObjectNum: number;
ObjectCount: number;
CompositeStatus = 1;
ModuleWidth = 0;
ModuleHeight = 0;
ModuleDepth = 0;
ObjIDs: ObjectObjIds;
ModuleTypeName: string;
//所属模块
ModuleName: string;
ModuleID: number;
//所属房间模块
RoomName: string;
//所属柜体模块
BoxName: string;
ProcessGroup: string;
tempModuleID = 0;
tempModuleType = "";
ObjectNum: number;
ObjectCount: number;
CompositeStatus = 1;
ModuleWidth = 0;
ModuleHeight = 0;
ModuleDepth = 0;
ObjIDs: ObjectObjIds;
}
export class ObjectObjIds
{
ObjectID: number;
OID: string;
ObjIDs: string;
ObjectID: number;
OID: string;
ObjIDs: string;
}

@ -22,7 +22,7 @@ enum FrontOrSide
}
export class ErpParseData
{
FetchData(entityList: Entity[]): { blockList: OrderDataBlock[]; objectList: OrderDataObject[] }
FetchData(entityList: Entity[]): { blockList: OrderDataBlock[]; objectList: OrderDataObject[]; }
{
let blockList: OrderDataBlock[] = [];
let objectList: OrderDataObject[] = [];
@ -445,7 +445,7 @@ export class ErpParseData
return [b.L, b.W, b.H, b.CabName, b.BoardName, this.GetBasePositionArray(b.BasePoint), this.GetBasePositionArray(b.XVec), this.GetBasePositionArray(b.YVec), this.GetBasePositionArray(b.ZVec), b.Grain, this.GetVec2ListArray(b.Pts), b.Buls, this.GetCadModelArray(b.SubBoardLocal), this.GetCadModelArray(b.SubBoardAssoc), this.GetDrillingsListArray(b.Drillings)];
});
}
GetCadData(entityList: Entity[]): { blockList: OrderDataBlock[]; objectList: OrderDataObject[] }
GetCadData(entityList: Entity[]): { blockList: OrderDataBlock[]; objectList: OrderDataObject[]; }
{
return this.FetchData(entityList);
}

@ -48,7 +48,7 @@ export class Command_Extend implements Command
filterTypes: [Curve],
filterErase: true
},
Callback: (entss) => { this.DynmicExtend(entss, exRefCus) }
Callback: (entss) => { this.DynmicExtend(entss, exRefCus); }
});
if (exSs.Status !== PromptStatus.OK)
@ -126,7 +126,7 @@ export class Command_Extend implements Command
}
}
return param;
})
});
}
//过滤掉无效的交点

@ -75,7 +75,7 @@ export class CommandFillet implements Command
JigUtils.Draw(fres.cu2);
}
app.Editor.UpdateScreen();
}
};
let keydownUpdateRadius = (e: KeyboardEvent) =>
{
if (enRes2 && e.code === KeyCode.ShiftLeft)
@ -86,7 +86,7 @@ export class CommandFillet implements Command
this.m_FilletUtils.FilletRadius = this.m_FilletRadius;
jigCallBack(enRes2);
}
}
};
let rm1 = end(app.Editor.KeyCtrl, app.Editor.KeyCtrl.OnKeyDown, keydownUpdateRadius);
let rm2 = end(app.Editor.KeyCtrl, app.Editor.KeyCtrl.OnKeyUp, keydownUpdateRadius);

@ -85,7 +85,7 @@ export interface FilletRes
arc?: Arc;
}
type CurveExtend = { Curve: Curve, ExtType: ExtendType };
type CurveExtend = { Curve: Curve, ExtType: ExtendType; };
export class FilletUtils
{
@ -512,7 +512,7 @@ export class FilletUtils
let dis = Infinity;
for (let p of pts)
{
let d = p.distanceTo(target)
let d = p.distanceTo(target);
if (d < dis)
{
res = p;
@ -536,7 +536,7 @@ export class FilletUtils
if (ipts.length > 2)//超过2个则有可能有多余交点
//找最近点
ipts = [this.FindNearestPt(ipts, brResPt), this.FindNearestPt(ipts, ptResPt)]
ipts = [this.FindNearestPt(ipts, brResPt), this.FindNearestPt(ipts, ptResPt)];
if (ipts.length !== 2)
return "倒角失败!交点个数异常.";
@ -696,12 +696,12 @@ export class FilletUtils
if (equalv3(a1Derv, narcDerv0))
a1Clone.EndPoint = narcP1;
else
a1Clone.StartPoint = narcP1
a1Clone.StartPoint = narcP1;
if (equalv3(a2Derv, narcDerv1))
a2Clone.StartPoint = narcP2;
else
a2Clone.EndPoint = narcP2
a2Clone.EndPoint = narcP2;
return {
cu1: a1Clone,
@ -785,13 +785,13 @@ export class FilletUtils
cu1: lineClone,
cu2: arcClone,
arc: narc
}
};
else
return {
cu1: arcClone,
cu2: lineClone,
arc: narc
}
};
}
//获得两曲线的交点,并且排序交点.

@ -49,7 +49,7 @@ export async function Gesture_DrawLayerBoard(dirs: GestureDir[], path: Vector2[]
br.ApplyMatrix(spaceParse.SpaceOCS);
commandMachine.CommandStart("gs")
commandMachine.CommandStart("gs");
app.Database.ModelSpace.Append(br);
app.Editor.UpdateScreen();

@ -99,7 +99,7 @@ export class Command_Join implements Command
if (typeName === "Line")
this.InitLineKbMap(curveCol, kbMap);
else if (typeName === "Arc")
this.InitArcKbMap(curveCol, kbMap)
this.InitArcKbMap(curveCol, kbMap);
}
private JoinCurve(typeName: string, kbMap: Map<string, Curve[]>)
{

@ -72,7 +72,7 @@ interface KJL_ParamModel_Board extends KJL_ParamModel
points: Vec2[];
paramPlankPath: {
path: KJL_Path,
holes: KJL_Path[]
holes: KJL_Path[];
};
}
@ -92,7 +92,7 @@ interface KJL_JsonFile
class FuzzPoint
{
private map: { [key: string]: Vec2 } = {};
private map: { [key: string]: Vec2; } = {};
GetVector(v: Vec2)
{
let key = `${ToFixed(v.x, 2)},${ToFixed(v.y, 2)}`;

@ -169,7 +169,7 @@ export class DrawLatticeDrawerTool extends Singleton
{
initPts.push(
...[p1, p2, p3, p4].map(p => p.clone().add(new Vector3(-(config.gripWidth + br.Thickness) * (i - 1))))
)
);
}
let cu = br.ContourCurve as Polyline;
cu.AddVertexAt(cu.EndParam - 1, initPts.map(p => AsVector2(p)));
@ -187,7 +187,7 @@ export class DrawLatticeDrawerTool extends Singleton
{
initPts.push(
...[p1, p2, p3, p4].map(p => p.clone().add(new Vector3((config.gripDepth + br.Thickness) * (i - 1))))
)
);
}
let cu = br.ContourCurve as Polyline;
cu.AddVertexAt(1, initPts.map(p => AsVector2(p)));

@ -31,7 +31,7 @@ export class Command_Lisp
)
)
)
`
`;
let str = fun + "(cx-make-pline '(";
@ -41,8 +41,8 @@ export class Command_Lisp
let p3 = new Vector3(p.x, p.y);
p3.applyMatrix4(ocs);
p.set(p3.x, p3.y);
})
pts.forEach(p => str += `(${p.x} ${p.y})`)
});
pts.forEach(p => str += `(${p.x} ${p.y})`);
str += ") '(";
buls.forEach(b => str += `${b} `);
str += `)`;

@ -10,7 +10,7 @@ import { PromptStatus } from '../Editor/PromptResult';
const OffsetKey = "offset";
//获取偏移距离的返回状态.
type GetOffsetStatus = { Status: PromptStatus, offsetDist?: number };
type GetOffsetStatus = { Status: PromptStatus, offsetDist?: number; };
//曲线偏移
export class Command_Offset implements Command
@ -112,7 +112,7 @@ export class Command_Offset implements Command
{
JigUtils.Destroy();
let offCus = cu.GetOffsetCurves(this.offsetDis * dir);
offCus.forEach(c => { JigUtils.Draw(c) });
offCus.forEach(c => { JigUtils.Draw(c); });
oldDir = dir;
}
}

@ -66,7 +66,7 @@ export class Command_Rotate implements Command
if (newAnRes.Status === PromptStatus.Cancel)
break;
refAng = newAnRes.Distance;
keyword = [{ msg: "点", key: "P" }]
keyword = [{ msg: "点", key: "P" }];
msg = "请输入新角度";
}
else if (anRes.StringResult === "P")

@ -98,7 +98,7 @@ export class RotateLayerBoard implements Command
.multiply(this.currentBoard.OCSInv),
OCS: this.currentBoard.OCS,
position: this.currentBoard.Position,
}
};
this.HandleLayerBoard(newTotalWidth - frontDist - backDist, oldBrData);
//修正层板钉
@ -124,7 +124,7 @@ export class RotateLayerBoard implements Command
.multiply(this.currentBoard.OCSInv),
OCS: this.currentBoard.OCS,
position: this.currentBoard.Position
}
};
this.HandleLayerBoard(length, oldBrData);
//修正层板钉
this.RotateNails(angle, length, oldBrData);
@ -285,7 +285,7 @@ export class RotateLayerBoard implements Command
}
return {
frontDist, backDist, count, backNails, leftNails, rightNails
}
};
}
/**重新计算排钻 */
private RotateDrillList()
@ -303,7 +303,7 @@ export class RotateLayerBoard implements Command
//当目标板为背板或者立板得排钻连接杆法向量和层板y轴不平行,或者都是层板法向量不平行,直接清理掉排钻
let isClear = b.BoardType === BoardType.Behind ||
(b.BoardType === BoardType.Vertical && !isParallelTo(firstD.Normal, brY)) ||
(b.BoardType === BoardType.Layer && !isParallelTo(b.Normal, this.currentBoard.Normal))
(b.BoardType === BoardType.Layer && !isParallelTo(b.Normal, this.currentBoard.Normal));
if (isClear)
this.currentBoard.ClearDrillList(brId);

@ -25,7 +25,7 @@ export class Command_Scale implements Command
let jigEns = allEns.map(e =>
{
allBox.union(e.BoundingBox);
return JigUtils.Draw(e)
return JigUtils.Draw(e);
});
let maxSize = Math.max(...allBox.getSize(new Vector3()).toArray());
let isCopy = false;

@ -27,7 +27,7 @@ export class Sky extends THREE.Mesh
vertexShader: SkyShader.vertexShader,
uniforms: THREE.UniformsUtils.clone(SkyShader.uniforms),
side: THREE.BackSide
})
});
this.material.needsUpdate = true;
}
@ -39,199 +39,199 @@ export class Sky extends THREE.Mesh
}
const SkyShader =
{
uniforms: {
luminance: { value: 1 },
turbidity: { value: 2 },
rayleigh: { value: 1 },
mieCoefficient: { value: 0.005 },
mieDirectionalG: { value: 0.8 },
sunPosition: { value: new THREE.Vector3(0, 50, 20) }
},
vertexShader: [
'uniform vec3 sunPosition;',
'uniform float rayleigh;',
'uniform float turbidity;',
'uniform float mieCoefficient;',
'varying vec3 vWorldPosition;',
'varying vec3 vSunDirection;',
'varying float vSunfade;',
'varying vec3 vBetaR;',
'varying vec3 vBetaM;',
'varying float vSunE;',
'const vec3 up = vec3( 0.0, 0.0, 1.0 );',
// constants for atmospheric scattering
'const float e = 2.71828182845904523536028747135266249775724709369995957;',
'const float pi = 3.141592653589793238462643383279502884197169;',
// wavelength of used primaries, according to preetham
'const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );',
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
'const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );',
// mie stuff
// K coefficient for the primaries
'const float v = 4.0;',
'const vec3 K = vec3( 0.686, 0.678, 0.666 );',
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
'const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );',
// earth shadow hack
// cutoffAngle = pi / 1.95;
'const float cutoffAngle = 1.6110731556870734;',
'const float steepness = 1.5;',
'const float EE = 1000.0;',
'float sunIntensity( float zenithAngleCos ) {',
' zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );',
' return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );',
'}',
'vec3 totalMie( float T ) {',
' float c = ( 0.2 * T ) * 10E-18;',
' return 0.434 * c * MieConst;',
'}',
'void main() {',
' vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',
' vWorldPosition = worldPosition.xyz;',
' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
' vSunDirection = normalize( sunPosition );',
' vSunE = sunIntensity( dot( vSunDirection, up ) );',
' vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );',
' float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );',
// extinction (absorbtion + out scattering)
// rayleigh coefficients
' vBetaR = totalRayleigh * rayleighCoefficient;',
// mie coefficients
' vBetaM = totalMie( turbidity ) * mieCoefficient;',
'}'
].join('\n'),
{
uniforms: {
luminance: { value: 1 },
turbidity: { value: 2 },
rayleigh: { value: 1 },
mieCoefficient: { value: 0.005 },
mieDirectionalG: { value: 0.8 },
sunPosition: { value: new THREE.Vector3(0, 50, 20) }
},
vertexShader: [
'uniform vec3 sunPosition;',
'uniform float rayleigh;',
'uniform float turbidity;',
'uniform float mieCoefficient;',
'varying vec3 vWorldPosition;',
'varying vec3 vSunDirection;',
'varying float vSunfade;',
'varying vec3 vBetaR;',
'varying vec3 vBetaM;',
'varying float vSunE;',
'const vec3 up = vec3( 0.0, 0.0, 1.0 );',
// constants for atmospheric scattering
'const float e = 2.71828182845904523536028747135266249775724709369995957;',
'const float pi = 3.141592653589793238462643383279502884197169;',
// wavelength of used primaries, according to preetham
'const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );',
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
'const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );',
// mie stuff
// K coefficient for the primaries
'const float v = 4.0;',
'const vec3 K = vec3( 0.686, 0.678, 0.666 );',
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
'const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );',
// earth shadow hack
// cutoffAngle = pi / 1.95;
'const float cutoffAngle = 1.6110731556870734;',
'const float steepness = 1.5;',
'const float EE = 1000.0;',
'float sunIntensity( float zenithAngleCos ) {',
' zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );',
' return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );',
'}',
'vec3 totalMie( float T ) {',
' float c = ( 0.2 * T ) * 10E-18;',
' return 0.434 * c * MieConst;',
'}',
'void main() {',
' vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',
' vWorldPosition = worldPosition.xyz;',
' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
' vSunDirection = normalize( sunPosition );',
' vSunE = sunIntensity( dot( vSunDirection, up ) );',
' vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );',
' float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );',
// extinction (absorbtion + out scattering)
// rayleigh coefficients
' vBetaR = totalRayleigh * rayleighCoefficient;',
// mie coefficients
' vBetaM = totalMie( turbidity ) * mieCoefficient;',
'}'
].join('\n'),
fragmentShader: [
'varying vec3 vWorldPosition;',
'varying vec3 vSunDirection;',
'varying float vSunfade;',
'varying vec3 vBetaR;',
'varying vec3 vBetaM;',
'varying float vSunE;',
fragmentShader: [
'varying vec3 vWorldPosition;',
'varying vec3 vSunDirection;',
'varying float vSunfade;',
'varying vec3 vBetaR;',
'varying vec3 vBetaM;',
'varying float vSunE;',
'uniform float luminance;',
'uniform float mieDirectionalG;',
'uniform float luminance;',
'uniform float mieDirectionalG;',
'const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );',
'const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );',
// constants for atmospheric scattering
'const float pi = 3.141592653589793238462643383279502884197169;',
// constants for atmospheric scattering
'const float pi = 3.141592653589793238462643383279502884197169;',
'const float n = 1.0003;', // refractive index of air
'const float N = 2.545E25;', // number of molecules per unit volume for air at
// 288.15K and 1013mb (sea level -45 celsius)
'const float n = 1.0003;', // refractive index of air
'const float N = 2.545E25;', // number of molecules per unit volume for air at
// 288.15K and 1013mb (sea level -45 celsius)
// optical length at zenith for molecules
'const float rayleighZenithLength = 8.4E3;',
'const float mieZenithLength = 1.25E3;',
'const vec3 up = vec3( 0.0, 0.0, 1.0 );',
// 66 arc seconds -> degrees, and the cosine of that
'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',
// optical length at zenith for molecules
'const float rayleighZenithLength = 8.4E3;',
'const float mieZenithLength = 1.25E3;',
'const vec3 up = vec3( 0.0, 0.0, 1.0 );',
// 66 arc seconds -> degrees, and the cosine of that
'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',
// 3.0 / ( 16.0 * pi )
'const float THREE_OVER_SIXTEENPI = 0.05968310365946075;',
// 1.0 / ( 4.0 * pi )
'const float ONE_OVER_FOURPI = 0.07957747154594767;',
// 3.0 / ( 16.0 * pi )
'const float THREE_OVER_SIXTEENPI = 0.05968310365946075;',
// 1.0 / ( 4.0 * pi )
'const float ONE_OVER_FOURPI = 0.07957747154594767;',
'float rayleighPhase( float cosTheta ) {',
' return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );',
'}',
'float rayleighPhase( float cosTheta ) {',
' return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );',
'}',
'float hgPhase( float cosTheta, float g ) {',
' float g2 = pow( g, 2.0 );',
' float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );',
' return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );',
'}',
'float hgPhase( float cosTheta, float g ) {',
' float g2 = pow( g, 2.0 );',
' float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );',
' return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );',
'}',
// Filmic ToneMapping http://filmicgames.com/archives/75
'const float A = 0.15;',
'const float B = 0.50;',
'const float C = 0.10;',
'const float D = 0.20;',
'const float E = 0.02;',
'const float F = 0.30;',
// Filmic ToneMapping http://filmicgames.com/archives/75
'const float A = 0.15;',
'const float B = 0.50;',
'const float C = 0.10;',
'const float D = 0.20;',
'const float E = 0.02;',
'const float F = 0.30;',
'const float whiteScale = 1.0748724675633854;', // 1.0 / Uncharted2Tonemap(1000.0)
'const float whiteScale = 1.0748724675633854;', // 1.0 / Uncharted2Tonemap(1000.0)
'vec3 Uncharted2Tonemap( vec3 x ) {',
' return ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;',
'}',
'vec3 Uncharted2Tonemap( vec3 x ) {',
' return ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;',
'}',
'void main() {',
// optical length
// cutoff angle at 90 to avoid singularity in next formula.
' float zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );',
' float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );',
' float sR = rayleighZenithLength * inverse;',
' float sM = mieZenithLength * inverse;',
'void main() {',
// optical length
// cutoff angle at 90 to avoid singularity in next formula.
' float zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );',
' float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );',
' float sR = rayleighZenithLength * inverse;',
' float sM = mieZenithLength * inverse;',
// combined extinction factor
' vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );',
// combined extinction factor
' vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );',
// in scattering
' float cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );',
// in scattering
' float cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );',
' float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );',
' vec3 betaRTheta = vBetaR * rPhase;',
' float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );',
' vec3 betaRTheta = vBetaR * rPhase;',
' float mPhase = hgPhase( cosTheta, mieDirectionalG );',
' vec3 betaMTheta = vBetaM * mPhase;',
' float mPhase = hgPhase( cosTheta, mieDirectionalG );',
' vec3 betaMTheta = vBetaM * mPhase;',
' vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );',
' Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );',
' vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );',
' Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );',
// nightsky
' vec3 direction = normalize( vWorldPosition - cameraPos );',
' float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]',
' float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]',
' vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );',
' vec3 L0 = vec3( 0.1 ) * Fex;',
// nightsky
' vec3 direction = normalize( vWorldPosition - cameraPos );',
' float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]',
' float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]',
' vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );',
' vec3 L0 = vec3( 0.1 ) * Fex;',
// composition + solar disc
' float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );',
' L0 += ( vSunE * 19000.0 * Fex ) * sundisk;',
// composition + solar disc
' float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );',
' L0 += ( vSunE * 19000.0 * Fex ) * sundisk;',
' vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );',
' vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );',
' vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );',
' vec3 color = curr * whiteScale;',
' vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );',
' vec3 color = curr * whiteScale;',
' vec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );',
' vec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );',
' gl_FragColor = vec4( retColor, 1.0 );',
' gl_FragColor = vec4( retColor, 1.0 );',
'}'
].join('\n')
'}'
].join('\n')
};
};
type SkyUniforms = {
luminance: { value: 1 },
turbidity: { value: 2 },
rayleigh: { value: 1 },
mieCoefficient: { value: 0.005 },
mieDirectionalG: { value: 0.8 },
sunPosition: { value: THREE.Vector3 }
}
luminance: { value: 1; },
turbidity: { value: 2; },
rayleigh: { value: 1; },
mieCoefficient: { value: 0.005; },
mieDirectionalG: { value: 0.8; },
sunPosition: { value: THREE.Vector3; };
};

@ -64,7 +64,7 @@ export class TemplateSearchDialog extends React.Component<{}, {}>{
app.Editor.MaskManage.ShowMask();
}
}, "购买模块并插入");
}
};
componentDidMount()
{
@ -115,5 +115,5 @@ export class TemplateSearchDialog extends React.Component<{}, {}>{
{
this.isMax = !this.isMax;
app.Editor.ModalManage.ScaleModalSize();
}
};
}

@ -41,7 +41,7 @@ export class TestFb implements Command
let ptRes = await app.Editor.GetPoint({
Msg: "选择放置位置"
})
});
if (ptRes.Status === PromptStatus.OK)
{

@ -32,6 +32,6 @@ export class Command_Wblock implements Command
fileServer.UploadFile({
file: deflate(JSON.stringify(f))
})
});
}
}

@ -65,7 +65,7 @@ export class Command_ClosePt implements Command
closeCir.ColorIndex = GetPointAtCurveDir(cu, p) + 3;
}
}
})
});
if (p.Status === PromptStatus.Keyword)
{
extend = !extend;

@ -1,769 +0,0 @@
export var data =
{
"Tree": [
{
"Name": "",
"BoardId": [
"288",
"28B",
"28C",
"28E",
"290",
"291",
"293",
"295"
],
"SpaceList": []
}
],
"Data": {
"cxDbBoard": [
{
"L": 100.0,
"W": 800.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2076.407626150509,
"y": 1942.2104819571228,
"z": 1882.0
},
"XVec": {
"x": 1.0,
"y": 4.930380657631324e-32,
"z": -2.220446049250313e-16
},
"YVec": {
"x": 2.220446049250313e-16,
"y": 2.220446049250313e-16,
"z": 1.0
},
"ZVec": {
"x": 9.860761315262648e-32,
"y": -1.0,
"z": 2.220446049250313e-16
},
"Handle": "295",
"CabName": "1.标准柜上梁1",
"BoardName": "",
"Grain": 0,
"Pts": [
{
"x": 2076.407626150509,
"y": 1942.2104819571228,
"z": 1882.0
},
{
"x": 2876.407626150509,
"y": 1942.2104819571228,
"z": 1881.9999999999998
},
{
"x": 2876.407626150509,
"y": 1942.2104819571228,
"z": 1981.9999999999998
},
{
"x": 2076.407626150509,
"y": 1942.2104819571228,
"z": 1982.0
},
{
"x": 2076.407626150509,
"y": 1942.2104819571228,
"z": 1882.0
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 800.0,
"W": 100.00000000000068,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2876.407626150509,
"y": 1960.2104819571226,
"z": 1900.0000000000005
},
"XVec": {
"x": 4.440892098500626e-16,
"y": 1.0,
"z": 2.2204460492503124e-16
},
"YVec": {
"x": -1.0,
"y": 4.440892098500626e-16,
"z": 2.220446049250314e-16
},
"ZVec": {
"x": 2.220446049250313e-16,
"y": -2.220446049250313e-16,
"z": 1.0
},
"Handle": "293",
"CabName": "1.标准柜上梁1",
"BoardName": "",
"Grain": 0,
"Pts": [
{
"x": 2876.407626150509,
"y": 1960.2104819571228,
"z": 1900.0000000000005
},
{
"x": 2876.407626150509,
"y": 2060.210481957123,
"z": 1900.0000000000005
},
{
"x": 2076.407626150509,
"y": 2060.210481957123,
"z": 1900.0000000000005
},
{
"x": 2076.407626150509,
"y": 1960.210481957123,
"z": 1900.0000000000005
},
{
"x": 2876.407626150509,
"y": 1960.2104819571228,
"z": 1900.0000000000005
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 1899.9999999999998,
"W": 800.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2076.407626150509,
"y": 2060.2104819571225,
"z": -1.816324868286756e-13
},
"XVec": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"YVec": {
"x": 0.0,
"y": 4.440892098500626e-16,
"z": 1.0
},
"ZVec": {
"x": 0.0,
"y": -1.0,
"z": 4.440892098500626e-16
},
"Handle": "291",
"CabName": "1.标准柜上梁1",
"BoardName": "背板",
"Grain": 0,
"Pts": [
{
"x": 2076.407626150509,
"y": 2060.2104819571225,
"z": -1.021405182655144e-13
},
{
"x": 2876.407626150509,
"y": 2060.2104819571225,
"z": -1.816324868286756e-13
},
{
"x": 2876.407626150509,
"y": 2060.210481957123,
"z": 1899.9999999999996
},
{
"x": 2076.407626150509,
"y": 2060.210481957123,
"z": 1899.9999999999998
},
{
"x": 2076.407626150509,
"y": 2060.2104819571225,
"z": -1.021405182655144e-13
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 800.0,
"W": 482.0000000000002,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2876.407626150509,
"y": 1578.210481957122,
"z": 97.99999999999999
},
"XVec": {
"x": 4.440892098500626e-16,
"y": 1.0,
"z": 0.0
},
"YVec": {
"x": -1.0,
"y": 4.440892098500626e-16,
"z": 0.0
},
"ZVec": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"Handle": "290",
"CabName": "1.标准柜上梁1",
"BoardName": "底板",
"Grain": 0,
"Pts": [
{
"x": 2876.407626150509,
"y": 1578.210481957122,
"z": 97.99999999999999
},
{
"x": 2876.407626150509,
"y": 2060.2104819571225,
"z": 97.99999999999999
},
{
"x": 2076.407626150509,
"y": 2060.2104819571225,
"z": 97.99999999999999
},
{
"x": 2076.407626150509,
"y": 1578.2104819571226,
"z": 97.99999999999999
},
{
"x": 2876.407626150509,
"y": 1578.210481957122,
"z": 97.99999999999999
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 80.0,
"W": 800.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2076.407626150509,
"y": 1578.2104819571223,
"z": 0.0
},
"XVec": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"YVec": {
"x": 0.0,
"y": 4.440892098500626e-16,
"z": 1.0
},
"ZVec": {
"x": 0.0,
"y": -1.0,
"z": 4.440892098500626e-16
},
"Handle": "28E",
"CabName": "1.标准柜上梁1",
"BoardName": "地脚线",
"Grain": 1,
"Pts": [
{
"x": 2076.407626150509,
"y": 1578.2104819571223,
"z": 0.0
},
{
"x": 2876.407626150509,
"y": 1578.2104819571223,
"z": 0.0
},
{
"x": 2876.407626150509,
"y": 1578.2104819571223,
"z": 80.0
},
{
"x": 2076.407626150509,
"y": 1578.2104819571223,
"z": 80.0
},
{
"x": 2076.407626150509,
"y": 1578.2104819571223,
"z": 0.0
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 800.0,
"W": 482.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2876.4076261505085,
"y": 1478.210481957122,
"z": 1999.9999999999996
},
"XVec": {
"x": 4.440892098500626e-16,
"y": 1.0,
"z": 0.0
},
"YVec": {
"x": -1.0,
"y": 4.440892098500626e-16,
"z": 0.0
},
"ZVec": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"Handle": "28C",
"CabName": "1.标准柜上梁1",
"BoardName": "顶板",
"Grain": 0,
"Pts": [
{
"x": 2076.407626150509,
"y": 1960.2104819571223,
"z": 1999.9999999999996
},
{
"x": 2076.407626150509,
"y": 1478.2104819571226,
"z": 1999.9999999999996
},
{
"x": 2876.407626150509,
"y": 1478.210481957122,
"z": 1999.9999999999996
},
{
"x": 2876.4076261505085,
"y": 1960.210481957122,
"z": 1999.9999999999996
},
{
"x": 2076.407626150509,
"y": 1960.2104819571223,
"z": 1999.9999999999996
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 1999.9999999999996,
"W": 600.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2894.4076261505094,
"y": 1478.2104819571223,
"z": -2.2737367544323197e-13
},
"XVec": {
"x": 4.930380657631324e-32,
"y": 1.0,
"z": -2.220446049250313e-16
},
"YVec": {
"x": -2.220446049250313e-16,
"y": 2.220446049250313e-16,
"z": 1.0
},
"ZVec": {
"x": 1.0,
"y": 0.0,
"z": 2.220446049250313e-16
},
"Handle": "28B",
"CabName": "1.标准柜上梁1",
"BoardName": "右侧板",
"Grain": 0,
"Pts": [
{
"x": 2894.407626150509,
"y": 1960.2104819571228,
"z": 1899.9999999999989
},
{
"x": 2894.407626150509,
"y": 1960.2104819571228,
"z": 1999.9999999999994
},
{
"x": 2894.407626150509,
"y": 1478.2104819571228,
"z": 1999.9999999999994
},
{
"x": 2894.4076261505094,
"y": 1478.2104819571223,
"z": -1.816324868286755e-13
},
{
"x": 2894.4076261505094,
"y": 2078.2104819571225,
"z": -6.274980535181384e-13
},
{
"x": 2894.407626150509,
"y": 2078.2104819571229,
"z": 1899.9999999999973
},
{
"x": 2894.407626150509,
"y": 1960.2104819571228,
"z": 1899.9999999999989
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
},
{
"L": 1999.9999999999996,
"W": 600.0,
"H": 18.0,
"MaterialId": "EE",
"BasePoint": {
"x": 2076.4076261505094,
"y": 1478.2104819571223,
"z": 1.0097419586828951e-28
},
"XVec": {
"x": 4.930380657631324e-32,
"y": 1.0,
"z": -2.220446049250313e-16
},
"YVec": {
"x": -2.220446049250313e-16,
"y": 2.220446049250313e-16,
"z": 1.0
},
"ZVec": {
"x": 1.0,
"y": 0.0,
"z": 2.220446049250313e-16
},
"Handle": "288",
"CabName": "1.标准柜上梁1",
"BoardName": "左侧板",
"Grain": 0,
"Pts": [
{
"x": 2076.407626150509,
"y": 1960.2104819571228,
"z": 1899.999999999999
},
{
"x": 2076.407626150509,
"y": 1960.2104819571228,
"z": 1999.9999999999996
},
{
"x": 2076.407626150509,
"y": 1478.2104819571228,
"z": 1999.9999999999996
},
{
"x": 2076.4076261505094,
"y": 1478.2104819571223,
"z": 1.0097419586828951e-28
},
{
"x": 2076.4076261505094,
"y": 2078.2104819571225,
"z": -4.4586556668946279e-13
},
{
"x": 2076.407626150509,
"y": 2078.2104819571229,
"z": 1899.9999999999978
},
{
"x": 2076.407626150509,
"y": 1960.2104819571228,
"z": 1899.999999999999
}
],
"Buls": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"SubBoardLocal": [],
"SubBoardAssoc": []
}
]
},
"Pts": [
[
{
"x": 0.0,
"y": 0.0
},
{
"x": 800.0,
"y": 0.0
},
{
"x": 800.0,
"y": 100.0
},
{
"x": 0.0,
"y": 100.0
},
{
"x": 0.0,
"y": 0.0
}
],
[
{
"x": 2.2737367544323208e-13,
"y": 0.0
},
{
"x": 100.00000000000068,
"y": 0.0
},
{
"x": 100.00000000000023,
"y": 800.0
},
{
"x": 0.0,
"y": 800.0
},
{
"x": 2.2737367544323208e-13,
"y": 0.0
}
],
[
{
"x": 7.246646173752609e-60,
"y": 7.949196856316121e-14
},
{
"x": 800.0,
"y": 7.292959331351526e-44
},
{
"x": 800.0,
"y": 1899.9999999999998
},
{
"x": 1.7320778411959875e-43,
"y": 1900.0
},
{
"x": 7.246646173752609e-60,
"y": 7.949196856316121e-14
}
],
[
{
"x": 0.0,
"y": 0.0
},
{
"x": 482.0000000000002,
"y": 0.0
},
{
"x": 481.9999999999998,
"y": 800.0
},
{
"x": 0.0,
"y": 800.0
},
{
"x": 0.0,
"y": 0.0
}
],
[
{
"x": 0.0,
"y": 0.0
},
{
"x": 800.0,
"y": 0.0
},
{
"x": 800.0,
"y": 80.0
},
{
"x": 0.0,
"y": 80.0
},
{
"x": 0.0,
"y": 0.0
}
],
[
{
"x": 481.9999999999998,
"y": 800.0
},
{
"x": 0.0,
"y": 799.9999999999996
},
{
"x": 0.0,
"y": -4.547473508864641e-13
},
{
"x": 482.0,
"y": 4.547473508864641e-13
},
{
"x": 481.9999999999998,
"y": 800.0
}
],
[
{
"x": 482.0,
"y": 1899.999999999999
},
{
"x": 482.0,
"y": 1999.9999999999996
},
{
"x": 0.0,
"y": 1999.9999999999996
},
{
"x": 0.0,
"y": 4.574118861455645e-14
},
{
"x": 600.0,
"y": -2.6689761511988765e-13
},
{
"x": 600.0,
"y": 1899.9999999999976
},
{
"x": 482.0,
"y": 1899.999999999999
}
],
[
{
"x": 482.0,
"y": 1899.9999999999994
},
{
"x": 482.0,
"y": 1999.9999999999998
},
{
"x": 0.0,
"y": 1999.9999999999996
},
{
"x": 0.0,
"y": 0.0
},
{
"x": 600.0,
"y": -3.126388037344441e-13
},
{
"x": 600.0,
"y": 1899.999999999998
},
{
"x": 482.0,
"y": 1899.9999999999994
}
]
]
}

@ -34,7 +34,7 @@ export class Fbx implements Command
{
(<Mesh>o).material = m;
}
})
});
let box = GetBox(obj);
let mp = box.min.clone().negate();
@ -43,7 +43,7 @@ export class Fbx implements Command
obj.matrixWorldNeedsUpdate = true;
app.Viewer.Scene.add(obj);
}
};
// Read in the image file as a data URL.
reader.readAsArrayBuffer(f);
}

@ -106,7 +106,7 @@ export class Command_PLTest implements Command
let lines: Line[] = [];
let a = Math.PI / 180;
let center = new Vector3(2.5, 2.5)
let center = new Vector3(2.5, 2.5);
for (let i = 0; i < 1; i++)
{
let p = polar(center.clone(), a * i, 3) as Vector3;
@ -130,7 +130,7 @@ export class Command_PLTest implements Command
lines[i].EndPoint = pl.GetClosestPointTo2(p, ExtendType.Back);
}
}
})
});
}
@ -254,7 +254,7 @@ export class Command_PLTest implements Command
{
}
})
});
// for (let p of [1.5, 2.5, 2.8, 2.8, 1.2, 2, 1.8, 1, 2.2, 0])
for (let p = -3; p < 7; p += 0.2)
@ -291,7 +291,7 @@ export class Command_PLTest implements Command
pt: new Vector2(0, 5),
bul: 0.32
},
])
]);
let p2 = new Polyline([
{
pt: new Vector2(-1, 0),
@ -301,7 +301,7 @@ export class Command_PLTest implements Command
pt: new Vector2(4, 0),
bul: 0
},
])
]);
let p3 = new Polyline([
{
pt: new Vector2(0, 0),
@ -311,7 +311,7 @@ export class Command_PLTest implements Command
pt: new Vector2(3, 3),
bul: 0
},
])
]);
let p4 = new Polyline([
{
pt: new Vector2(0, 0),
@ -321,7 +321,7 @@ export class Command_PLTest implements Command
pt: new Vector2(1, 1),
bul: 0
},
])
]);
app.Database.ModelSpace.Append(pl);
app.Database.ModelSpace.Append(p4);
console.log(pl.IntersectWith(p4, IntersectOption.ExtendArg));

@ -11,14 +11,14 @@ export class OffsetTestUtil extends OffsetPolyline
{
constructor(_Polyline: Polyline, _OffsetDist: number, _ToolPath = false)
{
super(_Polyline, _OffsetDist, _ToolPath)
super(_Polyline, _OffsetDist, _ToolPath);
}
//----TEST
TestDrawPolyline()
{
this.OffsetSubCurves();
app.Editor.Prompt("开始绘制多段线")
app.Editor.Prompt("开始绘制多段线");
for (let i = 0; i < this._SubCurves.length; i++)
{
let c = this._SubCurves[i].Clone().ApplyMatrix(this._CacheOCS);
@ -109,7 +109,7 @@ export class OffsetTestUtil extends OffsetPolyline
for (let c of this._CurveTrimedTreeNodes)
{
TestDraw(c.curve.ApplyMatrix(this._CacheOCS), i);
i++
i++;
}
}
}

@ -78,7 +78,7 @@ async function TestOffset(cud: Object, offsetDist: number | number[], count?: nu
let b = new Box3();
for (let e of ents)
b.union(e.BoundingBox);
await JigMoveEntity(ents, b.min)
await JigMoveEntity(ents, b.min);
}
}
rm();

@ -60,7 +60,7 @@ export class TestIntersect implements Command
let cir = new Circle(p, 0.2);
cir.ColorIndex = 2;
app.Database.ModelSpace.Append(cir);
})
});
} else
{
cu1.ColorIndex = 1;
@ -86,7 +86,7 @@ export class TestIntersect implements Command
let cir = new Circle(p, 0.1);
cir.ColorIndex = 2;
app.Database.ModelSpace.Append(cir);
})
});
} else
{
cus[0].ColorIndex = 1;
@ -110,7 +110,7 @@ export class TestIntersect implements Command
let cir = new Circle(p, 10);
cir.ColorIndex = 2;
app.Database.ModelSpace.Append(cir);
})
});
}
}
}

@ -22,7 +22,7 @@ export class Command_TestBox implements Command
// app.m_Database.ModelSpace.Append(line);
// }
let ptRes = await app.Editor.GetPoint({ Msg: "选择点" })
let ptRes = await app.Editor.GetPoint({ Msg: "选择点" });
if (ptRes.Status !== PromptStatus.OK)
return;
let pt1 = ptRes.Point.clone();
@ -37,7 +37,7 @@ export class Command_TestBox implements Command
let ss = new SelectSet();
let pt = v.clone();
app.Viewer.WorldToScreen(pt);
let sl = new SelectLine(app.Viewer, AsVector2(pt1), AsVector2(pt.clone()))
let sl = new SelectLine(app.Viewer, AsVector2(pt1), AsVector2(pt.clone()));
sl.Select();
ss.AddSelect(sl);
console.log(ss.SelectEntityList);

@ -46,7 +46,7 @@ export class TestTargeOnCurve implements Command
{
c.ColorIndex = i + 1;
app.Database.ModelSpace.Append(c);
})
});
// this.testPtIn(source as Polyline, target);
target.Erase();
source.Erase();
@ -99,7 +99,7 @@ export class TestTargeOnCurve implements Command
if (outline.PtInCurve(l.EndPoint))
{
l.ColorIndex = 3
l.ColorIndex = 3;
} else
l.ColorIndex = 1;
@ -110,7 +110,7 @@ export function testPts(pts: Vector3[], color = 2)
{
pts.forEach(p =>
{
let point = new Point(p)
let point = new Point(p);
app.Database.ModelSpace.Append(point);
});
}
@ -138,7 +138,7 @@ export function testBox(box3: Array<Box3 | Box3Ext>, color: number = 2)
let l = new Line(b.min, b.max);
l.ColorIndex = color;
app.Database.ModelSpace.Append(l);
})
});
}
//测试盒子
export function testtBox3(box3: Box3, colorIndex = 1)
@ -153,5 +153,5 @@ export function testtBox3(box3: Box3, colorIndex = 1)
{
l.ColorIndex = colorIndex;
app.Database.ModelSpace.Append(l);
})
});
}

@ -30,7 +30,7 @@ export class TestFillet implements Command
let ptsStr = pts.map(p =>
{
return `new Vector3(${p.toArray().toString()})`
return `new Vector3(${p.toArray().toString()})`;
}).join(",");
let str = `

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save