\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.10.2 - Polygon Mesh Processing
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Corefinement and Boolean Operations

Functions to corefine triangulated surface meshes and compute triangulated surface meshes of the union, difference and intersection of the bounded volumes.

Functions

template<class TriangleMesh , class NamedParameters >
bool CGAL::Polygon_mesh_processing::does_bound_a_volume (const TriangleMesh &tm, const NamedParameters &np)
 indicates if tm bounds a volume. More...
 
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_union (TriangleMesh &tm1, TriangleMesh &tm2, TriangleMesh &tm_out, const NamedParameters1 &np1, const NamedParameters2 &np2, const NamedParametersOut &np_out)
 corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the union of the volumes bounded by tm1 and tm2. More...
 
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_intersection (TriangleMesh &tm1, TriangleMesh &tm2, TriangleMesh &tm_out, const NamedParameters1 &np1, const NamedParameters2 &np2, const NamedParametersOut &np_out)
 corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the intersection of the volumes bounded by tm1 and tm2. More...
 
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_difference (TriangleMesh &tm1, TriangleMesh &tm2, TriangleMesh &tm_out, const NamedParameters1 &np1, const NamedParameters2 &np2, const NamedParametersOut &np_out)
 corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the volume bounded by tm1 minus the volume bounded by tm2. More...
 
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
void CGAL::Polygon_mesh_processing::corefine (TriangleMesh &tm1, TriangleMesh &tm2, const NamedParameters1 &np1, const NamedParameters2 &np2, const bool throw_on_self_intersection=false)
 corefines tm1 and tm2. More...
 
template<class OutputIterator , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
OutputIterator CGAL::Polygon_mesh_processing::surface_intersection (const TriangleMesh &tm1, const TriangleMesh &tm2, OutputIterator polyline_output, const NamedParameters1 &np1, const NamedParameters2 &np2, const bool throw_on_self_intersection=false)
 computes the intersection of triangles of tm1 and tm2. More...
 

Function Documentation

template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
void CGAL::Polygon_mesh_processing::corefine ( TriangleMesh &  tm1,
TriangleMesh &  tm2,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2,
const bool  throw_on_self_intersection = false 
)

corefines tm1 and tm2.

For each input triangulated surface mesh, if a constrained edge is provided, intersection edges will be marked as constrained. If an edge that was marked as constrained is split, its sub-edges will be marked as constrained as well.

Precondition
!CGAL::Polygon_mesh_processing::does_self_intersect(tm1)
!CGAL::Polygon_mesh_processing::does_self_intersect(tm2)
Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
Parameters
tm1first input triangulated surface mesh
tm2second input triangulated surface mesh
np1optional sequence of Named Parameters among the ones listed below
np2optional sequence of Named Parameters among the ones listed below
throw_on_self_intersectionif true, for each input triangle mesh, the set of triangles closed to the intersection of tm1 and tm2 will be checked for self-intersection and CGAL::Corefinement::Self_intersection_exception will be thrown if at least one is found.
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm1 (tm2). If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm1 (tm2)

#include <CGAL/Polygon_mesh_processing/corefinement.h>

template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_difference ( TriangleMesh &  tm1,
TriangleMesh &  tm2,
TriangleMesh &  tm_out,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2,
const NamedParametersOut &  np_out 
)

corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the volume bounded by tm1 minus the volume bounded by tm2.

If tm_out is one of the input surface meshes, it will be updated to contain the output (in-place operation), otherwise the result will be inserted into tm_out without clearing it first.

Precondition
!CGAL::Polygon_mesh_processing::does_self_intersect(tm1)
!CGAL::Polygon_mesh_processing::does_self_intersect(tm2)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm1)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm2)
Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph. If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
NamedParametersOuta sequence of Named Parameters
Parameters
tm1first input triangulated surface mesh
tm2second input triangulated surface mesh
tm_outoutput surface mesh
np1optional sequence of Named Parameters among the ones listed below
np2optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm1 (tm2). If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm1 (tm2).
face_index_mapa property map containing the index of each face of tm1 (tm2)
Parameters
np_outoptional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm_out. If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm_out. An edge of tm_out is constrained if it is on the intersection of tm1 and tm2, or if the edge corresponds to a constrained edge in tm1 or tm2.
Returns
true if the output surface mesh is manifold and is put into tm_out. If false is returned and if tm_out is one of the input surface meshes, then tm_out is only corefined.

#include <CGAL/Polygon_mesh_processing/corefinement.h>

Examples:
Polygon_mesh_processing/corefinement_difference_remeshed.cpp.
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_intersection ( TriangleMesh &  tm1,
TriangleMesh &  tm2,
TriangleMesh &  tm_out,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2,
const NamedParametersOut &  np_out 
)

corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the intersection of the volumes bounded by tm1 and tm2.

