Add Surface_mesher doc

This commit is contained in:
Philipp Möller 2012-09-17 13:12:18 +00:00
parent 69bbb0f174
commit f3b773acb4
31 changed files with 2598 additions and 5 deletions

27
.gitattributes vendored
View File

@ -5837,6 +5837,33 @@ Surface_mesher/demo/Surface_mesher/windows/res/idb5.bmp -text svneol=unset#image
Surface_mesher/demo/Surface_mesher/windows/res/idb6.bmp -text svneol=unset#image/bmp
Surface_mesher/demo/Surface_mesher/windows/res/idb7.bmp -text svneol=unset#image/bmp
Surface_mesher/demo/Surface_mesher/windows/res/idb8.bmp -text svneol=unset#image/bmp
Surface_mesher/doc/Surface_mesher/CGAL/Gray_level_image_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/IO/output_surface_facets_to_polyhedron.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Implicit_surface_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_cell_base_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_complex_2_in_triangulation_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_default_criteria_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_default_triangulation_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_traits_generator_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/Surface_mesh_vertex_base_3.h -text
Surface_mesher/doc/Surface_mesher/CGAL/make_surface_mesh.h -text
Surface_mesher/doc/Surface_mesher/Concepts/ImplicitFunction.h -text
Surface_mesher/doc/Surface_mesher/Concepts/ImplicitSurfaceTraits_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshCellBase_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshComplex_2InTriangulation_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshFacetsCriteria_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshTraits_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshTriangulation_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/SurfaceMeshVertexBase_3.h -text
Surface_mesher/doc/Surface_mesher/Concepts/Surface_3.h -text
Surface_mesher/doc/Surface_mesher/PackageDescription.txt -text
Surface_mesher/doc/Surface_mesher/Surface_mesher.txt -text
Surface_mesher/doc/Surface_mesher/examples.txt -text
Surface_mesher/doc/Surface_mesher/fig/segmented_head-small.png -text svneol=unset#image/png
Surface_mesher/doc/Surface_mesher/fig/segmented_head.png -text svneol=unset#image/png
Surface_mesher/doc/Surface_mesher/fig/skull-surface-small.png -text svneol=unset#image/png
Surface_mesher/doc/Surface_mesher/fig/skull-surface.png -text svneol=unset#image/png
Surface_mesher/doc/Surface_mesher/fig/sphere-surface.png -text svneol=unset#image/png
Surface_mesher/doc_tex/Surface_mesher/segmented_head-small.png -text svneol=unset#image/png
Surface_mesher/doc_tex/Surface_mesher/segmented_head.png -text svneol=unset#image/png
Surface_mesher/doc_tex/Surface_mesher/skull-surface-small.png -text svneol=unset#image/png

View File

@ -1,6 +1,3 @@
\page ChapterAlgebraicFoundations Algebraic Foundations
namespace CGAL {
/*!

View File

@ -111,6 +111,22 @@ namespace for the XML file to be processed properly. -->
</doxygen>
</project>
<project>
<name>3D Surface Mesh Generation</name>
<input>../Surface_mesher/doc</input>
<doxygen>
<string name="STRIP_FROM_PATH">../Surface_mesher/doc/Surface_mesher/</string>
<string name="STRIP_FROM_INC_PATH">../Surface_mesher/doc/Surface_mesher/</string>
<string name="GENERATE_TAGFILE">./tags/Surface_mesher.tag</string>
<string name="IMAGE_PATH">../Surface_mesher/doc/Surface_mesher/fig</string>
<string name="EXAMPLE_PATH">../Surface_mesher/examples</string>
<list name="TAGFILES" append="true">
<item>./tags/Triangulation_2.tag=../../CGAL.CGAL.2D-Triangulation/html</item>
</list>
</doxygen>
</project>
<project>
<name>Estimation of Local Differential Properties of Point-Sampled Surfaces</name>
<input>../Jet_fitting_3/doc</input>
@ -1004,6 +1020,7 @@ namespace for the XML file to be processed properly. -->
<item>../Nef_S2/doc/Nef_S2/fig</item>
<item>../Nef_3/doc/Nef_3/fig</item>
<item>../Mesh_2/doc/Mesh_2/fig</item>
<item>../Surface_mesher/doc/Surface_mesher/fig</item>
<item>../Mesh_3/doc/Mesh_3/fig</item>
<item>../Jet_fitting_3/doc/Jet_fitting_3/fig</item>
<item>../Minkowski_sum_2/doc/Minkowski_sum_2/fig</item>
@ -1035,6 +1052,7 @@ namespace for the XML file to be processed properly. -->
<item>../Straight_skeleton_2/doc/Straight_skeleton_2/fig</item>
<item>../Voronoi_diagram_2/doc/Voronoi_diagram_2/fig</item>
<item>../Surface_mesh_simplification/doc/Surface_mesh_simplification/fig</item>
<item>../Surface_mesh_parameterization/doc/Surface_mesh_parameterization/fig</item>
<item>../Stream_lines_2/doc/Stream_lines_2/fig</item>
<item>../Stream_support/doc/IOstream/fig</item>
</list>
@ -1065,6 +1083,7 @@ namespace for the XML file to be processed properly. -->
<item>./tags/Nef_S2.tag=../../CGAL.CGAL.2D-Boolean-Operations-on-Nef-Polygons-Embedded-on-the-Sphere/html</item>
<item>./tags/Nef_3.tag=../../CGAL.CGAL.3D-Boolean-Operations-on-Nef-Polyhedra/html</item>
<item>./tags/Mesh_2.tag=../../CGAL.CGAL.2D-Conforming-Triangulations-and-Meshes/html</item>
<item>./tags/Surface_mesher.tag=../../CGAL.CGAL.3D-Surface-Mesh-Generation/html</item>
<item>./tags/Mesh_3.tag=../../CGAL.CGAL.3D-Mesh-Generation/html</item>
<item>./tags/Jet_fitting_3.tag=../../CGAL.CGAL.Estimation-of-Local-Differential-Properties-of-Point-Sampled-Surfaces/html</item>
<item>./tags/Minkowski_sum_2.tag=../../CGAL.CGAL.2D-Minkowski-Sums/html</item>
@ -1098,6 +1117,7 @@ namespace for the XML file to be processed properly. -->
<item>./tags/Surface_mesh_simplification.tag=../../CGAL.CGAL.Triangulated-Surface-Mesh-Simplification/html</item>
<item>./tags/Stream_lines_2.tag=../../CGAL.CGAL.2D Placement-of-Streamlines/html</item>
<item>./tags/Stream_support.tag=../../CGAL.CGAL.IO-Streams/html</item>
<item>./tags/Surface_mesh_parameterization.tag=../../CGAL.CGAL.Planar-Parameterization-of-Triangulated-Surface-Meshes</item>
</list>
<string name="HTML_EXTRA_STYLESHEET">cgal_stylesheet.css</string>
<bool name="ALLEXTERNALS">true</bool>

View File

@ -4,8 +4,6 @@ namespace CGAL {
/*!
\ingroup PkgPolynomial
\anchor Polynomial_type_generator
This class template provides a convenient way to obtain the type representing a multivariate polynomial with `d` variables, where `T` is the innermost coefficient type. In case `T` happens to be a `CGAL::Polynomial` the generator will add `d` variables to `T`.
`T` must be a model of `IntegralDomainWithoutDivision`.

View File

@ -0,0 +1,72 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
A 3D gray image is a
tri-dimensional array that associates a scalar value to each triple of
integer \f$ (x, y, z)\f$ in the range of the image. A trilinear interpolation
algorithm provides a map \f$ f : \R^3 \longrightarrow \R\f$.
The class `Gray_level_image_3` is a 3D gray image loader and a model
of the concept `ImplicitFunction`.
An object of the class `Gray_level_image_3` is created with a parameter
`iso` and then its `operator()` implements
the function `sign of (f(p) - iso)`, for \f$ p \in \R^3\f$.
Plugging such a function in the creation of the `Implicit_surface_3`
object given as parameter to `make_surface_mesh` yields
a mesh approximating the level with value `iso`
in the input 3D gray image.
`Gray_level_image_3` provides an interface with an auxiliary library called
<I>CGAL_ImageIO</I>. An executable that uses `Gray_level_image_3` must be linked with
the <I>CGAL_ImageIO</I> library. This library is shipped with \cgal and
will be linked automatically by any makefile created by the script
`cgal_create_makefile`.
The library <I>CGAL_ImageIO</I> and therefore `Gray_level_image_3` support
several types of 3D images: INRIMAGE (extension .inr[.gz]), GIS (extension
.dim, of .ima[.gz]), and ANALYZE (extension .hdr, or .img[.gz]).
\models `ImplicitFunction`
\sa `ImplicitFunction`
\sa `Implicit_surface_3<Traits, Function>`
\sa `make_surface_mesh`
*/
template< typename FT, typename Point >
class Gray_level_image_3 {
public:
/// \name Types
/// @{
/*!
the numerical type `FT`
*/
typedef Hidden_type FT;
/*!
the point type `Point`
*/
typedef Hidden_type FT;
/// @}
/// \name Creation
/// @{
/*!
`filename` is the path to a file of a type supported by <I>ImageIO</I>.
`iso_value` is an isovalue of \f$ f\f$.
*/
Gray_level_image_3(const char* filename, FT iso_value);
/// @}
}; /* end Gray_level_image_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,34 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
`output_surface_facets_to_polyhedron()` converts a surface
reconstructed by `make_surface_mesh()` to a `Polyhedron_3<Traits>`.
Gets reconstructed surface out of a
`SurfaceMeshComplex_2InTriangulation_3` object.
This variant exports the surface as a polyhedron. It requires the
surface to be manifold. For this purpose, you may call
`make_surface_mesh`() with `Manifold_tag` or
`Manifold_with_boundary_tag` parameter.
### Template Parameters ###
`SurfaceMeshComplex_2InTriangulation_3`: model of the `SurfaceMeshComplex_2InTriangulation_3` concept. `Polyhedron`: an instance of `Polyhedron_3<Traits>`.
### Returns ###
true if the surface is manifold and orientable.
### Parameters ###
`c2t3`: Input surface. `output_polyhedron`: Output polyhedron.
\sa `CGAL::output_surface_facets_to_off`
*/
template<class SurfaceMeshComplex_2InTriangulation_3, class Polyhedron> bool output_surface_facets_to_polyhedron(const SurfaceMeshComplex_2InTriangulation_3& c2t3, Polyhedron& output_polyhedron);
} /* namespace CGAL */

