CGAL 5.5.5 - 2D Conforming Triangulations and Meshes
CGAL::Delaunay_mesher_2< CDT, Criteria > Class Template Reference

#include <CGAL/Delaunay_mesher_2.h>

Definition

This class implements a 2D mesh generator.

Template Parameters
CDTmust be a 2D constrained Delaunay triangulation, and type CDT::Face should be a model of the concept DelaunayMeshFaceBase_2. The geometric traits class of the instance of CDT has to be a model of the concept DelaunayMeshTraits_2.
Criteriamust be a model of the concept MeshingCriteria_2. This traits class defines the shape and size criteria for the triangles of the mesh. Criteria::Face_handle has to be the same as CDT::Face_handle.

Using This Class

The constructor of the class Delaunay_mesher_2 takes a reference to a CDT as an argument. A call to the refinement method refine_mesh() will refine the constrained Delaunay triangulation into a mesh satisfying the size and shape criteria specified in the traits class. Note that if, during the life time of the Delaunay_mesher_2 object, the triangulation is externally modified, any further call to its member methods may crash. Consider constructing a new Delaunay_mesher_2 object if the triangulation has been modified.

Meshing Domain

The domain to be mesh is defined by the constrained edges and a set of seed points. The constrained edges divides the plane into several connected components. The mesh domain is either the union of the bounded connected components including at least one seed, or the union of the bounded connected components that do no contain any seed. Note that the unbounded component of the plane is never meshed.

See also
CGAL::lloyd_optimize_mesh_2
Examples:
Mesh_2/mesh_class.cpp, and Mesh_2/mesh_optimization.cpp.

Types

typedef CDT::Geom_traits Geom_traits
 the geometric traits class.
 
typedef unspecified_type Seeds_iterator
 const iterator over defined seeds. More...
 

Creation

 Delaunay_mesher_2 (CDT &t, Criteria criteria=Criteria())
 Create a new mesher, working on t, with meshing criteria criteria.
 

Seeds functions

The following functions are used to define seeds.

void clear_seeds ()
 Sets seeds to the empty set. More...
 
template<class InputIterator >
void set_seeds (InputIterator begin, InputIterator end, const bool mark=false)
 Sets seeds to the sequence [begin, end). More...
 
Seeds_const_iterator seeds_begin () const
 Start of the seeds sequence.
 
Seeds_const_iterator seeds_end () const
 Past the end of the seeds sequence.
 

Meshing methods

The function set_criteria() scans all faces to recalculate the list of bad faces, that are faces not conforming to the meshing criteria.

This function actually has an optional argument that permits to prevent this recalculation. The filling of the list of bad faces can then be done by a call to set_bad_faces.

void refine_mesh ()
 Refines the constrained Delaunay triangulation into a mesh satisfying the criteria defined by the traits.
 
const Criteria & get_criteria ()
 Returns a const reference to the criteria traits object.
 
void set_criteria (Criteria criteria)
 Assigns criteria to the criteria traits object.
 
void set_criteria (Criteria criteria, bool recalculate_bad_faces)
 Assigns criteria to the criteria traits object. More...
 
template<class InputIterator >
void set_bad_faces (InputIterator begin, InputIterator end)
 This method permits to set the list of bad triangles directly, from the sequence [begin, end), so that the algorithm will not scan the whole set of triangles to find bad ones. More...
 

Step by Step Operations

The Delaunay_mesher_2 class allows, for debugging or demos, to play the meshing algorithm step by step, using the following methods.

void init ()
 This method must be called just before the first call to the following step by step refinement method, that is when all vertices and constrained edges have been inserted into the constrained Delaunay triangulation. More...
 
bool is_refinement_done ()
 Tests if the step by step refinement algorithm is done. More...
 
bool step_by_step_refine_mesh ()
 Applies one step of the algorithm, by inserting one point, if the algorithm is not done. More...
 

Member Typedef Documentation

◆ Seeds_iterator

template<typename CDT , typename Criteria >
typedef unspecified_type CGAL::Delaunay_mesher_2< CDT, Criteria >::Seeds_iterator

const iterator over defined seeds.

Its value type is Geom_traits::Point_2.

Member Function Documentation

◆ clear_seeds()

template<typename CDT , typename Criteria >
void CGAL::Delaunay_mesher_2< CDT, Criteria >::clear_seeds ( )

Sets seeds to the empty set.

All finite connected components of the constrained triangulation will be refined.

◆ init()

template<typename CDT , typename Criteria >
void CGAL::Delaunay_mesher_2< CDT, Criteria >::init ( )

This method must be called just before the first call to the following step by step refinement method, that is when all vertices and constrained edges have been inserted into the constrained Delaunay triangulation.

It must be called again before any subsequent calls to the step by step refinement method if new vertices or constrained edges have been inserted since the last call.

◆ is_refinement_done()

template<typename CDT , typename Criteria >
bool CGAL::Delaunay_mesher_2< CDT, Criteria >::is_refinement_done ( )

Tests if the step by step refinement algorithm is done.

If it returns true, the following calls to step_by_step_refine_mesh will not insert any points, until some new constrained segments or points are inserted in the triangulation and init is called again.

◆ set_bad_faces()

template<typename CDT , typename Criteria >
template<class InputIterator >
void CGAL::Delaunay_mesher_2< CDT, Criteria >::set_bad_faces ( InputIterator  begin,
InputIterator  end 
)

This method permits to set the list of bad triangles directly, from the sequence [begin, end), so that the algorithm will not scan the whole set of triangles to find bad ones.

To use if there is a non-naive way to find bad triangles.

Template Parameters
InputIteratormust be an input iterator with value type Face_handle.

◆ set_criteria()

template<typename CDT , typename Criteria >
void CGAL::Delaunay_mesher_2< CDT, Criteria >::set_criteria ( Criteria  criteria,
bool  recalculate_bad_faces 
)

Assigns criteria to the criteria traits object.

If recalculate_bad_faces is false, the list of bad faces is let empty and the function set_bad_faces() should be called before refine_mesh.

◆ set_seeds()

template<typename CDT , typename Criteria >
template<class InputIterator >
void CGAL::Delaunay_mesher_2< CDT, Criteria >::set_seeds ( InputIterator  begin,
InputIterator  end,
const bool  mark = false 
)

Sets seeds to the sequence [begin, end).

If mark==true, the mesh domain is the union of the bounded connected components including at least one seed. If mark==false, the domain is the union of the bounded components including no seed. Note that the unbounded component of the plane is never meshed.

Template Parameters
InputIteratormust be an input iterator with value type Geom_traits::Point_2.

◆ step_by_step_refine_mesh()

template<typename CDT , typename Criteria >
bool CGAL::Delaunay_mesher_2< CDT, Criteria >::step_by_step_refine_mesh ( )

Applies one step of the algorithm, by inserting one point, if the algorithm is not done.

Returns false iff no point has been inserted because the algorithm is done.