If tm_out is one of the input surface meshes, it will be updated to contain the output (in-place operation), otherwise the result will be inserted into tm_out without clearing it first.

Precondition
!CGAL::Polygon_mesh_processing::does_self_intersect(tm1)
!CGAL::Polygon_mesh_processing::does_self_intersect(tm2)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm1)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm2)
Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph. If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
NamedParametersOuta sequence of Named Parameters
Parameters
tm1first input triangulated surface mesh
tm2second input triangulated surface mesh
tm_outoutput surface mesh
np1optional sequence of Named Parameters among the ones listed below
np2optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm1 (tm2). If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm1 (tm2).
face_index_mapa property map containing the index of each face of tm1 (tm2)
Parameters
np_outoptional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm_out. If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm_out. An edge of tm_out is constrained if it is on the intersection of tm1 and tm2, or if the edge corresponds to a constrained edge in tm1 or tm2.
Returns
true if the output surface mesh is manifold and is put into tm_out. If false is returned and if tm_out is one of the input surface meshes, then tm_out is only corefined.

#include <CGAL/Polygon_mesh_processing/corefinement.h>

Examples:
Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp.
template<class TriangleMesh , class NamedParameters1 , class NamedParameters2 , class NamedParametersOut >
bool CGAL::Polygon_mesh_processing::corefine_and_compute_union ( TriangleMesh &  tm1,
TriangleMesh &  tm2,
TriangleMesh &  tm_out,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2,
const NamedParametersOut &  np_out 
)

corefines tm1 and tm2 and puts in tm_out a triangulated surface mesh bounding the union of the volumes bounded by tm1 and tm2.

If tm_out is one of the input surface meshes, it will be updated to contain the output (in-place operation), otherwise the result will be inserted into tm_out without clearing it first.

Precondition
!CGAL::Polygon_mesh_processing::does_self_intersect(tm1)
!CGAL::Polygon_mesh_processing::does_self_intersect(tm2)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm1)
CGAL::Polygon_mesh_processing::does_bound_a_volume(tm2)
Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph. If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
NamedParametersOuta sequence of Named Parameters
Parameters
tm1first input triangulated surface mesh
tm2second input triangulated surface mesh
tm_outoutput surface mesh
np1optional sequence of Named Parameters among the ones listed below
np2optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm1 (tm2). If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm1 (tm2).
face_index_mapa property map containing the index of each face of tm1 (tm2)
Parameters
np_outoptional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm_out. If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
edge_is_constrained_mapa property map containing the constrained-or-not status of each edge of tm_out. An edge of tm_out is constrained if it is on the intersection of tm1 and tm2, or if the edge corresponds to a constrained edge in tm1 or tm2.
Returns
true if the output surface mesh is manifold and is put into tm_out. If false is returned and if tm_out is one of the input surface meshes, then tm_out is only corefined.

#include <CGAL/Polygon_mesh_processing/corefinement.h>

Examples:
Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp, and Polygon_mesh_processing/corefinement_mesh_union.cpp.
template<class TriangleMesh , class NamedParameters >
bool CGAL::Polygon_mesh_processing::does_bound_a_volume ( const TriangleMesh &  tm,
const NamedParameters &  np 
)

indicates if tm bounds a volume.

See Definitions for details.

Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph. If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParametersa sequence of Named Parameters
Parameters
tma triangulated surface mesh
npoptional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm. If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available in TriangleMesh
face_index_mapa property map containing the index of each face of tm1 (tm2). Note that if the property map is writable, the indices of the faces of tm1 and tm2 will be set after the corefinement is done.

#include <CGAL/Polygon_mesh_processing/corefinement.h>

template<class OutputIterator , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
OutputIterator CGAL::Polygon_mesh_processing::surface_intersection ( const TriangleMesh &  tm1,
const TriangleMesh &  tm2,
OutputIterator  polyline_output,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2,
const bool  throw_on_self_intersection = false 
)

computes the intersection of triangles of tm1 and tm2.

The output is a set of polylines with all vertices but endpoints being of degree 2.

Precondition
!CGAL::Polygon_mesh_processing::does_self_intersect(tm1)
!CGAL::Polygon_mesh_processing::does_self_intersect(tm2)
Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
OutputIteratoran output iterator in which std::vector of points can be put. The point type is the one from the vertex property map
Parameters
tm1first input triangulated surface mesh
tm2second input triangulated surface mesh
polyline_outputoutput iterator of polylines. Each polyline will be given as a vector of points
throw_on_self_intersectionif true, for each input triangle mesh, the set of triangles closed to the intersection of tm1 and tm2 will be checked for self-intersection and CGAL::Corefinement::Self_intersection_exception will be thrown if at least one is found.
np1optional sequence of Named Parameters among the ones listed below
np2optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapa property map with the points associated to the vertices of tm1 (tm2). The two property map types must be the same.

#include <CGAL/Polygon_mesh_processing/intersection.h>