View File

@ -0,0 +1,72 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Implicit_surface_3` implements a surface described
as the zero level
set of a function \f$ f : \R^3 \longrightarrow \R\f$.
For this type of surface, the library provides a partial specialization
of the surface mesher traits generator:
`Surface_mesh_traits_generator_3<Implicit_surface_3<Traits, Function> >`,
that provides a traits class, model of the concept
`SurfaceMeshTraits_3`,
to be used by the surface mesher.
The parameter `Traits` is a traits class
that has to be implemented with a model of
`ImplicitSurfaceTraits_3`.
Actually, this traits class implements the oracle needed by the
surface mesher:
the types, predicates and constructors provided
in `Traits` are
passed by the surface mesher traits generator
to the generated the traits class
used by the surface mesh generator.
The template parameter `Function` stands for a model
of the concept `ImplicitFunction`.
The number type `Function::FT` has to match
the type `Traits::FT`.
\sa `make_surface_mesh`
\sa `Surface_3`
\sa `Surface_mesh_traits_generator_3<Surface>`
\sa `ImplicitSurfaceTraits`
\sa `ImplicitFunction`
*/
template< typename Traits, typename Function >
class Implicit_surface_3 {
public:
/// \name Creation
/// @{
/*!
`f` is the object of type `Function` that represents the implicit
surface.
`bounding_sphere` is a bounding sphere of the implicit surface. The
evaluation of `f` at the center `c` of this sphere must be
negative: \f$ f(c)<0\f$.
`error_bound` is a relative error bound
used to compute intersection points between the implicit surface
and query segments. This bound is used in the default generated traits class.
In this traits class, the intersection points between
the surface and segments/rays/line are constructed by dichotomy. The
dichotomy is stopped when the size of the intersected
segment is less than the product of `error_bound` by the
radius of `bounding_sphere`.
*/
Implicit_surface_3(Function f,
Sphere_3 bounding_sphere,
FT error_bound = FT(1e-3));
/// @}
}; /* end Implicit_surface_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,35 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_cell_base_3` is a model of the concept
`SurfaceMeshCellBase_3`.
It is designed to serve as vertex base class
in a triangulation class `Tr`
plugged in a `Surface_mesh_complex_2_in_triangulation_3<Tr>`
class.
The first template parameter is the geometric traits class.
The second template parameter is a base class. It
has to be a model of the concept `TriangulationCellBase_3`
and
defaults to `Triangulation_cell_base_3 <GT>`.
\models ::SurfaceMeshCellBase_3
\sa `SurfaceMeshComplex_2InTriangulation_3`
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `SurfaceMeshTriangulation_3`
\sa `make_surface_mesh`
*/
template< typename Gt, typename Cb >
class Surface_mesh_cell_base_3 : public Cb {
public:
/// @}
}; /* end Surface_mesh_cell_base_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,38 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_complex_2_in_triangulation_3` implements a data structure to store
the restricted Delaunay triangulation used by the surface mesh generator.
The restricted Delaunay triangulation is stored as a two dimensional
complex embedded in a three dimensional triangulation.
The class `Surface_mesh_complex_2_in_triangulation_3` is a model of the concept `SurfaceMeshComplex_2InTriangulation_3`
and can be plugged as the template parameter `C2T3`
in the function template `make_surface_mesh`.
The template parameter `Tr` has to be instantiated
with a model of the concept `SurfaceMeshTriangulation_3`.
(Any three dimensional triangulation of
\cgal is a model of `Triangulation_3`
provided that its vertex and cell base class be models
of the concept `SurfaceMeshVertexBase_3` and
`SurfaceMeshCellBase_3`
respectively.)
\models ::SurfaceMeshComplex_2InTriangulation_3
\sa `make_surface_mesh`
\sa `SurfaceMeshTriangulation_3`
*/
template< typename Tr, typename Edge_info = void >
class Surface_mesh_complex_2_in_triangulation_3 {
public:
/// @}
}; /* end Surface_mesh_complex_2_in_triangulation_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,65 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_default_criteria_3` implements the most commonly used combination
of meshing criteria. It involves mainly three criteria which are
in order:
<UL>
<LI>a lower bound on the minimum angle in degrees of the surface mesh facets.
<LI>an upper bound on the radius of surface Delaunay balls.
A surface Delaunay ball is a ball circumscribing a facet,
centered on the surface and empty of vertices.
Such a ball exists for each facet
of the current surface mesh.
Indeed the current surface mesh
is the Delaunay triangulation of the current sampling restricted to
the surface
which is just the set of facets in the three dimensional Delaunay triangulation of
the sampling that have a Delaunay surface ball.
<LI>an upper bound on the center-center distances of the surface mesh facets.
The center-center distance of a surface mesh facet
is the distance between the facet circumcenter and the
center of its surface Delaunay ball.
</UL>
\models ::SurfaceMeshFacetsCriteria_3
\sa `make_surface_mesh`
*/
template< typename Tr >
class Surface_mesh_default_criteria_3 {
public:
/// \name Types
/// @{
/*!
The numerical type.
*/
typedef Tr::FT FT;
/// @}
/// \name Creation
/// @{
/*!
Returns a `Surface_mesh_default_criteria_3` with `angle_bound`, `radius_bound`,
`distance_bound` as bounds for the minimum facet angle in degrees,
the radius of the surface Delaunay balls
and the center-center distances respectively.
*/
Surface_mesh_default_criteria_3(FT angle_bound,
FT radius_bound,
FT distance_bound);
/// @}
}; /* end Surface_mesh_default_criteria_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,26 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_default_triangulation_3` is a model of the concept
`SurfaceMeshTriangulation_3`, whose vertex base and cell base classes
are models of the concepts
`SurfaceMeshVertexBase_3` and
`SurfaceMeshCellBase_3` respectively.
\models ::SurfaceMeshTriangulation_3
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `make_surface_mesh`
*/
class Surface_mesh_default_triangulation_3 {
public:
/// @}
}; /* end Surface_mesh_default_triangulation_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,34 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_traits_generator_3` provides a type `Type`,
that is a model of the concept `SurfaceMeshTraits_3` for the surface
type `Surface`. The type `Surface` is required to be a model of the
concept `Surface_3`, which means that it is copy constructible and
assignable. In addition, a `Surface` type is required <UL> <LI>either
to provide a nested type `Surface::Surface_mesher_traits_3` that is a
model of `SurfaceMeshTraits_3` <LI>or to be a surface type for which
a specialization of the traits generator
`Surface_mesh_traits_generator_3` exists. </UL> Currently, the
library provides partial specializations of the traits generator for
implicit surfaces (`Implicit_surface_3<Traits, Function>`) and gray
level images (`Gray_level_image_3<FT, Point>`).
\sa `SurfaceMeshTraits_3`
\sa `make_surface_mesh`
*/
template< typename Surface >
class Surface_mesh_traits_generator_3 {
public:
/*!
A model of the concept `SurfaceMeshTraits_3`.
*/
typedef Hidden_type Type;
}; /* end Surface_mesh_traits_generator_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,36 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Surface_mesh_vertex_base_3` is a model of the concept
`SurfaceMeshVertexBase_3`.
It is designed to serve as vertex base class
in a triangulation class `Tr`
plugged in a `Surface_mesh_complex_2_in_triangulation_3<Tr>`
class.
The first template parameter is the geometric traits class.
The second template parameter is a base class. It
has to be a model of the concept `TriangulationVertexBase_3`
and
defaults to `Triangulation_vertex_base_3 <Gt>`.
\models ::SurfaceMeshVertexBase_3
\sa `SurfaceMeshComplex_2InTriangulation_3`
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `SurfaceMeshTriangulation_3`
\sa `make_surface_mesh`
*/
template< typename Gt, typename Vb >
class Surface_mesh_vertex_base_3 : public Vb {
public:
/// @}
}; /* end Surface_mesh_vertex_base_3 */
} /* end namespace CGAL */

View File

