更新CGAL程序以使用aabb_face_graph_triangle_primive
Updating CGAL program to use AABB_face_graph_triangle_primitive
我有一个C 程序,该程序使用使用MacPorts安装的CGAL 4.5.2_0库。最近,我一直在汇编时间警告CGAL/AABB_polyhedron_triangle_primitive.h
标头已弃用,现在我应该开始使用CGAL/AABB_face_graph_triangle_primitive.h
,因此我天真地切换了标头名,并且还添加了CGAL/boost/graph/graph_traits_Polyhedron_3.h
标头文件,现在似乎是与Boost接口的必要条件图库。我还从CGAL文档中的示例中注意到,我的typedefs
中的一个需要从
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
to
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
到目前为止,这就是我所做的。但是现在我在编译时遇到了两个新错误:
In file included from ./Particle.h:44:
/opt/local/include/CGAL/AABB_tree.h:810:27: error: no matching conversion for functional-style cast from 'CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<My_facet<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<My_items>, std::__1::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Vector_3<CGAL::Epick> > > >, std::__1::allocator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<My_facet<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<My_items>, std::__1::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Vector_3<CGAL::Epick> > > > > >' to 'Primitive' (aka 'CGAL::AABB_face_graph_triangle_primitive<CGAL::Polyhedron_3<CGAL::Epick, My_items, HalfedgeDS_default, std::__1::allocator<int> >, CGAL::Default, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<false> >')
m_primitives.push_back(Primitive(first));
In file included from ./Particle.h:45:
/opt/local/include/CGAL/AABB_traits.h:63:33: error: no matching member function for call to 'construct_shared_data'
m_primitive_data=Primitive::construct_shared_data();
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/opt/local/include/CGAL/AABB_tree.h:268:15: note: in instantiation of member function 'CGAL::internal::AABB_tree::AABB_traits_base<CGAL::AABB_face_graph_triangle_primitive<CGAL::Polyhedron_3<CGAL::Epick, My_items, HalfedgeDS_default, std::__1::allocator<int> >, CGAL::Default, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<false> >, true>::set_shared_data' requested here
{m_traits.set_shared_data();}
^
如果有人有从弃用的标头文件转换为新的经验,我将感谢您对我应该如何进行的任何建议。
我可以发布似乎是问题的粒子类的标头文件,但是它的长3282行,我不确定我应该发布哪个部分。
回答评论,这是用于在树中插入原语的代码:
// The next chunk creates the 3D polyhedron, storing it in surface_poly
Polyhedron surface_poly = getSurfacePolyhedronFromImage(fname,centroid,xBB,yBB,zBB);
// First translate its centroid to the origin
// CartesianVector is a typedef of CGAL's Vector_3
const CartesianVector translation_vector(-centroid[0],-centroid[1],-centroid[2]);
Aff_transformation_3 transl(CGAL::TRANSLATION, translation_vector);
transform(surface_poly.points_begin(),surface_poly.points_end(),
surface_poly.points_begin(),transl);
// Now the centroid is the origin
centroid.resize(3,0.0);
CartesianPoint origin(0.0,0.0,0.0);
// Construct the AABB tree for quick intersection queries
cout << "Creating AABB tree from polyhedron" << endl;
cout.flush();
Tree tree(surface_poly.facets_begin(),surface_poly.facets_end());
// Object intersection will hold the point of intersection with the surface
boost::optional<Object_and_primitive_id> intersection;
在上面的代码中,polyhedron_3的树构造器的语法是不正确的。正确的语法应为
Tree tree(faces(surface_poly).first, faces(surface_poly).second, surface_poly);
将语法更新到正确的表单修复了编译时错误。
相关文章:
- Boost Graph Library,修复节点大小
- 错误的cv::face FacemarkLBF实例化
- 如何从TBB :: Flow :: Graph中删除/取消消息
- Boost Graph库,depth_first_search未在MSVC中调用finish_edge
- std::将麻烦与 cv::face::FN_FaceDetector 绑定
- 如何在Boost Graph库中的Grid_graph的边缘添加自定义属性
- TensorFlow从C 中的Graph Def获得形状
- 在Boost Graph库中选择给定顶点的随机进出邻居的有效方法
- 如何使用Boost Graph库使用循环中的循环设置相同的边缘重量
- Boost Graph库示例不编译
- 如何使用boost::graph dijkstra的算法,如果顶点属性是指针?
- 在Graph实现中,对和向量是如何工作的
- 带标签_Graph的Boost Graph bellman_ford_shortest_path
- 实现 graph 时未解析的重载函数类型 [int]
- 解决方法:"out of line definition of 'graph' does not match any declaration in 'graph'"
- Graph::printAllPaths
- Boost Graph库中边缘的随机访问(或其他快速访问)
- Bipartite graph c++
- C++ Asterik Graph
- Tensorflow Quantized Graph for Android