将AABB_tree与多个曲面网格一起使用



我正在尝试使用具有多个Surface_mesh的CGAL AABB_tree,但失败了一个奇怪的断言,这让我认为它试图使用第一个曲面网格的顶点与第二个网格的索引或类似奇怪的东西。

在提交错误之前,我想验证我没有误解某些内容。

下面是一个经过最小修改的示例。 我正在使用 cube.off 来自:https://github.com/libigl/libigl/blob/master/tutorial/shared/cube.off 和 CGAL 示例中的四面体,但每次我添加的第二个表面网格的顶点都比第一个网格少时,它似乎都会重现,无论它是什么。

我失败的断言是/usr/local/include/CGAL/Surface_mesh/Properties.h:178 - CGAL_assertion(idx(( (;

用: CGAL_VERSION 4.12

CGAL_VERSION_NR 1041201000

CGAL_SVN_REVISION 99999

CGAL_GIT_HASH f7c3c8212b56c0d6dae63787efc99093f4383415

#include <iostream>
#include <fstream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_3 Point;
typedef K::Ray_3 Ray;
typedef CGAL::Surface_mesh<Point> Mesh;
typedef CGAL::AABB_face_graph_triangle_primitive<Mesh> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type> Ray_intersection;
int main(int argc, char* argv[])
{
const char* filename1 = "cube.off";
const char* filename2 = "tetrahedron.off";
std::ifstream input1(filename1);
Mesh mesh1;
input1 >> mesh1;
std::ifstream input2(filename2);
Mesh mesh2;
input2 >> mesh2;
Tree tree;
tree.insert(faces(mesh1).first, faces(mesh1).second, mesh1);
tree.insert(faces(mesh2).first, faces(mesh2).second, mesh2);
tree.build(); // CGAL_assertion( idx < data.size() ) fails
return 0;
}

我重新发布我的评论作为答案:

从我的评论:实际上你可以使用这个基元,但你需要将模板标签OneFaceGraphPerTree设置为CGAL::Tag_false。 看这里

最新更新