@ -0,0 +1,353 @@
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The function `make_surface_mesh` is a surface mesh generator,
that is a function to build a two dimensional mesh
approximating a surface.
The library provides two overloaded version
of this function:
Parameters
--------------
The template parameter `SurfaceMeshC2T3`
is required to be a model of the concept
`SurfaceMeshComplex_2InTriangulation_3`,
a data structure able to represent a two dimensional
complex embedded in a three dimensional triangulation.
The argument `c2t3` of type `SurfaceMeshC2T3`, passed by reference
to the surface mesh generator,
is used to maintain the current approximating mesh and it stores
the final mesh at the end of the procedure.
The type `SurfaceMeshC2T3` is in particular required to
provide a type `SurfaceMeshC2T3::Triangulation_3`
for the three dimensional triangulation
embedding the surface mesh.
The vertex and cell base classes of the triangulation
`SurfaceMeshC2T3::Triangulation_3` are required
to be models of the concepts
`SurfaceMeshVertexBase_3` and
`SurfaceMeshCellBase_3` respectively.
The template parameter `Surface` stands for the surface type.
This type has to be a model of the concept `Surface_3`.
The knowledge on the surface, required by the surface mesh generator
is encapsulated in a
traits class. Actually, the mesh generator accesses the surface to be meshed
through this traits class only.
The traits class is required to be a model
of the concept `SurfaceMeshTraits_3`.
In the first version
of `make_surface_mesh` the surface type is a template parameter `Surface`
and the surface mesh generator traits type
is automatically generated form the surface type through
the class
`Surface_mesh_traits_generator_3<Surface>`.
The difference between the two overloaded versions of
`make_surface_mesh`
can be explained as follows
<UL>
<LI>In the first overloaded version of
of `make_surface_mesh`, the surface type is given
as template parameter (`Surface`) and the `surface`
to be meshed is passed as parameter to the mesh generator.
In that case the surface mesh generator traits type
is automatically generated form the surface type
by an auxiliary class called the `Surface_mesh_traits_generator_3`.
<LI>In the second overloaded version of `make_surface_mesh`,
the surface mesh generator traits type is provided
by the template parameter `SurfaceMeshTraits_3`
and the surface type is obtained from this traits type.
Both the surface and the traits
are passed to the mesh generator as arguments.
</UL>
The first overloaded version can be used
whenever the surface type either provides a nested type
`Surface::Surface_mesher_traits_3`
that is a model of `SurfaceMeshTraits_3`
or is a surface type for which a specialization
of the traits generator `Surface_mesh_traits_generator_3<Surface>`
is provided.
Currently, the library provides partial specializations
of `Surface_mesher_traits_generator_3<Surface>`
for implicit surfaces (`Implicit_surface_3<Traits, Function>`) and
gray level images (`Gray_level_image_3<FT, Point>`).
The template parameter `FacetsCriteria` has to be a model
of the concept `SurfaceMeshFacetsCriteria_3`.
The argument of type `FacetsCriteria` passed to the surface
mesh generator specifies the size and shape requirements
on the output surface mesh.
The template parameter `Tag`
is a tag whose type affects the behavior of the
meshing algorithm. The function `make_surface_mesh` has specialized versions
for the following tag types:
- `Manifold_tag`: the output mesh is guaranteed to be a manifold
surface without boundary.
- `Manifold_with_boundary_tag`: the output mesh is guaranteed to be
manifold but may have boundaries.
- `Non_manifold_tag`: the algorithm relies on the given criteria and
guarantees nothing else.
The Delaunay refinement
process is started with an initial set of points which is the union
of two sets: the
set of vertices in the initial triangulation pointed to by the
`c2t3` argument and a set of
points provided by the traits class.
The optional parameter `initial_number_of_points`
allows to monitor the number of points in this second set.
(This parameter is passed to the `operator()` of
the constructor object `Construct_initial_points`
in the traits class.)
The meshing algorithm requires that the initial set of points
includes at least one point
on each connected components of the surface to be meshed.
one.
\sa `SurfaceMeshComplex_2InTriangulation_3`
\sa `SurfaceMeshCellBase_3`
\sa `SurfaceMeshVertexBase_3`
\sa `Surface_3`
\sa `SurfaceMeshFacetsCriteria_3`
\sa `Surface_mesh_default_triangulation_3`
*/
template <class SurfaceMeshC2T3,
class Surface,
class FacetsCriteria,
class Tag >
void make_surface_mesh(SurfaceMeshC2T3& c2t3,
Surface surface,
FacetsCriteria criteria,
Tag,
int initial_number_of_points = 20) ;
/*!
\ingroup PkgSurfaceMesher3
The function `make_surface_mesh` is a surface mesh generator,
that is a function to build a two dimensional mesh
approximating a surface.
The library provides two overloaded version
of this function:
Parameters
--------------
The template parameter `SurfaceMeshC2T3`
is required to be a model of the concept
`SurfaceMeshComplex_2InTriangulation_3`,
a data structure able to represent a two dimensional
complex embedded in a three dimensional triangulation.
The argument `c2t3` of type `SurfaceMeshC2T3`, passed by reference
to the surface mesh generator,
is used to maintain the current approximating mesh and it stores
the final mesh at the end of the procedure.
The type `SurfaceMeshC2T3` is in particular required to
provide a type `SurfaceMeshC2T3::Triangulation_3`
for the three dimensional triangulation
embedding the surface mesh.
The vertex and cell base classes of the triangulation
`SurfaceMeshC2T3::Triangulation_3` are required
to be models of the concepts
`SurfaceMeshVertexBase_3` and
`SurfaceMeshCellBase_3` respectively.
The template parameter `Surface` stands for the surface type.
This type has to be a model of the concept `Surface_3`.
The knowledge on the surface, required by the surface mesh generator
is encapsulated in a
traits class. Actually, the mesh generator accesses the surface to be meshed
through this traits class only.
The traits class is required to be a model
of the concept `SurfaceMeshTraits_3`.
In the first version
of `make_surface_mesh` the surface type is a template parameter `Surface`
and the surface mesh generator traits type
is automatically generated form the surface type through
the class
`Surface_mesh_traits_generator_3<Surface>`.
The difference between the two overloaded versions of
`make_surface_mesh`
can be explained as follows
<UL>
<LI>In the first overloaded version of
of `make_surface_mesh`, the surface type is given
as template parameter (`Surface`) and the `surface`
to be meshed is passed as parameter to the mesh generator.
In that case the surface mesh generator traits type
is automatically generated form the surface type
by an auxiliary class called the `Surface_mesh_traits_generator_3`.
<LI>In the second overloaded version of `make_surface_mesh`,
the surface mesh generator traits type is provided
by the template parameter `SurfaceMeshTraits_3`
and the surface type is obtained from this traits type.
Both the surface and the traits
are passed to the mesh generator as arguments.
</UL>
The first overloaded version can be used
whenever the surface type either provides a nested type
`Surface::Surface_mesher_traits_3`
that is a model of `SurfaceMeshTraits_3`
or is a surface type for which a specialization
of the traits generator `Surface_mesh_traits_generator_3<Surface>`
is provided.
Currently, the library provides partial specializations
of `Surface_mesher_traits_generator_3<Surface>`
for implicit surfaces (`Implicit_surface_3<Traits, Function>`) and
gray level images (`Gray_level_image_3<FT, Point>`).
The template parameter `FacetsCriteria` has to be a model
of the concept `SurfaceMeshFacetsCriteria_3`.
The argument of type `FacetsCriteria` passed to the surface
mesh generator specifies the size and shape requirements
on the output surface mesh.
The template parameter `Tag`
is a tag whose type affects the behavior of the
meshing algorithm. The function `make_surface_mesh` has specialized versions
for the following tag types:
- `Manifold_tag`: the output mesh is guaranteed to be a manifold
surface without boundary.
- `Manifold_with_boundary_tag`: the output mesh is guaranteed to be
manifold but may have boundaries.
- `Non_manifold_tag`: the algorithm relies on the given criteria and
guarantees nothing else.
The Delaunay refinement
process is started with an initial set of points which is the union
of two sets: the
set of vertices in the initial triangulation pointed to by the
`c2t3` argument and a set of
points provided by the traits class.
The optional parameter `initial_number_of_points`
allows to monitor the number of points in this second set.
(This parameter is passed to the `operator()` of
the constructor object `Construct_initial_points`
in the traits class.)
The meshing algorithm requires that the initial set of points
includes at least one point
on each connected components of the surface to be meshed.
one.
\sa `SurfaceMeshComplex_2InTriangulation_3`
\sa `SurfaceMeshCellBase_3`
\sa `SurfaceMeshVertexBase_3`
\sa `Surface_3`
\sa `SurfaceMeshFacetsCriteria_3`
\sa `Surface_mesh_default_triangulation_3`
*/
template <class SurfaceMeshC2T3,
class SurfaceMeshTraits,
class FacetsCriteria,
class Tag >
void make_surface_mesh(SurfaceMeshC2T3& c2t3,
SurfaceMeshTraits::Surface_3 surface,
SurfaceMeshTraits traits,
FacetsCriteria criteria,
Tag,
int initial_number_of_points = 20 );
} /* namespace CGAL */
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Manifold_tag` is a tag class used to monitor the
surface meshing algorithm. When instantiated with the tag
`Manifold_tag` the function template
`make_surface_mesh`
ensures that the output mesh is a manifold surface
without boundary.
\sa `make_surface_mesh`
\sa `Manifold_with_boundary_tag`
\sa `Non_manifold_tag`
*/
class Manifold_tag {
public:
/// @}
}; /* end Manifold_tag */
} /* end namespace CGAL */
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Manifold_with_boundary_tag` is a tag class used to monitor the
surface meshing algorithm. When instantiated with the tag
`Manifold_with_boundary_tag`, the function template
`make_surface_mesh`
ensures that the output mesh is a manifold surface
but it may have boundaries.
\sa `make_surface_mesh`
\sa `Manifold_tag`
\sa `Non_manifold_tag`
*/
class Manifold_with_boundary_tag {
public:
/// @}
}; /* end Manifold_with_boundary_tag */
} /* end namespace CGAL */
namespace CGAL {
/*!
\ingroup PkgSurfaceMesher3
The class `Non_manifold_tag` is a tag class used to monitor the
surface meshing algorithm. When instantiated with the tag
`Non_manifold_tag` the function template
`make_surface_mesh`
does not ensure that the output mesh is a manifold surface.
The manifold property of output mesh
may nevertheless result from the choice of
appropriate meshing criteria.
\sa `make_surface_mesh`
\sa `Manifold_tag`
\sa `Manifold_with_boundary_tag`
*/
class Non_manifold_tag {
public:
/// @}
}; /* end Non_manifold_tag */
} /* end namespace CGAL */

View File

@ -0,0 +1,47 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `ImplicitFunction` describes a function object
whose `operator()` computes the values of a function
\f$ f : \R^3 \longrightarrow \R\f$.
\hasModel `Gray_level_image_function`
\hasModel any pointer to a function of type `FT (*)(Point)`
\sa `Implicit_surface_3<Traits, Function>`
\sa `make_surface_mesh`
*/
class ImplicitFunction {
public:
/// \name Types
/// @{
/*!
Number type
*/
typedef Hidden_type FT;
/*!
Point type
*/
typedef Hidden_type Point;
/// @}
/// \name Operations
/// @{
/*!
Returns the value \f$ f(p)\f$, where \f$ p \in\R^3\f$.
*/
FT operator()(Point p);
/// @}
}; /* end ImplicitFunction */

