diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 82f399e9dba..1d6c5805f8c 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -20,12 +20,12 @@ Release date: September 2018 ### CGAL and Boost Property Maps -- Addition of a read-write property map to convert on-the-fly geometric +- Addition of a read-write property map to convert on-the-fly geometric object from Cartesian kernels ### 2D Triangulations -- Added a new type of intersection to deal with insertion of a constraints +- Added a new type of intersection to deal with insertion of a constraints intersecting in a Constrained_triangulation_2. ### Interpolation @@ -52,6 +52,12 @@ Release date: September 2018 - Guarantee that constrained vertices are kept in the mesh after calling `isotropic_remeshing()` (and not only the points associated to constrained vertices as it was before). +- Mesh smoothing functionality which improves the quality of triangle elements + based on geometric characteristics. + +- Shape smoothing functionality that smoothes the surface of a triangle mesh + using the mean curvature flow to perform noise removal. + ### 3D Mesh Generation - **Breaking change:** The template parameters of the class template @@ -96,7 +102,7 @@ Release date: April 2018 introduced by CMake 2.8.12 and CMake 3.0: instead of setting CMake variables, the script now defines imported targets and uses link interfaces. - + That is mostly backward-compatible with existing usages of CGAL CMake scripts. The only non-compatible effect is that the `CMAKE_BUILD_TYPE` and compilation flags are no longer copied from the `CGAL_DIR` to the diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/mesh_smoothing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/mesh_smoothing_example.cpp index 35eddb7dbd1..0c6e9001da4 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/mesh_smoothing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/mesh_smoothing_example.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Mesh; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/shape_smoothing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/shape_smoothing_example.cpp index 95c55a48b9c..a87094f47b6 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/shape_smoothing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/shape_smoothing_example.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Mesh; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/constraints_map.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/constraints_map.h deleted file mode 100644 index 7cceee6861f..00000000000 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/constraints_map.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2018 GeometryFactory (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0+ -// -// -// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com) - -#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CONSTRAINTS_MAP_H -#define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CONSTRAINTS_MAP_H - -#include - -#include - -namespace CGAL { -namespace Polygon_mesh_processing { -namespace internal { - - -template > -struct Edge_cotangent_weight : CotangentValue -{ - Edge_cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_) - : CotangentValue(pmesh_, vpmap_) - {} - - PolygonMesh& pmesh() - { - return CotangentValue::pmesh(); - } - - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - - double operator()(halfedge_descriptor he) - { - if(is_border_edge(he, pmesh())) - { - halfedge_descriptor h1 = next(he, pmesh()); - vertex_descriptor vs = source(he, pmesh()); - vertex_descriptor vt = target(he, pmesh()); - vertex_descriptor v1 = target(h1, pmesh()); - return (CotangentValue::operator ()(vs, v1, vt)); - } - else - { - halfedge_descriptor h1 = next(he, pmesh()); - halfedge_descriptor h2 = prev(opposite(he, pmesh()), pmesh()); - vertex_descriptor vs = source(he, pmesh()); - vertex_descriptor vt = target(he, pmesh()); - vertex_descriptor v1 = target(h1, pmesh()); - vertex_descriptor v2 = source(h2, pmesh()); - return ( CotangentValue::operator()(vs, v1, vt) + CotangentValue::operator()(vs, v2, vt) ) / 2.0; } - } -}; - -} -} -} - -#endif //CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CONSTRAINTS_MAP_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index 2526b63ddea..f922be4cfc2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -19,8 +19,8 @@ // // Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com) -#ifndef CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_NEW_IMPL_H -#define CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_NEW_IMPL_H +#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CURVATURE_FLOW_IMPL_H +#define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CURVATURE_FLOW_IMPL_H #include @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -53,6 +53,7 @@ private: typedef typename GeomTraits::FT NT; typedef typename GeomTraits::Point_3 Point; + typedef typename boost::property_traits::reference Point_ref; typedef CGAL::Triple Triplet; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -233,7 +234,7 @@ private: BOOST_FOREACH(vertex_descriptor vi, vrange_) { int index = vimap_[vi]; - Point p = get(vpmap_, vi); + Point_ref p = get(vpmap_, vi); bx.set(index, p.x()); by.set(index, p.y()); bz.set(index, p.z()); @@ -299,4 +300,4 @@ private: } // PMP } // CGAL -#endif // CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_NEW_IMPL_H +#endif // CGAL_POLYGON_MESH_PROCESSING_INTERNAL_CURVATURE_FLOW_NEW_IMPL_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h index cadf72f1dcb..c309c1c24dc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h @@ -19,8 +19,8 @@ // // Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com) -#ifndef CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_EVALUATION_H -#define CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_EVALUATION_H +#ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SMOOTHING_EVALUATION_H +#define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SMOOTHING_EVALUATION_H #include @@ -152,4 +152,4 @@ private: } -#endif // CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_EVALUATION_H +#endif // CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SMOOTHING_EVALUATION_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_helpers.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_helpers.h index dc62a23c5c3..7b18d73d0e3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_helpers.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_helpers.h @@ -31,6 +31,44 @@ namespace CGAL { namespace Polygon_mesh_processing { namespace internal { +template > +struct Edge_cotangent_weight : CotangentValue +{ + Edge_cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) + {} + + PolygonMesh& pmesh() + { + return CotangentValue::pmesh(); + } + + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + double operator()(halfedge_descriptor he) + { + if(is_border_edge(he, pmesh())) + { + halfedge_descriptor h1 = next(he, pmesh()); + vertex_descriptor vs = source(he, pmesh()); + vertex_descriptor vt = target(he, pmesh()); + vertex_descriptor v1 = target(h1, pmesh()); + return (CotangentValue::operator ()(vs, v1, vt)); + } + else + { + halfedge_descriptor h1 = next(he, pmesh()); + halfedge_descriptor h2 = prev(opposite(he, pmesh()), pmesh()); + vertex_descriptor vs = source(he, pmesh()); + vertex_descriptor vt = target(he, pmesh()); + vertex_descriptor v1 = target(h1, pmesh()); + vertex_descriptor v2 = source(h2, pmesh()); + return ( CotangentValue::operator()(vs, v1, vt) + CotangentValue::operator()(vs, v2, vt) ) / 2.0; } + } +}; + template void construct_triangle(const Descriptor& f, const PolygonMesh& mesh_, Triangle& triangle) { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/mesh_smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h similarity index 98% rename from Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/mesh_smoothing.h rename to Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h index 1957fecd190..6b988aaa075 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/mesh_smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h @@ -19,8 +19,8 @@ // // Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com) -#ifndef CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H -#define CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H +#ifndef CGAL_POLYGON_MESH_PROCESSING_SMOOTH_MESH_H +#define CGAL_POLYGON_MESH_PROCESSING_SMOOTH_MESH_H #include @@ -28,8 +28,8 @@ #include #include #include -#include #include +#include #ifdef CGAL_PMP_SMOOTHING_VERBOSE #include @@ -341,4 +341,4 @@ void aspect_ratio_evaluation(PolygonMesh& pmesh, const char* filename) } // namespace Polygon_mesh_processing } // namespace CGAL -#endif // CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H +#endif // CGAL_POLYGON_MESH_PROCESSING_SMOOTH_MESH_H diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h similarity index 97% rename from Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_smoothing.h rename to Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h index 04846325528..02a2f320454 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h @@ -19,22 +19,19 @@ // // Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com) -#ifndef CGAL_POLYGON_MESH_PROCESSING_SHAPE_SMOOTHING_H -#define CGAL_POLYGON_MESH_PROCESSING_sHAPE_SMOOTHING_H +#ifndef CGAL_POLYGON_MESH_PROCESSING_SMOOTH_SHAPE_H +#define CGAL_POLYGON_MESH_PROCESSING_SMOOTH_SHAPE_H #include -#include -#include - #if defined(CGAL_EIGEN3_ENABLED) #include #endif #include #include -#include #include +#include #ifdef CGAL_PMP_SMOOTHING_VERBOSE #include @@ -415,4 +412,4 @@ void solve_mcf(const FaceRange& faces, PolygonMesh& mesh, const double time, } //Polygon_mesh_processing } //CGAL -#endif // CGAL_POLYGON_MESH_PROCESSING_SHAPE_SMOOTHING_H +#endif // CGAL_POLYGON_MESH_PROCESSING_SMOOTH_SHAPE_H diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp index ed354418dba..a31545c0d2a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_smoothing.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_smoothing.cpp index a2cbf7fd73d..18df6fc0b71 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_smoothing.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_shape_smoothing.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include