Skip to content

Commit

Permalink
Merge PR CGAL#6760 into gsoc2023-adaptive_remesh-ipadjen
Browse files Browse the repository at this point in the history
  • Loading branch information
ipadjen authored and [email protected] committed May 21, 2023
2 parents 437cf48 + 83bf49b commit fe3fa38
Show file tree
Hide file tree
Showing 22 changed files with 2,859 additions and 30 deletions.
23 changes: 23 additions & 0 deletions Documentation/doc/biblio/geom.bib
Original file line number Diff line number Diff line change
Expand Up @@ -152043,6 +152043,7 @@ @article{cvl-ew-12
Pages = {215--224},
Year = {2012},
Url = {https://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf}
}

@inproceedings{tang2009interactive,
title={Interactive Hausdorff distance computation for general polygonal models},
Expand All @@ -152054,3 +152055,25 @@ @inproceedings{tang2009interactive
year={2009},
organization={ACM}
}

@article{lachaud2020,
author = {Jacques-Olivier Lachaud and Pascal Romon and Boris Thibert and David Coeurjolly},
journal = {Computer Graphics Forum (Proceedings of Symposium on Geometry Processing)},
number = {5},
title = {Interpolated corrected curvature measures for polygonal surfaces},
volume = {39},
month = jul,
year = {2020}
}

@article{lachaud2022
author = {Jacques-Olivier Lachaud and Pascal Romon and Boris Thibert},
journal = {Discrete & Computational Geometry},
title = {Corrected Curvature Measures},
volume = {68},
pages = {477-524},
month = jul,
year = {2022},
url = {https://doi.org/10.1007/s00454-022-00399-4}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2016 GeometryFactory SARL (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Andreas Fabri
//
// Warning: this file is generated, see include/CGAL/licence/README.md

#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_H
#define CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_H

#include <CGAL/config.h>
#include <CGAL/license.h>

#ifdef CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE

# if CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE

# if defined(CGAL_LICENSE_WARNING)

CGAL_pragma_warning("Your commercial license for CGAL does not cover "
"this release of the Polygon Mesh Processing - Interpolated Corrected Curvatures package.")
# endif

# ifdef CGAL_LICENSE_ERROR
# error "Your commercial license for CGAL does not cover this release \
of the Polygon Mesh Processing - Interpolated Corrected Curvatures package. \
You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR
# endif // CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE
#else // no CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE
# if defined(CGAL_LICENSE_WARNING)
CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE is not defined."
"\nYou use the CGAL Polygon Mesh Processing - Interpolated Corrected Curvatures package under "
"the terms of the GPLv3+.")
# endif // CGAL_LICENSE_WARNING
# ifdef CGAL_LICENSE_ERROR
# error "The macro CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE is not defined.\
You use the CGAL Polygon Mesh Processing - Interpolated Corrected Curvatures package under the terms of \
the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR
#endif // no CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_COMMERCIAL_LICENSE
#endif // CGAL_POLYGON_MESH_PROCESSING_INTERPOLATED_CORRECTED_CURVATURES_H
1 change: 1 addition & 0 deletions Installation/include/CGAL/license/gpl_package_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Polygon_mesh_processing/connected_components Polygon Mesh Processing - Connected
Polygon_mesh_processing/corefinement Polygon Mesh Processing - Corefinement
Polygon_mesh_processing/core Polygon Mesh Processing - Core
Polygon_mesh_processing/distance Polygon Mesh Processing - Distance
Polygon_mesh_processing/interpolated_corrected_curvatures Polygon Mesh Processing - Interpolated Corrected Curvatures
Polygon_mesh_processing/measure Polygon Mesh Processing - Geometric Measure
Polygon_mesh_processing/meshing_hole_filling Polygon Mesh Processing - Meshing and Hole Filling
Polygon_mesh_processing/orientation Polygon Mesh Processing - Orientation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ EXCLUDE_SYMBOLS += experimental
HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/selfintersections.jpg \
${CGAL_PACKAGE_DOC_DIR}/fig/mesh_smoothing.png \
${CGAL_PACKAGE_DOC_DIR}/fig/shape_smoothing.png \
${CGAL_PACKAGE_DOC_DIR}/fig/icc_diff_radius.png \
${CGAL_PACKAGE_DOC_DIR}/fig/decimate_cheese.png \
${CGAL_PACKAGE_DOC_DIR}/fig/decimate_colors.png \
${CGAL_PACKAGE_DOC_DIR}/fig/decimate_rg_joint.png

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
/// Functions to triangulate faces, and to refine and fair regions of a polygon mesh.
/// \ingroup PkgPolygonMeshProcessingRef

/// \defgroup PMP_corrected_curvatures_grp Corrected Curvature Computation
/// Functions to compute the corrected curvatures of a polygon mesh.
/// \ingroup PkgPolygonMeshProcessingRef

/// \defgroup PMP_normal_grp Normal Computation
/// Functions to compute unit normals for individual/all vertices or faces.
/// \ingroup PkgPolygonMeshProcessingRef
Expand Down Expand Up @@ -75,7 +79,7 @@
\cgalPkgPicture{hole_filling_ico.png}

\cgalPkgSummaryBegin
\cgalPkgAuthors{Sébastien Loriot, Mael Rouxel-Labbé, Jane Tournois, and Ilker %O. Yaz}
\cgalPkgAuthors{David Coeurjolly, Jaques-Olivier Lachaud, Konstantinos Katriopla, Sébastien Loriot, Mael Rouxel-Labbé, Hossam Saeed, Jane Tournois, and Ilker %O. Yaz}
\cgalPkgDesc{This package provides a collection of methods and classes for polygon mesh processing,
ranging from basic operations on simplices, to complex geometry processing algorithms such as
Boolean operations, remeshing, repairing, collision and intersection detection, and more.}
Expand Down Expand Up @@ -208,6 +212,17 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage.
- \link PMP_locate_grp Nearest Face Location Queries \endlink
- \link PMP_locate_grp Random Location Generation \endlink

\cgalCRPSection{Corrected Curvatures}
- `CGAL::Polygon_mesh_processing::interpolated_corrected_mean_curvature()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_Gaussian_curvature()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_principal_curvatures_and_directions()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_curvatures()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_mean_curvature_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_Gaussian_curvature_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_principal_curvatures_and_directions_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_curvatures_one_vertex()`
- `CGAL::Polygon_mesh_processing::Principal_curvatures_and_directions`

\cgalCRPSection{Normal Computation Functions}
- `CGAL::Polygon_mesh_processing::compute_face_normal()`
- `CGAL::Polygon_mesh_processing::compute_face_normals()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace CGAL {
\anchor Chapter_PolygonMeshProcessing

\cgalAutoToc
\authors Sébastien Loriot, Mael Rouxel-Labbé, Jane Tournois, Ilker %O. Yaz
\authors David Coeurjolly, Jaques-Olivier Lachaud, Konstantinos Katriopla, Sébastien Loriot, Mael Rouxel-Labbé, Hossam Saeed, Jane Tournois, and Ilker %O. Yaz

\image html neptun_head.jpg
\image latex neptun_head.jpg
Expand Down Expand Up @@ -49,6 +49,7 @@ mesh, which includes point location and self intersection tests.
- \ref PMPCombinatorialRepair : repair of polygon meshes and polygon soups.
- \ref PMPGeometricRepair : repair of the geometry of polygon meshes.
- \ref PMPNormalComp : normal computation at vertices and on faces of a polygon mesh.
- \ref PMPICC : computing curvatures (mean, gaussian, principal) on a polygon mesh.
- \ref PMPSlicer : functor able to compute the intersections of a polygon mesh with arbitrary planes (slicer).
- \ref PMPConnectedComponents : methods to deal with connected
components of a polygon mesh (extraction, marks, removal, ...).
Expand Down Expand Up @@ -935,6 +936,128 @@ not provide storage for the normals.

\cgalExample{Polygon_mesh_processing/compute_normals_example_Polyhedron.cpp}

****************************************
\section PMPICC Computing Curvatures

This package provides methods to compute curvatures on polygonal meshes based on Interpolated
Corrected Curvatures on Polyhedral Surfaces \cgalCite{lachaud2020}. This includes mean curvature,
Gaussian curvature, principal curvatures and directions. These can be computed on triangle meshes,
quad meshes, and meshes with n-gon faces (for n-gons, the centroid must be inside the n-gon face).
The algorithms used prove to work well in general. Also, on meshes with noise on vertex positions,
they give accurate results, on the condition that the correct vertex normals are provided.

\subsection ICCBackground Brief Background

Surface curvatures are quantities that describe the local geometry of a surface. They are important in many
geometry processing applications. As surfaces are 2-dimensional objects (embedded in 3D), they can bend
in 2 independent directions. These directions are called principal directions, and the amount of bending
in each direction is called the principal curvature: \f$ k_1 \f$ and \f$ k_2 \f$ (denoting max and min
curvatures). Curvature is usually expressed as scalar quantities like the mean curvature \f$ H \f$ and
the Gaussian curvature \f$ K \f$ which are defined in terms of the principal curvatures.

The algorithms are based on the two papers \cgalCite{lachaud2022} and \cgalCite{lachaud2020}. They
introduce a new way to compute curvatures on polygonal meshes. The main idea in \cgalCite{lachaud2022} is
based on decoupling the normal information from the position information, which is useful for dealing with
digital surfaces, or meshes with noise on vertex positions. \cgalCite{lachaud2020} introduces some
extensions to this framework. As it uses linear interpolation on the corrected normal vector field
to derive new closed form equations for the corrected curvature measures. These <b>interpolated</b>
curvature measures are the first step for computing the curvatures. For a triangle \f$ \tau_{ijk} \f$,
with vertices \a i, \a j, \a k:

\f[
\begin{align*}
\mu^{(0)}(\tau_{ijk}) = &\frac{1}{2} \langle \bar{\mathbf{u}} \mid (\mathbf{x}_j - \mathbf{x}_i) \times (\mathbf{x}_k - \mathbf{x}_i) \rangle, \\
\mu^{(1)}(\tau_{ijk}) = &\frac{1}{2} \langle \bar{\mathbf{u}} \mid (\mathbf{u}_k - \mathbf{u}_j) \times \mathbf{x}_i + (\mathbf{u}_i - \mathbf{u}_k) \times \mathbf{x}_j + (\mathbf{u}_j - \mathbf{u}_i) \times \mathbf{x}_k \rangle, \\
\mu^{(2)}(\tau_{ijk}) = &\frac{1}{2} \langle \mathbf{u}_i \mid \mathbf{u}_j \times \mathbf{u}_k \rangle, \\
\mu^{\mathbf{X},\mathbf{Y}}(\tau_{ijk}) = & \frac{1}{2} \big\langle \bar{\mathbf{u}} \big| \langle \mathbf{Y} | \mathbf{u}_k -\mathbf{u}_i \rangle \mathbf{X} \times (\mathbf{x}_j - \mathbf{x}_i) \big\rangle
-\frac{1}{2} \big\langle \bar{\mathbf{u}} \big| \langle \mathbf{Y} | \mathbf{u}_j -\mathbf{u}_i \rangle \mathbf{X} \times (\mathbf{x}_k - \mathbf{x}_i) \big\rangle,
\end{align*}
\f]
where \f$ \langle \cdot \mid \cdot \rangle \f$ denotes the usual scalar product,
\f$ \bar{\mathbf{u}}=\frac{1}{3}( \mathbf{u}_i + \mathbf{u}_j + \mathbf{u}_k )\f$.

The first measure \f$ \mu^{(0)} \f$ is the area measure of the triangle, and the measures \f$ \mu^{(1)} \f$ and
\f$ \mu^{(2)} \f$ are the mean and Gaussian corrected curvature measures of the triangle. The last measure
\f$ \mu^{\mathbf{X},\mathbf{Y}} \f$ is the anisotropic corrected curvature measure of the triangle. The
anisotropic measure is later used to compute the principal curvatures and directions through an eigenvalue
solver.

The interpolated curvature measures are then computed for each vertex \f$ v \f$ as the sum of
the curvature measures of the faces in a ball around \f$ v \f$ weighted by the inclusion ratio of the
triangle in the ball. if the ball radius is not specified, the sum is instead over the incident faces
of \f$ v \f$.

To get the final curvature value for a vertex \f$ v \f$, the respective interpolated curvature measure
is divided by the interpolated area measure.

\f[
\mu^{(k)}( B ) = \sum_{\tau : \text{triangle} } \mu^{(k)}( \tau ) \frac{\mathrm{Area}( \tau \cap B )}{\mathrm{Area}(\tau)}.
\f]

\subsection ICCAPI API

The implementation is generic in terms of mesh data structure. It can be used on `Surface_mesh`,
`Polyhedron_3` and other polygonal mesh structures based on the concept `FaceGraph`.

These computations are performed using (on all vertices of the mesh):
- `CGAL::Polygon_mesh_processing::interpolated_corrected_mean_curvature()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_Gaussian_curvature()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_principal_curvatures_and_directions()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_curvatures()`

Where it is recommended to use the last function for computing multiple curvatures (for example: mean and
Gaussian) as the implementation performs the shared computations only once, making it more efficient.

Similarly, we can use the following functions to compute curvatures on a specific vertex:
- `CGAL::Polygon_mesh_processing::interpolated_corrected_mean_curvature_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_Gaussian_curvature_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_principal_curvatures_and_directions_one_vertex()`
- `CGAL::Polygon_mesh_processing::interpolated_corrected_curvatures_one_vertex()`

\subsection ICCResults Results & Performance

**To be updated**

\cgalFigureRef{icc_diff_radius} shows how the mean curvature changes depending on
the named parameter `ball_radius`, which can be set to a value > 0 to get a smoother
distribution of values and "diffuses" the extreme values of curvatures across the mesh.

\cgalFigureAnchor{icc_diff_radius}
<center>
<img src="icc_diff_radius.png" style="max-width:85%;"/>
</center>
\cgalFigureCaptionBegin{icc_diff_radius}
The mean curvature on a mesh with different values for the ball radius
parameter: (a) R = 0, (b) R = 0.025, (c) R = 0.05, (d) R = 0.16. Note that the max
edge length is 0.031 and the size of the bounding box of the mesh is 1 x .7 x .8.
\cgalFigureCaptionEnd

\ref BGLPropertyMaps are used to record the computed curvatures as shown in examples. In the following examples, for each property map, we associate
a curvature value to each vertex.

\subsection ICCExampleSM Interpolated Corrected Curvatures on a Surface Mesh Example

The following example illustrates how to
compute the curvatures on vertices
and store them in the property maps provided by the class `Surface_mesh`.

\cgalExample{Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp}

\subsection ICCExamplePH Interpolated Corrected Curvatures on a Polyhedron Example

The following example illustrates how to
compute the curvatures on vertices
and store them in dynamic property maps as the class `Polyhedron_3` does
not provide storage for the curvatures.

\cgalExample{Polygon_mesh_processing/interpolated_corrected_curvatures_PH.cpp}

\subsection ICCExampleSV Interpolated Corrected Curvatures on a Vertex Example

The following example illustrates how to
compute the curvatures on a specific vertex

\cgalExample{Polygon_mesh_processing/interpolated_corrected_curvatures_vertex.cpp}

****************************************
\section PMPSlicer Slicer
Expand Down Expand Up @@ -1143,6 +1266,10 @@ available on 7th of October 2020. It only uses the high level algorithm of chec
is covered by a set of prisms, where each prism is an offset for an input triangle.
That is, the implementation in \cgal does not use indirect predicates.

The interpolated corrected curvatures were implemented during GSoC 2022. This was implemented by Hossam Saeed and under
supervision of David Coeurjolly, Jaques-Olivier Lachaud, and Sébastien Loriot. The implementation is based on \cgalCite{lachaud2020}.
<a href="https://dgtal-team.github.io/doc-nightly/moduleCurvatureMeasures.html">DGtal's implementation</a> was also
used as a reference during the project.

*/
} /* namespace CGAL */
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
\example Polygon_mesh_processing/refine_fair_example.cpp
\example Polygon_mesh_processing/mesh_slicer_example.cpp
\example Polygon_mesh_processing/isotropic_remeshing_example.cpp
\example Polygon_mesh_processing/interpolated_corrected_curvatures_SM.cpp
\example Polygon_mesh_processing/interpolated_corrected_curvatures_PH.cpp
\example Polygon_mesh_processing/interpolated_corrected_curvatures_vertex.cpp
\example Polygon_mesh_processing/delaunay_remeshing_example.cpp
\example Polygon_mesh_processing/compute_normals_example_Polyhedron.cpp
\example Polygon_mesh_processing/hausdorff_distance_remeshing_example.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ if(TARGET CGAL::Eigen3_support)
target_link_libraries(delaunay_remeshing_example PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("remesh_almost_planar_patches.cpp")
target_link_libraries(remesh_almost_planar_patches PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("interpolated_corrected_curvatures_SM.cpp")
target_link_libraries(interpolated_corrected_curvatures_SM PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("interpolated_corrected_curvatures_PH.cpp")
target_link_libraries(interpolated_corrected_curvatures_PH PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("interpolated_corrected_curvatures_vertex.cpp")
target_link_libraries(interpolated_corrected_curvatures_vertex PUBLIC CGAL::Eigen3_support)
else()
message(STATUS "NOTICE: Examples that use Eigen will not be compiled.")
endif()
Expand Down
Loading

0 comments on commit fe3fa38

Please sign in to comment.