View File

@ -0,0 +1,235 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `ImplicitSurfaceTraits_3` describes the requirements of the traits class to
be plugged as `Traits` in `Implicit_surface_3<Traits, Function>`.
When `make_surface_mesh` is called
with a surface of type `Implicit_surface_3<Traits,Function>`,
the surface mesher traits generator generates automatically
a traits class that is a model of `SurfaceMeshTraits_3`.
Actually,
the concept `ImplicitSurfaceTraits_3` provides the types, predicates and constructors
that are passed
to the generated model of `SurfaceMeshTraits_3`.
\hasModel Any \cgal Kernel.
\sa `Implicit_surface_3<Traits, Function>`
\sa `make_surface_mesh`
*/
class ImplicitSurfaceTraits_3 {
public:
/// \name Types
/// @{
/*!
The numerical type. It must be model of
`SqrtFieldNumberType` and constructible from a `double`.
*/
typedef Hidden_type FT;
/*!
The point type. This point type must have a
constructor `Point_3(FT, FT, FT)`.
*/
typedef Hidden_type Point_3;
/*!
The line type.
*/
typedef Hidden_type Line_3;
/*!
The ray type.
*/
typedef Hidden_type Ray_3;
/*!
The segment type.
*/
typedef Hidden_type Segment_3;
/*!
The vector type.
*/
typedef Hidden_type Vector_3;
/*!
The sphere type.
*/
typedef Hidden_type Sphere_3;
/*!
A function object that provides the operator
`FT operator()(Vector_3 v, Vector_3 w)` which returns the scalar
(inner) product of the two vectors `v` and `w`.
*/
typedef Hidden_type Compute_scalar_product_3;
/*!
A function object that provides the operator
`FT operator()(Point_3, Point_3)` which returns the squared distance
between two points.
*/
typedef Hidden_type Compute_squared_distance_3;
/*!
A function object providing the operator
`FT operator()(const Sphere_3& s)` which returns the squared radius
of `s`.
*/
typedef Hidden_type Compute_squared_radius_3;
/*!
A function object providing the operator
`Point_3 operator()(const Sphere_3& s)` which computes the center of
the sphere `s`.
*/
typedef Hidden_type Construct_center_3;
/*!
A function object providing the operator
`Point_3 operator()(const Point_3& p, const Point_3& q)` which computes
the midpoint of the segment `pq`.
*/
typedef Hidden_type Construct_midpoint_3;
/*!
A function object providing the following operators:
`Point_3 operator()(const Line_3& l,int i);` which returns an
arbitrary point on `l`. It holds `point(i) == point(j)`, iff
`i==j`. Furthermore, is directed from `point(i)` to
`point(j)`, for all `i` \f$ <\f$ `j`.
`Point_3 operator()(const Ray_3& r,int i);` which returns a point on
`r`. `point(0)` is the source, `point(i)`, with
\f$ i>0\f$, is different from the source. \pre \f$ i \geq0\f$.
`Point_3 operator()(const Segment_3& s,int i);` which returns source
or target of `s`: `point(0)` returns the source of `s`,
`point(1)` returns the target of `s`. The parameter
`i` is taken modulo 2, which gives easy access to the other end
point.
*/
typedef Hidden_type Construct_point_on_3;
/*!
A function object providing the operators
`Segment_3 operator()(const Point_3 &p, const Point_3 &q);` which
returns a segment with source \f$ p\f$ and target \f$ q\f$. It is directed from the
source towards the target.
*/
typedef Hidden_type Construct_segment_3;
/*!
A function object providing the operator
`Vector_3 operator()(const Vector_3 &v, const FT& scale)` which returns
the vector `v` scaled by a factor `scale`.
*/
typedef Hidden_type Construct_scaled_vector_3;
/*!
A function object providing the operator
`Point_3 operator()(const Point_3& p, const Vector_3& v)` which returns
the point obtained by translating `p` by the vector `v`.
*/
typedef Hidden_type Construct_translated_point_3;
/*!
A function object providing the operator
`Vector_3 operator()(const Point_3 &a, const Point_3 &b)` which returns
the vector `b-a`.
*/
typedef Hidden_type Construct_vector_3;
/*!
A function object providing the operator
`bool operator()(const Sphere_3&s, const Point_3&p);` which
returns true iff \f$ p\f$ lies on the bounded side of \f$ s\f$.
*/
typedef Hidden_type Has_on_bounded_side_3;
/// @}
/// \name Operations
/// The following functions give access to the predicate and
/// construction objects:
/// @{
/*!
*/
Compute_scalar_product_3 compute_scalar_product_3_object();
/*!
*/
Compute_squared_distance_3 compute_squared_distance_3_object();
/*!
*/
Compute_squared_radius_3 compute_squared_radius_3_object();
/*!
*/
Construct_center_3 construct_center_3_object();
/*!
*/
Construct_midpoint_3 construct_midpoint_3_object();
/*!
*/
Construct_point_on_3 construct_point_on_3_object();
/*!
*/
Construct_scaled_vector_3 construct_scaled_vector_3_object();
/*!
*/
Construct_segment_3 construct_segment_3_object();
/*!
*/
Construct_translated_point_3 construct_translated_point_3_object();
/*!
*/
Construct_vector_3 construct_vector_3_object();
/*!
*/
Has_on_bounded_side_3 has_on_bounded_side_3_object();
/// @}
}; /* end ImplicitSurfaceTraits_3 */

View File

@ -0,0 +1,105 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `SurfaceMeshCellBase_3` describes the cell base type
of the three dimensional triangulation used
to embed the surface mesh.
More precisely,
the first template parameter `SurfaceMeshC2T3` of the surface mesher
`make_surface_mesh`
is a model of the concept
`SurfaceMeshComplex_2InTriangulation_3`
which describes a data structure to store
a pure two dimensional complex
embedded in a three dimensional triangulation.
In particular, the type `SurfaceMeshC2T3` is required to provide
a three dimensional triangulation type
`SurfaceMeshC2T3::Triangulation_3`.
The concept `SurfaceMeshCellBase_3` describes the cell base type
required in this triangulation type.
\refines ::TriangulationCellBase_3
\refines The concept SurfaceMeshCellBase_3 adds four markers to mark
the facets of the triangulation that belong to the two dimensional
complex, and four markers that are helpers used in some operations to
mark for instance the facets that have been visited.
\refines This concept also provides storage for the center of a
Delaunay surface ball. Given a surface and a 3D Delaunay
triangulation, a Delaunay surface ball is a ball circumscribed to a
facet of the triangulation and centered on the surface and empty of
triangulation vertices. Such a ball does exist when the facet is part
of the restriction to the surface of a three dimensional
triangulation. In the following we call surface center of a facet,
the center of its biggest Delaunay surface ball.
\hasModel Surface_mesh_cell_base_3<Gt,Vb>
\hasModel Surface_mesh_default_triangulation_3::Cell
\sa `SurfaceMeshTriangulation_3`
\sa `SurfaceMeshComplex_2InTriangulation_3`
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `Surface_mesh_default_triangulation_3`
\sa `make_surface_mesh`
*/
class SurfaceMeshCellBase_3 {
public:
/// \name Types
/// @{
/*!
The point type, required to match the point type
of the three dimensional
triangulation in which the surface mesh is embedded.
*/
typedef Hidden_type Point;
/// @}
/// \name Operations
/// @{
/*!
returns `true`, if `facet(i)` is in the 2D complex.
*/
bool is_facet_on_surface(int i);
/*!
Sets `facet(i)` as part of the 2D complex, if `b` is `true`,
and `NOT_IN_COMPLEX`, otherwise.
*/
void set_facet_on_surface(int i, bool b );
/*!
Returns `true`, if `facet(i)` has been visited,
`false` otherwise.
*/
bool is_facet_visited (int i);
/*!
Marks `facet(i)` as visited, if `b` is `true`,
and non visited otherwise.
*/
void set_facet_visited (int i, bool b);
/*!
Returns a const reference to the surface center of `facet(i)`.
*/
const Point& get_facet_surface_center(int i);
/*!
Sets point `p` as the surface center of `facet(i)`.
*/
void set_facet_surface_center (int i, Point p);
/// @}
}; /* end SurfaceMeshCellBase_3 */

View File

