|
|
@ -7,10 +7,12 @@ void loaderTest1() |
|
|
|
std::vector<Point3D> points; |
|
|
|
std::vector<double> bulges; |
|
|
|
Vector3D extusion; |
|
|
|
Point3D topPoint, bottomPoint, basePoint; |
|
|
|
Point3D topPoint, bottomPoint, basePoint, leftBottomPoint; |
|
|
|
Direction3D direction; |
|
|
|
|
|
|
|
double offset, radius1, radius2; |
|
|
|
double offset, radius1, radius2, length, width, height, areaDifference, volumeDifference; |
|
|
|
|
|
|
|
std::pair<double, double> before, after; |
|
|
|
|
|
|
|
/* 体1 */ |
|
|
|
points.clear(); |
|
|
@ -22,8 +24,6 @@ void loaderTest1() |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 3300.0000000000000}; |
|
|
|
auto tag1 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
loader.output(tag1); |
|
|
|
|
|
|
|
/* 体2 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
@ -84,7 +84,7 @@ void loaderTest1() |
|
|
|
/* 体5被切割 */ |
|
|
|
basePoint = Point3D{-1.1224183253943920e-06, -3.8391322798592142e-07, 3300.0000000000000000}; |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
loader.split(tag3, basePoint, direction); |
|
|
|
loader.split(tag5, basePoint, direction); |
|
|
|
|
|
|
|
/* 体3和体5布尔并 */ |
|
|
|
loader.unionNode(tag3, tag5); |
|
|
@ -198,22 +198,268 @@ void loaderTest1() |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
loader.split(tag11, basePoint, direction); |
|
|
|
|
|
|
|
/* 体8和体11布尔并 */ |
|
|
|
/* 体8和体11布尔并 */ |
|
|
|
loader.unionNode(tag8, tag11); |
|
|
|
|
|
|
|
/* 体7和体8布尔差 */ |
|
|
|
/* 体7和体8布尔差 */ |
|
|
|
loader.differentNode(tag7, tag8); |
|
|
|
|
|
|
|
/* 体2和体7布尔并 */ |
|
|
|
/* 体2和体7布尔并 */ |
|
|
|
loader.unionNode(tag2, tag7); |
|
|
|
|
|
|
|
/* 体1和体2布尔并 */ |
|
|
|
/* 体1和体2布尔并 */ |
|
|
|
loader.unionNode(tag1, tag2); |
|
|
|
|
|
|
|
/* 体1 Z轴偏移 -3600 */ |
|
|
|
/* 体1 Z轴偏移 -3600 */ |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
offset = -3600; |
|
|
|
loader.offset(tag1, direction, offset); |
|
|
|
|
|
|
|
/* 新的体11 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-32050.000001122418, -3.8396319723688066e-07, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{32049.999998877582, -3.8387224776670337e-07, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto newTag11 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 体0 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-11798.670446418590, 5999.2409883221799, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{11801.337366082498, 5999.2409883221590, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto tag0 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 新的体11和体0布尔差 */ |
|
|
|
loader.differentNode(newTag11, tag0); |
|
|
|
|
|
|
|
/* 新的体11 Z轴偏移 -3500 */ |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
offset = -3500; |
|
|
|
loader.offset(newTag11, direction, offset); |
|
|
|
|
|
|
|
/* 体1和新的体11判交 */ |
|
|
|
/* TODO */ |
|
|
|
|
|
|
|
/* 体12 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{676.33403607269543, 5999.2409883221790, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{-673.66711640879771, 5999.2409883221790, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto tag12 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 体12 Z轴偏移 -3500 */ |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
offset = -3500; |
|
|
|
loader.offset(tag12, direction, offset); |
|
|
|
|
|
|
|
/* 体1和体12判交 */ |
|
|
|
/* TODO */ |
|
|
|
|
|
|
|
/* 新的体11和体12布尔并 保留体12 */ |
|
|
|
loader.unionNode(newTag11, tag12); |
|
|
|
|
|
|
|
/* 体13 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-2398.6665401680511, 5999.2409883221771, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{2401.3334598319489, 5999.2409883221790, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto tag13 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 体13 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-673.66711640879771, 5999.2409883221790, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{676.33403607269543, 5999.2409883221790, 0.0000000000000000}); |
|
|
|
bulges.push_back(-0.99999999999999989); |
|
|
|
bulges.push_back(-0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto tag14 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 体13和体14布尔差 */ |
|
|
|
loader.differentNode(tag13, tag14); |
|
|
|
|
|
|
|
/* 体13 Z轴偏移-3500 */ |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
offset = -3500; |
|
|
|
loader.offset(tag13, direction, offset); |
|
|
|
|
|
|
|
/* 体1和体13判交 */ |
|
|
|
/* TODO */ |
|
|
|
|
|
|
|
/* 新的体11和体13布尔并保留体13 */ |
|
|
|
loader.unionNode(newTag11, tag13); |
|
|
|
|
|
|
|
before = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 体1和新的体11布尔差 */ |
|
|
|
loader.differentNode(tag1, newTag11); |
|
|
|
|
|
|
|
after = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 获取 体1 布尔前后的 体积差 和 面积差 */ |
|
|
|
areaDifference = after.first - before.first; |
|
|
|
volumeDifference = after.second - before.second; |
|
|
|
|
|
|
|
/* 定义空体 扣减体1 */ |
|
|
|
auto subTag1 = loader.addEmpty(); |
|
|
|
auto cycle = [&loader, subTag1](const Point3D& point) { |
|
|
|
std::vector<Point3D> points; |
|
|
|
std::vector<double> bulges; |
|
|
|
Vector3D extusion; |
|
|
|
Direction3D direction; |
|
|
|
double offset; |
|
|
|
|
|
|
|
/* 循环体1 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-1000.0000000000000, 1000.0000000000001, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{-1000.0000000000000, -1000.0000000000000, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{1000.0000000000000, -1000.0000000000000, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{1000.0000000000000, 1000.0000000000000, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto cycleTag1 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 循环体1 偏移+ 传入的X,Y,Z坐标值 */ |
|
|
|
loader.offset(cycleTag1, Direction3D{point}, point.length()); |
|
|
|
|
|
|
|
/* 循环体2 */ |
|
|
|
auto leftBottomPoint = Point3D{point.m_x - 1000, point.m_y - 1000, point.m_z + 0.0000000000005}; |
|
|
|
double length = 2000.0000000000036; |
|
|
|
double width = 2000.0000000000036; |
|
|
|
double height = 600; |
|
|
|
auto cycleTag2 = loader.addBox(leftBottomPoint, length, width, height); |
|
|
|
|
|
|
|
/* 循环体3 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-32050.000001122418, -3.8396319723688066e-07, 0.0000000000000000}); |
|
|
|
points.push_back(Point3D{32049.999998877582, -3.8387224776670337e-07, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{0.0000000000000000, 0.0000000000000000, 600.0000000000000}; |
|
|
|
auto cycleTag3 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
/* 循环体3 Z轴偏移 -2900 */ |
|
|
|
direction = Direction3D{0, 0, 1}; |
|
|
|
offset = -2900; |
|
|
|
loader.offset(cycleTag3, direction, offset); |
|
|
|
|
|
|
|
/* 循环体3和体2布尔交 */ |
|
|
|
loader.intersectNode(cycleTag3, cycleTag2); |
|
|
|
|
|
|
|
/* 循环体1和体3布尔交 */ |
|
|
|
loader.intersectNode(cycleTag1, cycleTag3); |
|
|
|
|
|
|
|
/* 循环体1和体1判交 */ |
|
|
|
/* TODO */ |
|
|
|
|
|
|
|
/* 扣减体1和循环体1布尔并 */ |
|
|
|
loader.unionNode(subTag1, cycleTag1); |
|
|
|
}; |
|
|
|
|
|
|
|
points.clear(); |
|
|
|
points.push_back(Point3D{-21595.036456438422, -21609.173181957169, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-13505.711180076411, -13505.717935507526, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-2987.8729842756293, -18864.829751913778, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{2987.9196792985895, -18864.830728476278, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{13505.770265236089, -13505.722818320026, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{17018.254640236089, -8671.2047519137759, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{27220.281983986089, -13869.397623007526, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{21602.139405861089, -21602.103677695028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{30173.926515236089, -4778.9669589450259, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{18864.887452736089, -2987.8275546481514, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-18864.815672263911, -2987.8811435153389, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-30173.856687888911, -4779.0570468356509, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-13869.422117576411, -27220.218912070028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-11781.052000388911, -23121.591958945028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-8671.2131332014105, -17018.193521445028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-27220.229734763911, -13869.391763632526, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-17018.194578513911, -8671.1974276950259, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-30173.856687888911, 4779.0965176174741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-25630.485594138911, 4059.4959316799741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-18864.815672263911, 2987.9134121487236, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-15863.798094138911, 8083.0535488674741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-27220.216062888911, 13869.449056679974, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-21602.091062888911, 21602.130697304972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-18349.393797263911, 18349.437337929972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-13908.684812888911, 13908.728353554974, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-9584.8552230451605, 18811.339681679972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-13869.425047263911, 27220.249837929972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-4779.0493148420355, 30173.900228554972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{4779.0900894548395, 30173.904134804972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{13869.430421486089, 27220.275228554972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{9584.8806167985895, 18811.363119179972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{13908.739015236089, 13908.728353554974, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{18349.453858986089, 18349.433431679972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{21602.147218361089, 21602.130697304972, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{27220.268312111089, 13869.454916054974, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{15863.852296486089, 8083.0574551174741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{18864.879640236089, 2987.9153652737236, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{25630.543702736089, 4059.4900723049741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{30173.912843361089, 4779.0896816799741, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{13869.432374611089, -27220.242349570028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-4776.1108367703273, -30098.869302695028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{4779.0915542985895, -30098.869302695028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-23121.594969138911, -11781.033365195026, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{23121.637452736089, 11781.092611367474, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{11781.053468361089, -23121.619302695028, -2900.0000000000000}); |
|
|
|
points.push_back(Point3D{-23121.583250388911, 11781.089681679974, -2900.0000000000000}); |
|
|
|
for (auto& point : points) |
|
|
|
{ |
|
|
|
cycle(point); |
|
|
|
} |
|
|
|
|
|
|
|
before = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 体1和扣减体1布尔差 */ |
|
|
|
loader.differentNode(tag1, subTag1); |
|
|
|
|
|
|
|
after = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 获取 体1 布尔前后的 体积差 和 面积差 */ |
|
|
|
areaDifference = after.first - before.first; |
|
|
|
volumeDifference = after.second - before.second; |
|
|
|
|
|
|
|
/* 体15:Ent1.bool */ |
|
|
|
|
|
|
|
/* 体1和体15布尔差 */ |
|
|
|
|
|
|
|
/* 体16 */ |
|
|
|
points.clear(); |
|
|
|
bulges.clear(); |
|
|
|
points.push_back(Point3D{-2503.6291053659488, 5999.2409883221790, -3500.0000000000000}); |
|
|
|
points.push_back(Point3D{2501.2960250298465, 5999.2409883221790, -3500.0000000000000}); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
bulges.push_back(0.99999999999999989); |
|
|
|
extusion = Vector3D{-0.0000000000000000, -0.0000000000000000, -100.00000000000000}; |
|
|
|
auto tag16 = loader.addExtrude(points, bulges, extusion); |
|
|
|
|
|
|
|
before = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 体1和体16布尔差 */ |
|
|
|
loader.differentNode(tag1, tag16); |
|
|
|
|
|
|
|
after = loader.getAreaAndVolume(tag1); |
|
|
|
|
|
|
|
/* 获取 体1 布尔前后的 体积差 和 面积差 */ |
|
|
|
areaDifference = after.first - before.first; |
|
|
|
volumeDifference = after.second - before.second; |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char** argv) |
|
|
|