首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >从AABB树的交叉点获取原语

从AABB树的交叉点获取原语
EN

Stack Overflow用户
提问于 2018-07-03 15:27:39
回答 1查看 486关注 0票数 1

这段代码包含一个AABB树,它是使用Polyhedron_3网格构建的。可以验证是否发生交集,但不能验证交集命中的图元。如何检索原语?

代码语言:javascript
复制
typedef CGAL::Polyhedron_3<Kernel>         Polyhedron;
const Polyhedron& mesh;
tree(faces(_mesh).first, faces(_mesh).second, _mesh);

boost::optional<Primitive_id> intersection = tree.first_intersected_primitive(ray);

if(intersection)
{
//how to get the primitive?
}

编辑:

代码语言:javascript
复制
faces(mesh, tree);
faces(*mesh, tree);

faces(hit, tree);
faces(*hit, tree);

也不起作用。

Edit2:

代码语言:javascript
复制
                CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > > > > it = *hit;

                CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Plane_3<CGAL::Simple_cartesian<double> > > >::Halfedge_around_facet_circulator ipfacet = it->facet_begin();

获取迭代器和I_Polyhedron_facet。

EN

回答 1

Stack Overflow用户

发布于 2018-07-03 15:56:47

如果交叉点不为空,则*交叉点应该是您正在查找的基元的Primitive_id。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51148826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档