@ -0,0 +1,347 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `SurfaceMeshComplex_2InTriangulation_3` describes a data structure
designed to represent a two dimensional pure complex
embedded in a three dimensional triangulation.
A <I>complex</I> is a set \f$ C\f$ of faces such that:
- any subface of a face in \f$ C\f$ is a face of \f$ C\f$
- two faces of \f$ C\f$ are disjoint or share a common subface
The complex is <I>two dimensional</I>, if its faces have dimension at most
two. It is <I>pure</I> if any face in the complex is a subface
of some face of maximal dimension.
Thus, a two dimensional pure complex is a set of facets
together with their edges and vertices.
A two dimensional pure complex embedded
in a three dimensional triangulation
is a subset of the facets
of this triangulation, together with their edges and vertices.
The concept `SurfaceMeshComplex_2InTriangulation_3` is particularly suited to handle
surface meshes obtained as the restriction to a surface of
a three dimensional Delaunay triangulation.
A model of this concept is a type to be plugged as first template
parameter in the
function template `make_surface_mesh`.
\hasModel Surface_mesh_complex_2_in_triangulation_3<Tr>
\sa `make_surface_mesh`
*/
class SurfaceMeshComplex_2InTriangulation_3 {
public:
/// \name Types
/// `SurfaceMeshComplex_2InTriangulation_3` provides the following types.
/// @{
/*!
The type of the
embedding 3D triangulation. Must be a model of
`SurfaceMeshTriangulation_3`.
*/
typedef Hidden_type Triangulation;
/*!
The type of
the embedding triangulation vertex handles.
*/
typedef Triangulation::Vertex_handle Vertex_handle;
/*!
The type of
the embedding triangulation cell handles.
*/
typedef Triangulation::Cell_handle Cell_handle;
/*!
The type of
the embedding triangulation facets.
*/
typedef Triangulation::Facet Facet;
/*!
The type of
the embedding triangulation edges.
*/
typedef Triangulation::Edge Edge;
/*!
Size type (an
unsigned integral type)
*/
typedef Triangulation::size_type size_type;
/*!
A type to describe the status of a face (facet, edge, or vertex) with respect to
the 2D pure complex. A `NOT_IN_COMPLEX` face does not belong to the 2D complex.
Facets can only be `NOT_IN_COMPLEX` or `REGULAR`
depending on whether they belong to the 2D complex on not.
Edges and vertices can be `NOT_IN_COMPLEX`, `BOUNDARY`,
`REGULAR` or `SINGULAR`.
An edge in the complex is
`BOUNDARY`,
`REGULAR`, or `SINGULAR`,
if it is incident to respectively 1, 2, or 3 or
more facets in the complex.
The status of a vertex is determined by
the adjacency graph of the facets of the 2D complex
incident to that vertex.
The vertex of the 2D complex is `BOUNDARY`, if this adjacency graph
is a simple path, it is `REGULAR`, if the adjacency graph is cyclic,
and `SINGULAR` in any other case.
*/
enum Face_status {NOT_IN_COMPLEX, BOUNDARY, REGULAR,
SINGULAR};
/*!
An iterator type to visit the facets
of the 2D complex.
*/
typedef Hidden_type Facet_iterator;
/*!
An iterator type to visit the
edges of the 2D complex.
*/
typedef Hidden_type Edge_iterator;
/*!
An iterator type to visit
vertices of the 2D complex.
*/
typedef Hidden_type Vertex_iterator;
/*!
An iterator type to visit the
boundary edges of the 2D complex.
*/
typedef Hidden_type Boundary_edges_iterator;
/// @}
/// \name Creation
/// @{
/*!
Builds an empty 2D complex embedded in the triangulation `t3`
*/
SurfaceMeshComplex_2InTriangulation_3(Triangulation& t3);
/*!
Builds a 2D complex embedded in the triangulation `t3`,
including in the 2D complex the facets of `t3` for
which the predicate `select` returns `true`.
The type `FacetSelector` must be
a function object with an operator to select facets:
`bool operator()(Facet f);`.
*/
template < class FacetSelector>
SurfaceMeshComplex_2InTriangulation_3(Triangulation& t3,
FacetSelector select);
/// @}
/// \name Member access
/// @{
/*!
Returns the reference to the triangulation.
*/
Triangulation& triangulation();
/// @}
/// \name Modifications
/// @{
/*!
Adds facet `f` to the 2D complex.
*/
void add_to_complex(Facet f);
/*!
Adds facet `(c,i)` to the 2D complex.
*/
void add_to_complex(Cell_handle c, int i);
/*!
Removes facet `f` from the 2D complex.
*/
void remove_from_complex(Facet f);
/*!
Removes facet `(c,i)` from the 2D complex.
*/
void remove_from_complex(Cell_handle c, int i);
/// @}
/// \name Queries
/// Queries on the status of individual face with respect to the 2D complex.
/// @{
/*!
Returns the number of facets that belong to the 2D complex.
*/
size_type number_of_facets() const;
/*!
Returns the status of the facet `f` with respect to the 2D complex.
*/
Face_status face_status(Facet f);
/*!
Returns the status of the facet `(c,i)` with respect to the 2D complex.
*/
Face_status face_status(Cell_handle c, int i);
/*!
Returns the status of edge `e` in the 2D complex.
*/
Face_status face_status(Edge e);
/*!
Returns the status of edge `(c,i,j)` in the 2D complex.
*/
Face_status face_status(Cell_handle c, int
i, int j);
/*!
Returns the status of vertex `v` in the 2D complex.
*/
Face_status face_status(Vertex_handle v);
/*!
Returns `true`, if the facet `f` belongs to the 2D complex.
*/
bool is_in_complex(Facet f);
/*!
Returns `true`, if the facet `(c,i)` belongs to the 2D complex.
*/
bool is_in_complex(Cell_handle c, int i);
/*!
Returns `true`, if the edge `e` belongs to the 2D complex.
*/
bool is_in_complex(Edge e);
/*!
Returns `true`, if the edge `(c,i,j)` belongs to the 2D complex.
*/
bool is_in_complex(Cell_handle c, int i, int j);
/*!
Returns `true`, if the vertex `v` belongs to the 2D complex.
*/
bool is_in_complex(Vertex_handle v);
/*!
Returns true if the status of vertex `v` is `REGULAR` or `BOUNDARY`.
\pre All the edges of the complex incident to `v` are `REGULAR` or `BOUNDARY`.
*/
bool is_regular_or_boundary_for_vertices (Vertex_handle v);
/// @}
/// \name Traversal of the complex
/// The data structure provides iterators to visit the facets, edges
/// and vertices of the complex. All those iterators are bidirectional
/// and non mutable.
/// @{
/*!
Returns an iterator with value type `Facet` to visit the facets
of the 2D complex.
*/
Facet_iterator facets_begin();
/*!
Returns the past the end iterator for the above iterator.
*/
Facet_iterator facets_end();
/*!
Returns an iterator with value type `Edge` to visit the
edges of the 2D complex which are not isolated.
*/
Edge_iterator edges_begin();
/*!
Returns the past the end iterator for the above iterator.
*/
Edge_iterator edges_end();
/*!
Returns an iterator with value type `Edge` to visit the
boundary edges of the complex.
*/
Boundary_edges_iterator boundary_edges_begin();
/*!
Returns the past the end iterator for the above iterator.
*/
Boundary_edges_iterator boundary_edges_end();
/*!
Returns an iterator with value type `Vertex_handle` to visit the
vertices of the 2D complex.
*/
Vertex_iterator vertices_begin();
/*!
Returns the past the end iterator for the above iterator.
*/
Vertex_iterator vertices_end();
/*!
Copies the `Facet`s of the complex incident to `v` to the output
iterator `facets`.
Returns the resulting output iterator.
\pre `c2t3`.`triangulation().dimension()` \f$ =3\f$, `v` \f$ \neq\f$ `Vertex_handle()`, `c2t3`.`triangulation().is_vertex(v)`.
*/
template <class OutputIterator>
OutputIterator
incident_facets(Vertex_handle v, OutputIterator facets);
/// @}
/// \name
/// The following function is the basic function to walk on the 2D complex
/// @{
/*!
Returns the facet of the complex which is the neighbor of
the facet `f` opposite to the vertex with index `j` of
`f`.
The vertices of the facet `f = (cell c, i)` are numbered
(0,1,2) (according to the `vertex_triple_index(i,j)` member function
of `Triangulation_3`)
in such a way that facet `f` is oriented by the
outward normal of tetraedra `c`.
If there is no such neighbor, or if the edge is singular the functions returns `Facet()`.
*/
Facet neighbor(Facet f, int j);
/*!
Returns the facet of the complex which is the neighbor of
the facet `f` opposite to the vertex with index `j` of `f`.
See above.
*/
Facet neighbor(Cell_handle c, int i, int j);
/// @}
}; /* end SurfaceMeshComplex_2InTriangulation_3 */

View File

@ -0,0 +1,83 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The Delaunay refinement process involved in the
function template `make_surface_mesh`
is guided by a set of refinement criteria.
The concept `SurfaceMeshFacetsCriteria_3` describes the type which
handles those criteria.
It corresponds to the requirements for the template parameter
`FacetsCriteria` of the surface mesher function
`make_surface_mesh<SurfaceMeshC2T3,Surface,FacetsCriteria,Tag>`
.
Typically the meshing criteria are a set
of elementary criteria, each of which
has to be met by the facets of the final mesh.
The meshing algorithm eliminates in turn <I>bad</I> facets, i.e.,
facets that do not meet all the criteria.
The size and quality of the final mesh
depends on the order according to which bad facets
are handled. Therefore, the meshing algorithm
needs to be able to quantify the facet qualities and to compare
the qualities of different faces.
The concept `SurfaceMeshFacetsCriteria_3`
defines a type `Quality` designed to measure
the quality of a mesh facet.
Typically this quality
is a multicomponent variable. Each component corresponds to
one criterion and measures how much the facet deviates from
meeting this criterion. Then, the comparison operator on qualities
is just a lexicographical comparison. The meshing algorithm handles facets
with lowest quality first. The qualities are computed by a function
`is_bad(Facet f, Quality& q)`.
\hasModel Surface_mesh_default_criteria_3<Tr>
\sa `make_surface_mesh<SurfaceMeshC2T3,Surface,FacetsCriteria,Tag>`
*/
class SurfaceMeshFacetsCriteria_3 {
public:
/// \name Types
/// @{
/*!
The type of facets. This type has to match
the `Facet` type in the triangulation type used by
the mesher function. (This triangulation type
is the type `SurfaceMeshC2T3::Triangulation`
provided by the model of
`SurfaceMeshComplex_2InTriangulation_3` plugged
as first template parameter of
`make_surface_mesh`).
*/
typedef Hidden_type Facet;
/*!
Default constructible, copy constructible,
assignable, and less-than comparable type.
*/
typedef Hidden_type Quality;
/// @}
/// \name Operations
/// @{
/*!
Assigns the quality
of the facet `f` to `q`, and returns `true` is `f` does
not meet the criteria.
*/
bool is_bad (const Facet& f, Quality& q);
/// @}
}; /* end SurfaceMeshFacetsCriteria_3 */

View File

