vcazevedo

Untitled

Apr 29th, 2015
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_list> CgalPolyhedron;
  2. typedef CGAL::AABB_tree<Traits> AABBTree;
  3. typedef CGAL::AABB_face_graph_triangle_primitive<CgalPolyhedron> IntersectionPrimitive;
  4. typedef CGAL::AABB_traits<Kernel, IntersectionPrimitive> Traits;
  5. typedef CGAL::AABB_tree<Traits> AABBTree;
  6. typedef boost::optional<AABBTree::Intersection_and_primitive_id<Kernel::Segment_3>::Type > SegmentIntersection;
  7. typedef boost::optional<AABBTree::Intersection_and_primitive_id<Kernel::Plane_3>::Type> PlaneIntersection;
  8.  
  9. Kernel::Plane_3 cgalPlane(origin, normal);
  10. //pCGALPoly is my loaded model and its class is CgalPolyhedron defined above
  11. AABBTree tree(faces(*pCGALPoly).first, faces(*pCGALPoly).second, *pCGALPoly);
  12. auto anyIntersection = tree.any_intersection(cgalPlane);
  13.  
  14. //Taking the first face and halfedge computed by intersection test
  15. CgalPolyhedron::Face_handle aFace = anyIntersection->second;
  16. CgalPolyhedron::Halfedge_handle aHalfedge = aFace->halfedge();
  17.  
  18. //Cutting the plane
  19. polyhedron_cut_plane_3(*pCGALPoly, aHalfedge, cgalPlane);
Advertisement
Add Comment
Please, Sign In to add comment