CGAL 6.0.1 - Polygon Mesh Processing
Loading...
Searching...
No Matches
CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization > Class Template Reference

#include <CGAL/Polygon_mesh_slicer.h>

Definition

template<class TriangleMesh, class Traits, class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
class CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >

Function object that computes the intersection of a plane with a triangulated surface mesh.

Template Parameters
TriangleMesha triangulated surface mesh, model of FaceGraph and HalfedgeListGraph
Traitsa model of AABBGeomTraits_3
VertexPointMapa model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key and Traits::Point_3 as value type. The default is typename boost::property_map< TriangleMesh, vertex_point_t>::type.
AABBTreemust be an instantiation of CGAL::AABB_tree able to handle the edges of TriangleMesh, having its edge_descriptor as primitive id. The default is CGAL::AABB_tree<CGAL::AABB_traits_3< Traits, CGAL::AABB_halfedge_graph_segment_primitive<TriangleMesh> > >
UseParallelPlaneOptimizationif true, the code will use specific predicates and constructions in case the functor is called with a plane orthogonal to a frame axis, the non-null coefficient being 1 or -1. The default is true.

The implementation of this class depends on the package 2D and 3D Fast Intersection and Distance Computation.

Todo:
Shall we document more in details what is required? Traits must provide:
  • Plane_3
  • Point_3
  • Segment_3
  • Oriented_side_3 with Oriented_side operator()(Plane_3, Point_3)
  • Do_intersect_3 with std::optional<variant<Point_3,Segment_3> operator()(Plane_3,Segment_3)
  • Do_intersect_3 with bool operator()(Plane_3, Bbox_3)
Todo:
If we keep the traits for plane orthogonal to a frame axis, Traits must also provide:
  • FT
  • Construct_cartesian_const_iterator_3 with Iterator operator()(Point_3) Iterator being a random access iterator with FT as value type
  • Construct_point_3 with Point_3 operator()(FT,FT,FT); Construct_source_3 with const Point_3& operator()(Segment_3)
  • Construct_target_3 with const Point_3& operator()(Segment_3)
Todo:
_object() functions must also be provided
Examples
Polygon_mesh_processing/mesh_slicer_example.cpp.

Public Types

typedef AABBTree AABB_tree
 the AABB-tree type used internally
 

Public Member Functions

 Polygon_mesh_slicer (const TriangleMesh &tmesh, VertexPointMap vpmap, const Traits &traits=Traits())
 Constructor using edges(tmesh) to initialize the internal AABB_tree.
 
 Polygon_mesh_slicer (const TriangleMesh &tmesh, const AABBTree &tree, VertexPointMap vpmap, const Traits &traits=Traits())
 Constructor using a pre-built AABB_tree of edges provided by the user.
 
 Polygon_mesh_slicer (const TriangleMesh &tmesh, const Traits &traits=Traits())
 Constructor using edges(tmesh) to initialize the internal AABB_tree.
 
 Polygon_mesh_slicer (const TriangleMesh &tmesh, const AABBTree &tree, const Traits &traits=Traits())
 Constructor using a AABB_tree provided by the user.
 
template<class OutputIterator >
OutputIterator operator() (const Plane_3 &plane, OutputIterator out) const
 Constructs the intersecting polylines of plane with the input triangulated surface mesh.
 

Constructor & Destructor Documentation

◆ Polygon_mesh_slicer() [1/4]

template<class TriangleMesh , class Traits , class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >::Polygon_mesh_slicer ( const TriangleMesh &  tmesh,
VertexPointMap  vpmap,
const Traits &  traits = Traits() 
)

Constructor using edges(tmesh) to initialize the internal AABB_tree.

Parameters
tmeshthe triangulated surface mesh to be sliced. It must be valid and non modified as long as the functor is used.
vpmapan instance of the vertex point property map associated to tmesh
traitsa traits class instance, can be omitted

◆ Polygon_mesh_slicer() [2/4]

template<class TriangleMesh , class Traits , class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >::Polygon_mesh_slicer ( const TriangleMesh &  tmesh,
const AABBTree &  tree,
VertexPointMap  vpmap,
const Traits &  traits = Traits() 
)

Constructor using a pre-built AABB_tree of edges provided by the user.

Parameters
tmeshthe triangulated surface mesh to be sliced. It must be valid and non modified as long as the functor is used.
treemust be initialized with all the edges of tmesh
vpmapan instance of the vertex point property map associated to tmesh
traitsa traits class instance, can be omitted

◆ Polygon_mesh_slicer() [3/4]

template<class TriangleMesh , class Traits , class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >::Polygon_mesh_slicer ( const TriangleMesh &  tmesh,
const Traits &  traits = Traits() 
)

Constructor using edges(tmesh) to initialize the internal AABB_tree.

The vertex point property map used is get(CGAL::vertex_point, tmesh)

Parameters
tmeshthe triangulated surface mesh to be sliced. It must be valid and non modified as long as the functor is used.
traitsa traits class instance, can be omitted

◆ Polygon_mesh_slicer() [4/4]

template<class TriangleMesh , class Traits , class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >::Polygon_mesh_slicer ( const TriangleMesh &  tmesh,
const AABBTree &  tree,
const Traits &  traits = Traits() 
)

Constructor using a AABB_tree provided by the user.

The vertex point property map used is get(CGAL::vertex_point, tmesh)

Parameters
tmeshthe triangulated surface mesh to be sliced. It must be valid and non modified as long as the functor is used.
treemust be initialized with all the edges of tmesh
traitsa traits class instance, can be omitted

Member Function Documentation

◆ operator()()

template<class TriangleMesh , class Traits , class VertexPointMap = typename boost::property_map< TriangleMesh, vertex_point_t>::type, class AABBTree = AABB_tree< AABB_traits_3<Traits, AABB_halfedge_graph_segment_primitive<TriangleMesh, std::conditional_t< std::is_same_v< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, VertexPointMap>>>>, bool UseParallelPlaneOptimization = true>
template<class OutputIterator >
OutputIterator CGAL::Polygon_mesh_slicer< TriangleMesh, Traits, VertexPointMap, AABBTree, UseParallelPlaneOptimization >::operator() ( const Plane_3 &  plane,
OutputIterator  out 
) const

Constructs the intersecting polylines of plane with the input triangulated surface mesh.

If a polyline is closed, the first and last point of that polyline will be identical.

Each resulting polyline P is oriented such that for two consecutive points p and q in P, the normal vector of the face(s) containing the segment pq, the vector pq, and the orthogonal vertor of plane is a direct orthogonal basis. The normal vector of each face is chosen to point on the side of the face where its sequence of vertices is seen counterclockwise.

Note that an edge shared by two faces included in plane will not be reported. For example, if plane passes though one face of a cube, only one closed polyline will be reported (the boundary of the face)

Template Parameters
OutputIteratoran output iterator accepting polylines. A polyline is provided as std::vector<Traits::Point_3>. A polyline is closed if its first and last point are identical.
Parameters
planethe plane to intersect the triangulated surface mesh with
outoutput iterator of polylines