|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
import { CADFile } from '../../src/DatabaseServices/CADFile';
|
|
|
|
|
import { Curve } from '../../src/DatabaseServices/Curve';
|
|
|
|
|
import { Line } from './../../src/DatabaseServices/Line';
|
|
|
|
|
import { RegionParse } from './../../src/Geometry/RegionParse';
|
|
|
|
|
|
|
|
|
@ -226,3 +227,43 @@ test('保护伞', () =>
|
|
|
|
|
|
|
|
|
|
expectReg(g);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('带圆弧的复杂图形测试', () =>
|
|
|
|
|
{
|
|
|
|
|
let file = new CADFile();
|
|
|
|
|
file.Data = [
|
|
|
|
|
["Line", 1, 1, 105, 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, 106, 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, 107, 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, 108, 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, 109, 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, 110, 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, 111, 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, 112, 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, 113, 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, 114, 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, 115, 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, 116, 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, 171, 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, 172, 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, 173, 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, 174, 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, 175, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [151.10541370131332, 26.821442121699068, 0], [0, 0, 1], 6.14056907448819, 3.8938276244846772, 6.018122149019185, false],
|
|
|
|
|
["Arc", 1, 1, 176, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [161.1393080144557, 24.097737845466003, 0], [0, 0, 1], 4.256430496141867, 2.8765294954293896, 5.103001249079749, true],
|
|
|
|
|
["Arc", 1, 1, 177, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [164.0426698023552, 17.04682100167833, 0], [0, 0, 1], 3.368852318904628, 1.9614085954899536, 5.109952481560101, false],
|
|
|
|
|
["Arc", 1, 1, 178, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [168.0577082733428, 7.485478534075631, 0], [0, 0, 1], 7.001287685275334, 1.9683598279703076, 3.2491377039705007, true],
|
|
|
|
|
["Arc", 1, 1, 179, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [156.0343039466818, 6.18741259702873, 0], [0, 0, 1], 5.091984278064126, 0.10754505038070734, 2.997466317295445, false],
|
|
|
|
|
["Arc", 1, 1, 180, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [146.05997836303806, 7.635012886374687, 0], [0, 0, 1], 4.986840923627034, 6.139058970885238, 3.1864217771069283, true],
|
|
|
|
|
["Arc", 1, 1, 181, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, [138.09073817490173, 7.277519322534491, 0], [0, 0, 1], 2.9904136682983347, 0.04482912351713572, 3.0967635300726575, false]];
|
|
|
|
|
|
|
|
|
|
let cus: Curve[] = [];
|
|
|
|
|
for (let i = 0; i < file.Data.length; i++)
|
|
|
|
|
{
|
|
|
|
|
cus.push(file.ReadObject(undefined) as Curve);
|
|
|
|
|
}
|
|
|
|
|
let g = new RegionParse(cus);
|
|
|
|
|
|
|
|
|
|
expect(g.m_RegionsInternal.length).toBe(7);
|
|
|
|
|
expect(g.m_RegionsOutline.length).toBe(1);
|
|
|
|
|
});
|
|
|
|
|