@ -0,0 +1,103 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `SurfaceMeshTraits_3` describes the knowledge that is required on the
surface to be meshed. A model of this concept
implements an oracle that is able to tell whether a segment
(or a ray, or a line) intersects the surface or not
and to compute some intersection
points if any. The concept `SurfaceMeshTraits_3` also includes a constructor able to provide
a small set of initial points on the surface.
\hasModel Surface_mesh_traits_generator_3<Surface>::Type
\sa `make_surface_mesh`
*/
class SurfaceMeshTraits_3 {
public:
/// \name Types
/// @{
/*!
The type of points.
This type is required to match
the point type of the
three dimensional embedding triangulation
`C2T3::Triangulation_3`.
*/
typedef Hidden_type Point_3;
/*!
The type of segments.
*/
typedef Hidden_type Segment_3;
/*!
The type of rays.
*/
typedef Hidden_type Ray_3;
/*!
The type of lines.
*/
typedef Hidden_type Line_3;
/*!
The surface type.
*/
typedef Hidden_type Surface_3;
/*!
A model of this type provides the operator
`CGAL::Object operator()(Surface_3 surface, Type1 type1)`
to compute the intersection of the surface
with an object of type `Type1` which may be
`Segment_3`, `Ray_3` or `Line_3` .
*/
typedef Hidden_type Intersect_3;
/*!
A model of this type provides the following operators
to construct initial points on the surface:
`template <class OutputIteratorPoints>`
`OutputIteratorPoints operator()(OutputIteratorPoints pts)`
which outputs a set of points on the surface,
`template <class OutputIteratorPoints>`
`OutputIteratorPoints operator() (OutputIteratorPoints pts, int n)`
which outputs a set of `n` points on the surface.
*/
typedef Hidden_type Construct_initial_points;
/// @}
/// \name Operations
/// The following functions give access to the construction objects:
/// @{
/*!
*/
Intersect_3 intersect_3_object();
/*!
*/
Construct_initial_points construct_initial_points_object();
/// @}
}; /* end SurfaceMeshTraits_3 */

View File

@ -0,0 +1,370 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `SurfaceMeshTriangulation_3` describes
the triangulation type used by the surface mesher
`make_surface_mesh` to represent
the three dimensional triangulation
embedding the surface mesh.
Thus, this concept describes the requirements
for the triangulation type `SurfaceMeshC2T3::Triangulation`
nested in the model of `SurfaceMeshComplex2InTriangulation3`
plugged as the template parameter `SurfaceMeshC2T3` of
`make_surface_mesh`. It also describes
the requirements for the triangulation type
plugged in the class
`Surface_mesh_complex_2_in_triangulation_3<Tr>`.
\hasModel Any 3D Delaunay triangulation class of \cgal
\sa `Triangulation_3<TriangulationTraits_3,TriangulationDataStructure_3>`
\sa `Delaunay_triangulation_3<DelaunayTriangulationTraits_3,TriangulationDataStructure_3>`
\sa `SurfaceMeshComplex2InTriangulation3`
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `make_surface_mesh`
*/
class SurfaceMeshTriangulation_3 {
public:
/// \name Types
/// <I>Vertices</I> and <I>cells</I> of the triangulation are
/// manipulated via handles, which support the two dereference
/// operators and `operator->`. The following iterators allow one to
/// visit all finite vertices, edges and facets of the triangulation.
/// @{
/*!
The point type. It must be DefaultConstructible, CopyConstructible and
Assignable.
*/
typedef Hidden_type Point;
/*!
Handle to a data representing a <I>vertex</I>. `Vertex_handle` must be
a model of `Handle` and its <I>value type</I> must be model of
`TriangulationDataStructure_3::Vertex`.
*/
typedef Hidden_type Vertex_handle;
/*!
Handle to a data representing a <I>cell</I>. `Cell_handle` must be a
model of `Handle` and its <I>value type</I> must be model of
`TriangulationDataStructure_3::Cell`.
*/
typedef Hidden_type Cell_handle;
/*!
The edge type.
*/
typedef CGAL::Triple<Cell_handle, int, int> Edge;
/*!
The facet type.
*/
typedef std::pair<Cell_handle, int> Facet;
/*!
Iterator over finite vertices
*/
typedef Hidden_type Finite_vertices_iterator;
/*!
Iterator over finite edges
*/
typedef Hidden_type Finite_edges_iterator;
/*!
Iterator over finite facets
*/
typedef Hidden_type Finite_facets_iterator;
/*!
The geometric traits class. Must be a model of
`DelaunayTriangulationTraits_3`.
*/
typedef Hidden_type Geom_traits;
/// @}
/// \name Creation
/// @{
/*!
default constructor.
*/
SurfaceMeshTriangulation_3();
/*!
Copy constructor. All vertices and faces are duplicated.
*/
SurfaceMeshTriangulation_3(SurfaceMeshTriangulation_3 tr);
/// @}
/// \name Assignment
/// @{
/*!
The triangulation `tr` is duplicated, and modifying the copy after the
duplication does not modify the original. The previous triangulation held
by `t` is deleted.
*/
SurfaceMeshTriangulation_3 &
operator=(const SurfaceMeshTriangulation_3 & tr);
/*!
Deletes all finite vertices and all cells of `t`.
*/
void clear();
/// @}
/// \name Access Functions
/// @{
/*!
Returns the dimension of the affine hull.
*/
int dimension() const;
/*!
Returns a const reference to a model of
`DelaunayTriangulationTraits_3`.
*/
const DelaunayTriangulationTraits_3 & geom_traits() const;
/// @}
/// \name Voronoi diagram
/// @{
/*!
Returns the dual of facet `f`, which is
in dimension 3: either a segment, if the two cells incident to `f`
are finite, or a ray, if one of them is infinite;
in dimension 2: a point.
*/
Object dual(Facet f) const;
/// @}
/// \name Queries
/// A point `p` is said to be in conflict with a cell `c` in dimension
/// 3 (resp. a facet `f` in dimension 2) iff `t`.`side_of_sphere(c,
/// p)` (resp. `t`.`side_of_circle(f, p)`) returns
/// `ON_BOUNDED_SIDE`. The set of cells (resp. facets in dimension 2)
/// which are in conflict with `p` is connected, and it forms a
/// hole.
/// @{
/*!
Computes the conflict hole induced by `p`. The starting cell
(resp. facet) `c` must be in conflict.
Then this function returns respectively in the output iterators:
- `cit`: the cells (resp. facets) in conflict.
- `bfit`: the facets (resp. edges) on the boundary, that is, the facets
(resp. edges) `(t, i)` where the cell (resp. facet) `t` is in
conflict, but `t->neighbor(i)` is not.
- `ifit`: the facets (resp. edges) inside the hole, that is, delimiting
two cells (resp facets) in conflict.
Returns the `Triple` composed of the resulting output iterators.
*/
template <class OutputIteratorBoundaryFacets,
class OutputIteratorCells,
class OutputIteratorInternalFacets>
Triple<OutputIteratorBoundaryFacets,
OutputIteratorCells,
OutputIteratorInternalFacets>
find_conflicts(Point p, Cell_handle c,
OutputIteratorBoundaryFacets bfit,
OutputIteratorCells cit,
OutputIteratorInternalFacets ifit);
/// @}
/// \name
/// The following iterators allow the user to visit facets,
/// edges and vertices of the triangulation.
/// @{
/*!
Starts at an arbitrary finite vertex. Then `++` and `-` will
iterate over finite vertices. Returns `finite_vertices_end()` when
`t`.`number_of_vertices()` \f$ =0\f$.
*/
Finite_vertices_iterator finite_vertices_begin() const;
/*!
Past-the-end iterator
*/
Finite_vertices_iterator finite_vertices_end() const;
/*!
Starts at an arbitrary finite edge. Then `++` and `-` will
iterate over finite edges. Returns `finite_edges_end()` when
`t`.`dimension()` \f$ <1\f$.
*/
Finite_edges_iterator finite_edges_begin() const;
/*!
Past-the-end iterator
*/
Finite_edges_iterator finite_edges_end() const;
/*!
Starts at an arbitrary finite facet. Then `++` and `-` will
iterate over finite facets. Returns `finite_facets_end()` when
`t`.`dimension()` \f$ <2\f$.
*/
Finite_facets_iterator finite_facets_begin() const;
/*!
Past-the-end iterator
*/
Finite_facets_iterator finite_facets_end() const;
/*!
Copies the `Cell_handle`s of all cells incident to `v` to the output
iterator `cells`. If `t`.`dimension()` \f$ <3\f$, then do nothing.
Returns the resulting output iterator.
\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`.
*/
template <class OutputIterator>
OutputIterator
incident_cells(Vertex_handle v, OutputIterator cells) const;
/*!
Copies the `Cell_handle`s of all cells incident to `v` to the output
iterator `cells`. If `t`.`dimension()` \f$ <3\f$, then do nothing.
Returns the resulting output iterator.
*/
template <class OutputIterator>
OutputIterator
incident_cells(Vertex_handle v, OutputIterator cells) const;
/*!
Tests whether `p` is a vertex of `t` by locating `p` in
the triangulation. If `p` is found, the associated vertex `v`
is given.
*/
bool is_vertex(const Point & p, Vertex_handle & v) const;
/*!
Tests whether `(u,v)` is an edge of `t`. If the edge is found,
it gives a cell `c` having this edge and the indices `i`
and `j` of the vertices `u` and `v` in `c`, in this order.
\pre `u` and `v` are vertices of `t`.
*/
bool is_edge(Vertex_handle u, Vertex_handle v,
Cell_handle & c, int & i, int & j) const;
/*!
`true`, iff vertex `v` is the infinite vertex.
*/
bool is_infinite(const Vertex_handle v) const;
/*!
`true`, iff `c` is incident to the infinite vertex.
\pre `t`.`dimension()` \f$ =3\f$.
*/
bool is_infinite(const Cell_handle c) const;
/*!
Returns the same facet viewed from the other adjacent cell.
*/
Facet mirror_facet(Facet f) const;
/*!
Return the indexes of the `j`th vertex of the facet of a cell
opposite to vertex `i`.
*/
int vertex_triple_index(const int i, const int j);
/// @}
/// \name Point location
/// @{
/*!
If the point `query` lies inside the convex hull of the points, the cell
that contains the query in its interior is returned. If `query` lies on a
facet, an edge or on a vertex, one of the cells having `query` on
its boundary is returned.
If the point `query` lies outside the convex hull of the points,
an infinite cell with vertices \f$ \{ p, q, r, \infty\}\f$ is returned such that
the tetrahedron \f$ ( p, q, r, query )\f$ is positively oriented
(the rest of the triangulation lies on the other side of facet
\f$ ( p, q, r )\f$).
Note that locate works even in degenerate dimensions: in dimension 2
(resp. 1, 0) the `Cell_handle` returned is the one that represents
the facet (resp. edge, vertex) containing the query point.
The optional argument `start` is used as a starting place for the search.
*/
Cell_handle
locate(const Point & query, Cell_handle start = Cell_handle()) const;
/*!
If `query` lies inside the affine hull of the points, the \f$ k\f$-face
(finite or infinite) that contains `query` in its interior is
returned, by means of the cell returned together with `lt`, which
is set to the locate type of the query (`VERTEX, EDGE, FACET, CELL`, or `OUTSIDE_CONVEX_HULL` if the cell is infinite and `query`
lies strictly in it) and two indices `li` and `lj` that
specify the \f$ k\f$-face of the cell containing `query`.
If the \f$ k\f$-face is a cell, `li` and `lj` have no
meaning; if it is a facet (resp. vertex), `li` gives the index of
the facet (resp. vertex) and `lj` has no meaning; if it is and
edge, `li` and `lj` give the indices of its vertices.
If the point `query` lies outside the affine hull of the points,
which can happen in case of degenerate dimensions, `lt` is set to
`OUTSIDE_AFFINE_HULL`, and the cell returned has no meaning.
As a particular case, if there is no finite vertex yet in the
triangulation, `lt` is set to `OUTSIDE_AFFINE_HULL` and
`locate` returns the default constructed handle.
The optional argument `start` is used as a starting place for the search.
*/
Cell_handle
locate(const Point & query, Locate_type & lt,
int & li, int & lj, Cell_handle start = Cell_handle() ) const;
/*!
Creates a new vertex by starring a hole. It takes an iterator range
[`cell_begin`; `cell_end`[ of `Cell_handle`s which specifies
a hole: a set of connected cells (resp. facets in dimension 2) which is
star-shaped wrt `p`.
(`begin`, `i`) is a facet (resp. an edge) on the boundary of the hole,
that is, `begin` belongs to the set of cells (resp. facets) previously
described, and `begin->neighbor(i)` does not. Then this function deletes
all the cells (resp. facets) describing the hole, creates a new vertex
`v`, and for each facet (resp. edge) on the boundary of the hole, creates
a new cell (resp. facet) with `v` as vertex. Then `v->set_point(p)`
is called and `v` is returned.
\pre `t`.`dimension()` \f$ \geq2\f$, the set of cells (resp. facets in dimension 2) is connected, its boundary is connected, and `p` lies inside the hole, which is star-shaped wrt `p`.
*/
template <class CellIt>
Vertex_handle insert_in_hole(Point p, CellIt cell_begin, CellIt cell_end,
Cell_handle begin, int i);
/// @}
}; /* end SurfaceMeshTriangulation_3 */

