Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_list> CgalPolyhedron;
- typedef CGAL::AABB_tree<Traits> AABBTree;
- typedef CGAL::AABB_face_graph_triangle_primitive<CgalPolyhedron> IntersectionPrimitive;
- typedef CGAL::AABB_traits<Kernel, IntersectionPrimitive> Traits;
- typedef CGAL::AABB_tree<Traits> AABBTree;
- typedef boost::optional<AABBTree::Intersection_and_primitive_id<Kernel::Segment_3>::Type > SegmentIntersection;
- typedef boost::optional<AABBTree::Intersection_and_primitive_id<Kernel::Plane_3>::Type> PlaneIntersection;
- Kernel::Plane_3 cgalPlane(origin, normal);
- //pCGALPoly is my loaded model and its class is CgalPolyhedron defined above
- AABBTree tree(faces(*pCGALPoly).first, faces(*pCGALPoly).second, *pCGALPoly);
- auto anyIntersection = tree.any_intersection(cgalPlane);
- //Taking the first face and halfedge computed by intersection test
- CgalPolyhedron::Face_handle aFace = anyIntersection->second;
- CgalPolyhedron::Halfedge_handle aHalfedge = aFace->halfedge();
- //Cutting the plane
- polyhedron_cut_plane_3(*pCGALPoly, aHalfedge, cgalPlane);
Advertisement
Add Comment
Please, Sign In to add comment