三角形
四边形
立方体
六面体
棱柱
锥体
二十面体
网格
cpp
Polyhedron _mesh;
/**************三角形************/
CGAL::make_triangle(K::Point_3(100, 0, 0), K::Point_3(0, 100, 0), K::Point_3(0, 0, 0), _mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/triangle.stl", _mesh);
_mesh.clear();
/**************四边形************/
CGAL::make_quad(K::Point_3(0, 0, 0), K::Point_3(100, 0, 0), K::Point_3(100, 100, 0), K::Point_3(0, 100, 0), _mesh);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/quad.stl", _mesh);
_mesh.clear();
/**************立方体************/
K::Iso_cuboid_3 cubte(K::Point_3(0, 0, 0), K::Point_3(100, 100, 100));
CGAL::make_hexahedron(cubte, _mesh);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/cubte.stl", _mesh);
_mesh.clear();
/**************六面体(下面的点顺时针,上面的点逆时针,与下面的一一对应)************/
CGAL::make_hexahedron(
K::Point_3(0, 0, 0), K::Point_3(100, 0, 0), K::Point_3(120, 120, 0), K::Point_3(0, 90, 0),
K::Point_3(0, 0, 100), K::Point_3(110, 0,100), K::Point_3(100, 100, 130), K::Point_3(0, 100, 100),
_mesh);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/hexahedron.stl", _mesh);
_mesh.clear();
/**************正棱柱************/
CGAL::make_regular_prism(36, _mesh, K::Point_3(0, 0, 0),100, 20);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/regular_prism.stl", _mesh);
_mesh.clear();
/**************锥体(金字塔)************/
CGAL::make_pyramid(36, _mesh, K::Point_3(0, 0, 0),100, 20);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/pyramid.stl", _mesh);
_mesh.clear();
/**************二十面体************/
CGAL::make_icosahedron(_mesh, K::Point_3(0, 0, 0),5);
CGAL::Polygon_mesh_processing::triangulate_faces(_mesh);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/icosahedron.stl", _mesh);
_mesh.clear();
/**************网格************/
CGAL::make_grid(10, 20, _mesh, true);
CGAL::IO::write_polygon_mesh("F:/WORK/STL/grid.stl", _mesh);