image.png

    1. #include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
    2. #include <CGAL/draw_linear_cell_complex.h>
    3. typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC;
    4. typedef LCC::Dart_handle Dart_handle;
    5. typedef LCC::Point Point;
    6. int main()
    7. {
    8. //创建一个线性单元复合体(即CGAL中的体模型)
    9. LCC lcc;
    10. //创建两个六面体,返回Dart句柄(即仿指针)
    11. Dart_handle dh1 =
    12. lcc.make_hexahedron(Point(0, 0, 0), Point(5, 0, 0),
    13. Point(5, 5, 0), Point(0, 5, 0),
    14. Point(0, 5, 4), Point(0, 0, 4),
    15. Point(5, 0, 4), Point(5, 5, 4)); //8个点
    16. Dart_handle dh2 =
    17. lcc.make_hexahedron(Point(5, 0, 0), Point(10, 0, 0),
    18. Point(10, 5, 0), Point(5, 5, 0),
    19. Point(5, 5, 4), Point(5, 0, 4),
    20. Point(10, 0, 4), Point(10, 5, 4));
    21. //缝合
    22. lcc.sew<3>(lcc.beta(dh1, 1, 1, 2), lcc.beta(dh2, 2));
    23. //问题:beta是做什么的?
    24. //体模型是否有效
    25. lcc.display_characteristics(std::cout) << ", valid="
    26. << lcc.is_valid() << std::endl;
    27. //绘制
    28. CGAL::draw(lcc);
    29. return EXIT_SUCCESS;
    30. }