View File

@ -0,0 +1,75 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `SurfaceMeshVertexBase_3` describes the vertex base type
of the three dimensional triangulation used
to embed the surface mesh.
More precisely,
the first template parameter `SurfaceMeshC2T3` of the surface mesher
`make_surface_mesh`
is a model of the concept
`SurfaceMeshComplex_2InTriangulation_3`
which describes a data structure to store
a pure two dimensional complex
embedded in a three dimensional triangulation.
In particular, the type `SurfaceMeshC2T3` is required to provide
a three dimensional triangulation type
`SurfaceMeshC2T3::Triangulation_3`
The concept `SurfaceMeshVertexBase_3` describes the vertex base type
required in this triangulation type.
\refines ::TriangulationVertexBase_3
\refines The surface mesher algorithm issues frequent queries about
the status of the vertices with respect to the two dimensional complex
that represents the current surface approximation. The class
SurfaceMeshVertexBase_3 offers a caching mechanism to answer more
efficiently these queries. The caching mechanism includes two cached
integers, which, when they are valid, store respectively the number of
complex facets incident to the vertex and the number of connected
components of the adjacency graph of those facets.
\hasModel Surface_mesh_vertex_base_3<Gt,Vb>
\hasModel Surface_mesh_default_triangulation_3::Vertex
\sa `SurfaceMesherComplex_2InTriangulation_3`
\sa `Surface_mesh_complex_2_in_triangulation_3<Tr>`
\sa `Surface_mesh_default_triangulation_3`
*/
class SurfaceMeshVertexBase_3 {
public:
/// \name Operations
/// @{
/*!
Returns `true` if the cache is valid.
*/
bool is_c2t3_cache_valid();
/*!
Invalidates the cache.
*/
void invalidate_c2t3_cache();
/*!
Returns the cached number of facets of the complex incident to the vertex.
*/
int cached_number_of_incident_facets();
/*!
This method concerns the adjacency
graph of the facets of the complex incident to the vertex
and returns a cached value for the number of connected components this graph.
*/
int cached_number_of_components();
/// @}
}; /* end SurfaceMeshVertexBase_3 */

View File

@ -0,0 +1,37 @@
/*!
\ingroup PkgSurfaceMesher3Concepts
\cgalconcept
The concept `Surface_3` describes the types of surfaces to be meshed.
The surface types
are required to be copy constructible
and assignable.
\hasModel Implicit_surface_3<Traits, Function>
\sa `make_surface_mesh`
\sa `SurfaceMeshTraits_3`
\sa `Surface_mesh_traits_generator_3<Surface>`
*/
class Surface_3 {
public:
/// \name Types
/// In addition, surface types are required
/// - either to provide a nested type: `Surface_mesher_traits_3`
/// - or to be a surface type for which a specialization of the traits generator
/// `Surface_mesh_traits_generator_3<Surface>` exists.
/// @{
/*!
a model of `SurfaceMesherTraits_3`
*/
typedef Hidden_type Surface_mesher_traits_3;
/// @}
}; /* end Surface_3 */

View File

@ -0,0 +1,52 @@
/// \defgroup PkgSurfaceMesher3 3D Surface Mesh Generation
/// \defgroup PkgSurfaceMesher3Concepts Concepts
/// \ingroup PkgSurfaceMesher3
/*!
\addtogroup PkgSurfaceMesher3
\todo check generated documentation
\PkgDescriptionBegin{3D Surface Mesh Generation}
\PkgPicture{segmented_head-small.png}
\PkgAuthor{Laurent Rineau and Mariette Yvinec}
\PkgDesc{This package provides functions to generate surface meshes that interpolate smooth surfaces. The meshing algorithm is based on Delaunay refinement and provides some guarantees on the resulting mesh: the user is able to control the size and shape of the mesh elements and the accuracy of the surface approximation. There is no restriction on the topology and number of components of input surfaces. The surface mesh generator may also be used for non smooth surfaces but without guarantee. Currently, implementations are provided for implicit surfaces described as the zero level set of some function and surfaces described as a gray level set in a three-dimensional image.}
\PkgSince{3.2}
\cgalbib{cgal:ry-smg}
\license{\ref licensesGPL}
\PkgDescriptionEnd
The surface mesh generation package offers a function template
which builds a triangular mesh approximating a surface.
The meshing algorithms requires to know the surface to be meshed
through an oracle that mainly can tell whether a
given segment, ray or line intersects the surface or not
and can compute the compute the
intersections point if any. The oracle is represented by a traits class
which can be passed to the meshing function
or automatically generated for certain types of surfaces.
The current implementation provides
traits classes
to mesh implicit surfaces as well as surfaces described
as a gray level in a three
dimensional image.
The output mesh conforms to some size and shape criteria
which are customizable. The criteria are passed to the mesher
through a parameter
whose type is a model of the
concept `SurfaceMeshFacetsCriteria_3`.
The meshing algorithm is a Delaunay refinement process
which is mainly guided by the criteria.
The output mesh may offer some guarantees, as being manifold,
homeomorphic to the surface or within a given
Hausdorff distance. However, these guarantees depend
on the quality of the input surface (smoothness, with or without
boundary, manifold or not),
the type and values of the given criteria.
The behavior of the refinement process can also be influenced through
a tag, which allows for instance to enforce the manifold property
of the output mesh while avoiding an over-refinement of the mesh.
*/

View File

