根据示例(在3D Mesh Generation Manual中使用曲面重新划分多面体区域),我想对一个立方体形状的区域进行网格划分,并保护其中间平面(参见下面的代码)。然而,make_mesh_3抛出了一个断言冲突:
CGAL ERROR: assertion violation!
Expr: minimal_size_ > 0 || sq_d > 0不要管这个例子的琐碎之处,它只是为了显示问题。基于this的讨论,我认为问题在于detect_features创建了彼此相交的多段线(中间平面的周长与立方体边缘相交,并且两者都作为特征添加)。
在网格域中不允许相交的多面体吗?如果是这样的话,有没有办法访问和操作detect_features的结果来处理冲突的特征?我试图弄清楚折线是如何存储在网格域中的,但我一无所获。
带中面的立方体
// --- External Includes ---
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_polyhedron_3.h>
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/make_mesh_3.h>
// CGAL types
namespace cgal {
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using ConcurrencyTag = CGAL::Sequential_tag;
using PolyhedronSurface = CGAL::Mesh_polyhedron_3<Kernel>::type;
using MeshDomain = CGAL::Polyhedral_mesh_domain_with_features_3<Kernel>;
using Tr = CGAL::Mesh_triangulation_3<MeshDomain,CGAL::Default,ConcurrencyTag>::type;
using Triangulation = CGAL::Mesh_complex_3_in_triangulation_3<Tr>;
using MeshCriteria = CGAL::Mesh_criteria_3<Tr>;
using Point = cgal::MeshDomain::Point_3;
}
int main()
{
// Define points for the cube and midPlane
std::vector<cgal::Point> points =
{
cgal::Point( 1.0, 0.0, 0.0),
cgal::Point( 1.0, 1.0, 0.0),
cgal::Point( 0.0, 1.0, 0.0),
cgal::Point( 0.0, 0.0, 0.0),
cgal::Point( 1.0, 0.0, 1.0),
cgal::Point( 1.0, 1.0, 1.0),
cgal::Point( 0.0, 1.0, 1.0),
cgal::Point( 0.0, 0.0, 1.0),
cgal::Point( 1.0, 0.0, 0.5),
cgal::Point( 1.0, 1.0, 0.5),
cgal::Point( 0.0, 1.0, 0.5),
cgal::Point( 0.0, 0.0, 0.5)
};
// Create polyhedra
cgal::PolyhedronSurface cube, midPlane;
cube.make_triangle( points[0], points[3], points[1]);
cube.make_triangle( points[1], points[3], points[2]);
cube.make_triangle( points[4], points[5], points[7]);
cube.make_triangle( points[5], points[6], points[7]);
cube.make_triangle( points[0], points[4], points[3]);
cube.make_triangle( points[3], points[4], points[7]);
cube.make_triangle( points[1], points[2], points[5]);
cube.make_triangle( points[2], points[6], points[5]);
cube.make_triangle( points[2], points[3], points[6]);
cube.make_triangle( points[3], points[7], points[6]);
cube.make_triangle( points[0], points[1], points[5]);
cube.make_triangle( points[0], points[5], points[4]);
midPlane.make_triangle( points[8], points[9], points[10]);
midPlane.make_triangle( points[8], points[10], points[11]);
// Triangulation
cgal::MeshDomain meshDomain( midPlane, cube );
meshDomain.detect_features();
cgal::MeshCriteria meshCriteria( CGAL::parameters::facet_angle = 30,
CGAL::parameters::edge_size = 0.2 );
auto triangulation = CGAL::make_mesh_3<cgal::Triangulation>( meshDomain,
meshCriteria );
return 0;
}发布于 2020-06-19 04:39:56
来自here
此曲面必须没有相交。
在您的示例中,边界框和中间平面相交。如果要对此几何体进行网格化,则需要在网格化之前将这些网格连接在一起。
如果查看example in section 3.3.2 here,您会看到一个类似的示例,其中包含一个封闭在边界框之外的内部几何体。
detect_features()不与不相交的输入相交:它只是在现有网格中查找特征(并将它们添加到域中,以便网格化将尊重它们)。
发布于 2020-06-26 01:56:42
对于你的立方体,应该很容易构建一个多面体复合体,即三个表面,即立方体的上部和下部,以及正方形的中间部分。看看this example吧。
https://stackoverflow.com/questions/62451016
复制相似问题