CGAL 5.4.4 - Polygon Mesh Processing
CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ > Class Template Reference

#include <CGAL/Side_of_triangle_mesh.h>

Definition

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
class CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >

This class provides an efficient point location functionality with respect to a domain bounded by one or several disjoint closed triangle meshes.

A point is said to be on the bounded side of the domain if an odd number of surfaces is crossed when walking from the point to infinity.

The input triangle mesh is expected to contain no self-intersections and to be free from self-inclusions.

In case the triangle mesh has several connected components, the same test is performed and returns correct results. In case of self-inclusions, the user should be aware that the predicate called inside every other sub-volume bounded by a nested surface will return in turns CGAL::ON_BOUNDED_SIDE and CGAL::ON_UNBOUNDED_SIDE, following the aforementioned parity criterion.

This class depends on the package 3D Fast Intersection and Distance Computation.

Template Parameters
TriangleMesha triangulated surface mesh, model of FaceListGraph
GeomTraitsa geometric traits class, model of Kernel
VertexPointMapa model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and GeomTraits::Point_3 as value type. The default is typename boost::property_map<TriangleMesh,vertex_point_t>::type.

Implementation Details
The current implementation is based on the number of triangles intersected by a ray having the query point as source. The do-intersect predicate used to detect if a triangle is intersected is able to detect if a triangle is intersected in its interior or on its boundary. In case it is intersected on its boundary, another ray is picked. In order to speed queries, the first ray used is an axis aligned one that depends on the extents of the bbox of the input mesh. In case other rays are needed to conclude, the rays are generated from a random uniform sampling of a sphere.

Examples:
Polygon_mesh_processing/point_inside_example.cpp.

Public Types

typedef unspecified_type AABB_tree
 AABB-tree accepting faces of TriangleMesh
 

Public Member Functions

 Side_of_triangle_mesh (const TriangleMesh &tmesh, VertexPointMap vpmap, const GeomTraits &gt=GeomTraits())
 Constructor with one triangulated surface mesh. More...
 
 Side_of_triangle_mesh (const TriangleMesh &tmesh, const GeomTraits &gt=GeomTraits())
 Constructor with one surface triangle mesh, using get(boost::vertex_point, tmesh) as vertex point property map. More...
 
 Side_of_triangle_mesh (const AABB_tree &tree, const GeomTraits &gt=GeomTraits())
 Constructor that takes a pre-built CGAL AABB_tree of the triangulated surface mesh primitives. More...
 
 Side_of_triangle_mesh (Side_of_triangle_mesh &&other)
 Constructor moving an instance of Side_of_triangle_mesh to a new memory location with minimal memory copy. More...
 
Side_of_triangle_meshoperator= (Side_of_triangle_mesh &&other)
 Assign operator moving an instance of Side_of_triangle_mesh to this location with minimal memory copy. More...
 
Bounded_side operator() (const Point &point) const
 returns the location of a query point More...
 

Constructor & Destructor Documentation

◆ Side_of_triangle_mesh() [1/4]

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::Side_of_triangle_mesh ( const TriangleMesh &  tmesh,
VertexPointMap  vpmap,
const GeomTraits &  gt = GeomTraits() 
)

Constructor with one triangulated surface mesh.

Parameters
tmeshthe triangulated surface mesh bounding the domain to be tested
vpmapthe property map with the points associated to the vertices of tmesh
gtan instance of the geometric traits class
Precondition
CGAL::is_closed(tmesh) && CGAL::is_triangle_mesh(tmesh)

◆ Side_of_triangle_mesh() [2/4]

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::Side_of_triangle_mesh ( const TriangleMesh &  tmesh,
const GeomTraits &  gt = GeomTraits() 
)

Constructor with one surface triangle mesh, using get(boost::vertex_point, tmesh) as vertex point property map.

Parameters
tmeshthe triangulated surface mesh bounding the domain to be tested
gtan instance of the geometric traits class
Precondition
CGAL::is_closed(tmesh) && CGAL::is_triangle_mesh(tmesh)

◆ Side_of_triangle_mesh() [3/4]

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::Side_of_triangle_mesh ( const AABB_tree tree,
const GeomTraits &  gt = GeomTraits() 
)

Constructor that takes a pre-built CGAL AABB_tree of the triangulated surface mesh primitives.

Parameters
treea CGAL AABB_tree with AABB_face_graph_triangle_primitive as Primitive type
gtan instance of the geometric traits class
Precondition
CGAL::is_closed(tmesh) && CGAL::is_triangle_mesh(tmesh)

◆ Side_of_triangle_mesh() [4/4]

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::Side_of_triangle_mesh ( Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ > &&  other)

Constructor moving an instance of Side_of_triangle_mesh to a new memory location with minimal memory copy.

Parameters
otherThe instance to be moved

Member Function Documentation

◆ operator()()

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
Bounded_side CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::operator() ( const Point &  point) const

returns the location of a query point

Parameters
pointthe query point to be located with respect to the input polyhedral surface
Returns
  • CGAL::ON_BOUNDED_SIDE if the point is inside the volume bounded by the input triangle mesh
  • CGAL::ON_BOUNDARY if the point is on triangle mesh
  • CGAL::ON_UNBOUNDED_SIDE if the point is outside triangle mesh

◆ operator=()

template<class TriangleMesh, class GeomTraits, class VertexPointMap_ = Default>
Side_of_triangle_mesh& CGAL::Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ >::operator= ( Side_of_triangle_mesh< TriangleMesh, GeomTraits, VertexPointMap_ > &&  other)

Assign operator moving an instance of Side_of_triangle_mesh to this location with minimal memory copy.

Parameters
otherThe instance to be moved
Returns
A reference to this