@ -0,0 +1,327 @@
\page chapter_SurfaceMesher 3D Surface Mesh Generation
namespace CGAL {
/*!
\mainpage 3D Surface Mesh Generation
\anchor chapter_SurfaceMesher
\authors Laurent Rineau and Mariette Yvinec
\autotoc
\image html segmented_head.png
\section SurfaceMesher_section_intro Introduction
This package provides a function template
to compute a triangular mesh approximating a surface.
The meshing algorithm requires to know the surface to be meshed
only through an oracle able to tell whether a
given segment, line or ray intersects the surface or not
and to compute an intersection point if any.
This feature makes the package generic enough to be
applied in a wide variety of situations. For instance, it can be
used to mesh implicit surfaces described as the zero level set
of some function. It may also be used in the field of medical imaging
to mesh surfaces described as a gray
level set in a three dimensional image.
The meshing algorithm is based on the notion of the restricted
Delaunay triangulation. Basically the algorithm computes a set of
sample points on the surface, and extract an interpolating
surface mesh from the three dimensional triangulation of these
sample points.
Points are iteratively added to the sample,
as in a Delaunay refinement process, until some size and shape
criteria on the elements of the surface mesh
are satisfied.
The size and shape criteria guide the behavior of
the refinement process and control its termination.
They also condition the size and shape of the elements in the final
mesh. Naturally, those criteria can be customized to satisfy
the user needs. The `Surface mesh generation` package offers
a set of standard criteria that can be scaled through
three numerical values. Also the user can also plug in its own
set of refinement criteria.
There is no restriction on the topology and number of components
of the surface provided that the oracle (or the user)
is able to provide one initial sample point on each connected component.
If the surface is smooth enough, and if the size criteria are
small enough, the algorithm guarantees
that the output mesh is homeomorphic to the
surface, and is within a small bounded distance
(Hausdorff or even Frechet distance) from the surface.
The algorithm can also be used for non smooth surfaces
but then there is no guarantee.
\section SurfaceMesher_section_interface The Surface Mesh Generator Interface for Smooth Surfaces
The meshing process is launched through a call to a function template.
There are two overloaded versions of the meshing function
whose signatures are the following:
\code{.cpp}
template <class SurfaceMeshC2T3,
class Surface,
class FacetsCriteria,
class Tag >
void make_surface_mesh(SurfaceMeshC2T3& c2t3,
Surface surface,
FacetsCriteria criteria,
Tag);
template< class SurfaceMeshC2T3,
class SurfaceMeshTraits,
class FacetsCriteria,
class Tag >
void make_surface_mesh(SurfaceMeshC2T3& c2t3,
SurfaceMeshTraits::Surface_3 surface,
SurfaceMeshTraits traits,
FacetsCriteria criteria,
Tag );
\endcode
The template parameter `SurfaceMeshC2T3`
stands for a data structure type that is used
to store the surface mesh. This type is required to be
a model of the concept `SurfaceMeshComplex_2InTriangulation_3`.
Such a data structure
has a pointer to a three dimensional triangulation and encodes
the surface mesh as a subset of facets in this triangulation.
An argument of type `SurfaceMeshC2T3` is passed by reference to the meshing
function. This argument holds the output mesh at the end of the
process.
The template parameter `Surface` stands for the surface type.
This type has to be a model of the concept `Surface_3`.
The knowledge on the surface, required by the surface mesh generator
is encapsulated in a
traits class. Actually, the mesh generator accesses the surface to be meshed
through this traits class only.
The traits class is required to be a model
of the concept `SurfaceMeshTraits_3`.
The difference between the two overloaded versions of
`make_surface_mesh`
can be explained as follows
<UL>
<LI>In the first overloaded version
of `make_surface_mesh`, the surface type is given
as template parameter (`Surface`) and the `surface`
to be meshed is passed as parameter to the mesh generator.
In that case the surface mesh generator traits type
is automatically generated from the surface type
by an auxiliary class called the `Surface_mesh_traits_generator_3`.
<LI>In the second overloaded version of `make_surface_mesh`,
the surface mesh generator traits type is provided
by the template parameter `SurfaceMeshTraits_3`
and the surface type is obtained from this traits type.
Both a surface and a traits
are passed to the mesh generator as arguments.
</UL>
The first overloaded version can be used
whenever the surface type either provides a nested type
`Surface::Surface_mesher_traits_3`
that is a model of `SurfaceMeshTraits_3`
or is a surface type for which a specialization
of the traits generator `Surface_mesh_traits_generator_3<Surface>`
is provided.
Currently, the library provides partial specializations
of `Surface_mesher_traits_generator_3<Surface>`
for implicit surfaces (`Implicit_surface_3<Traits, Function>`) and
gray level images (`Gray_level_image_3<FT, Point>`).
The parameter `criteria` handles the description of the size and shape
criteria driving the meshing process. The template parameter `FacetsCriteria`
has to be instantiated by a model of the concept `SurfaceMeshFacetsCriteria`.
The parameter `Tag` is a tag
whose type influences the behavior of the
meshing algorithm. For instance, this parameter
can be used to enforce the manifold property
of the output mesh while avoiding
an over-refinement of the mesh. Further details on this
subject are given in
Section \ref SurfaceMesher_section_variations.
A call to
`make_surface_mesh(c2t3,surface, criteria, tag)` launches
the meshing process with an initial
set of points which is the union of two subsets:
the set of vertices in the initial triangulation pointed to by `c2t3`,
and a set of points provided by the `Construct_initial_points()` functor
of the traits class. This initial set of points is required
to include at least one point on each connected component of the surface
to be meshed.
# Examples #
\anchor SurfaceMesher_section_example
## Meshing Isosurfaces defined by Implicit Functions ##
The first code example meshes a sphere
given as the zero level set of a function \f$ \R^3 \longrightarrow \R\f$.
More precisely,
the surface to be meshed is created
by the constructor
of the class `Implicit_surface_3<Kernel, Function>`
from a pointer to the function (`sphere_function`)
and a bounding sphere.
The default meshing criteria are determined by three numerical
values:
<UL>
<LI>`angular_bound` is a lower bound in degrees for the angles
of mesh facets.
<LI>`radius_bound` is an upper bound on the radii of surface Delaunay
balls. A surface Delaunay ball is a ball circumscribing a mesh facet
and centered on the surface.
<LI>`distance_bound` is an upper bound for the distance
between the circumcenter of a mesh facet and the center of a surface
Delaunay ball of this facet.
</UL>
Given this surface type, the surface mesh generator will use
an automatically generated traits class.
The resulting mesh is shown in
Figure \ref figureSurface_mesherspheresurface.
\anchor figureSurface_mesherspheresurface
\image html sphere-surface.png "Surface mesh of a sphere"
\cgalexample{mesh_an_implicit_function.cpp}
## Meshing Isosurfaces Defined as Gray Levels in 3D Images ##
In this example the surface to be meshed is defined
as the locus of points with a given gray level
in a 3D image.
The code is quite similar to the previous example.
The main difference with the previous code
is that the function used to define the surface
is an object of type `CGAL::Gray_level_image_3` created from
an image file and a numerical value that is the
gray value of the level one wishes to mesh.
Note that surface, which is still an object of type `Implicit_surface_3`
is now, defined by three parameters that are the function, the bounding
sphere and a numerical value called <I>the precision</I>. This
precision, whose value
is relative to the bounding sphere radius, is used in the intersection
computation.
This parameter has a default which was used in the previous example.
Also note that the center of the bounding sphere is required to be
internal a point where the function has a negative value.
The chosen iso-value of this 3D image corresponds to a head skull. The
resulting mesh is shown in Figure \ref figureSurface_mesherskull.
\anchor figureSurface_mesherskull
\image html skull-surface.png "Surface mesh of an iso-contour extracted from a gray level 3D image"
\cgalexample{mesh_a_3d_gray_image.cpp}
\section SurfaceMesher_section_criteria Meshing Criteria, Guarantees and Variations
\anchor SurfaceMesher_section_variations
The guarantees on the output mesh depend on the mesh criteria.
Theoretical guarantees are given in \cite cgal:bo-pgsms-05.
First, the meshing algorithm is proved to terminate
if the lower bound on facets angles is
not bigger than \f$ 30\f$ degrees.
Furthermore, the output mesh
is guaranteed to be homeomorphic to the surface,
and there is a guaranteed bound
on the distance (Hausdorff and even Frechet distance)
between the mesh and the surface
if the radius bound is everywhere smaller than
\f$ \epsilon\f$ times the local feature size.
Here \f$ \epsilon\f$ is a constant that has to be
less than 0.16, and the local feature size
\f$ lfs(x)\f$ is defined on each point \f$ x\f$ of the surface
as the distance from \f$ x\f$ to the medial axis.
Note that the radius bound need not be uniform,
although it is a uniform bound in the default criteria.
Naturally, such a theoretical guarantee can be only achieved
for smooth surfaces that have a finite, non zero
reach value. (The reach of a surface is the minimum value
of local feature size on
this surface).
The value of the local feature size on any point of the surface
or its minimum on the surface it usually unknown
although it can sometimes be guessed. Also it happens frequently
that setting the meshing criteria so as to fulfill the theoretical
conditions yields an over refined mesh.
On the other hand, when the size criteria are relaxed,
no homeomorphism with the input surface is guaranteed,
and the output mesh is not even guaranteed to be manifold.
To remedy this problem and give a more flexible
meshing algorithm, the function template
`make_surface_mesh` has a tag template parameter
allowing to slightly change the behavior of the refinement process.
This feature allows, for instance, to run the meshing
algorithm with a relaxed size criteria, more coherent
with the size of the mesh expected by the user,
and still have a guarantee that
the output mesh forms a manifold surface.
The function `make_surface_mesh` has specialized versions
for the following tag types:
`Manifold_tag`: the output mesh is guaranteed to be a manifold
surface without boundary.
`Manifold_with_boundary_tag`: the output mesh is guaranteed to be
manifold but may have boundaries.
`Non_manifold_tag`: the algorithm relies on the given criteria and
guarantees nothing else.
# Output #
This \cgal component also provides functions to write the reconstructed surface mesh to the Object File Format (OFF) \cite cgal:p-gmgv16-96 and to convert it to a polyhedron (when it is manifold):
`CGAL::output_surface_facets_to_off`
`CGAL::output_surface_facets_to_polyhedron`
# Undocumented Features Available in Demos #
The Polyhedron demo has a feature that allows to remesh a polyhedral
surface, using the 3D Surface Mesh Generator. That has been implemented as
a special model of `SurfaceMeshTraits_3`, for polyhedra. That traits
class is not yet documented because its interface and code have not yet
been stabilized. It will probably be shipped with next release of \cgal.
The Surface Mesh Generator demo allows to mesh not only gray level images,
but also segmented images, when voxels are labelled with a domain
index. Such images are for example the result of a segmentation of 3D
medical images. This feature is not yet ready to be documented in current
release, but will probably be in next release of \cgal.
# Design and Implementation History #
The algorithm implemented in this package is mainly based on the work of
Jean-Daniel Boissonnat and Steve Oudot \cite cgal:bo-pgsms-05. Steve Oudot
implemented a first working prototype of the algorithm during his PhD thesis.
The meshing algorithm is implemented using the design of mesher levels
described in \cite cgal:ry-gsddrm-06.
David Rey, Steve Oudot and Andreas Fabri have participated
in the development of this package.
*/
} /* namespace CGAL */

View File

@ -0,0 +1,5 @@
/*!
\example Surface_mesher/mesh_an_implicit_function.cpp
\example Surface_mesher/mesh_a_3d_gray_image.cpp
\example Surface_mesher/polyhedron_remesher.cpp
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB