From e8ce4a9bf5188e205add48da26ad3c4fc1911426 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 4 Sep 2017 17:53:58 +0200 Subject: [PATCH 1/9] Add add_features_and_incidences --- .../Mesh_domain_with_polyline_features_3.h | 100 +++++++++++++++--- 1 file changed, 88 insertions(+), 12 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 7deb9e3d220..c5357fe2e7c 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -46,6 +46,7 @@ #include // for boost::prior and boost::next #include #include +#include namespace CGAL { @@ -61,9 +62,6 @@ class Polyline typedef std::vector Data; - typedef typename Kernel::Approximate_kernel Approx_kernel; - typedef typename Kernel::Exact_kernel Exact_kernel; - public: typedef typename Data::const_iterator const_iterator; @@ -685,6 +683,17 @@ public: add_features(InputIterator first, InputIterator last, IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/); + template + IndicesOutputIterator + add_features_and_incidences + (InputIterator first, InputIterator last, + PolylinePMap polyline_pmap, + IncidentPatchesIndicesPMap incident_paches_indices_pmap, + IndicesOutputIterator out /* = CGAL::Emptyset_iterator() */); + template IndicesOutputIterator add_features_with_context(InputIterator first, InputIterator last, @@ -701,6 +710,20 @@ public: add_features_with_context(InputIterator first, InputIterator last) { add_features_with_context(first, last, CGAL::Emptyset_iterator()); } + template + void + add_features_and_incidences + (InputIterator first, InputIterator last, + PolylinePMap polyline_pmap, + IncidentPatchesIndicesPMap incident_paches_indices_pmap) + { + add_features_and_incidences(first, last, polyline_pmap, + incident_paches_indices_pmap, + CGAL::Emptyset_iterator()); + } + template void reindex_patches(const std::vector& map, IncidenceMap& incidence_map); @@ -969,29 +992,82 @@ add_features(InputIterator first, InputIterator last, return indices_out; } + +namespace details { + +template +struct Get_content_from_polyline_with_context { + typedef Get_content_from_polyline_with_context Self; + typedef const PolylineWithContext& key_type; + typedef const typename PolylineWithContext::Bare_polyline& value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + friend value_type get(const Self, key_type polyline) { + return polyline.polyline_content; + } +}; // end Get_content_from_polyline_with_context + +template +struct Get_patches_id_from_polyline_with_context { + typedef Get_patches_id_from_polyline_with_context Self; + typedef const PolylineWithContext& key_type; + typedef const typename PolylineWithContext::Context::Patches_ids& value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + friend value_type get(const Self, key_type polyline) { + return polyline.context.adjacent_patches_ids; + } +}; // end Get_patches_id_from_polyline_with_context + +} // end namespace details + template template IndicesOutputIterator Mesh_domain_with_polyline_features_3:: add_features_with_context(InputIterator first, InputIterator last, IndicesOutputIterator indices_out) +{ + typedef typename std::iterator_traits::value_type Pwc; + return add_features_and_incidences + (first, last, + details::Get_content_from_polyline_with_context(), + details::Get_patches_id_from_polyline_with_context(), + indices_out); +} + +template +template +IndicesOutputIterator +Mesh_domain_with_polyline_features_3:: +add_features_and_incidences(InputIterator first, InputIterator last, + PolylinePMap polyline_pmap, + IncidentPatchesIndicesPMap inc_patches_ind_pmap, + IndicesOutputIterator indices_out) { // Insert one edge for each element for( ; first != last ; ++first ) { - const typename Gt::Point_3& p1 = first->polyline_content.front(); - const typename Gt::Point_3& p2 = first->polyline_content.back(); + const typename boost::property_traits::reference + polyline = get(polyline_pmap, *first); + const typename boost::property_traits::reference + patches_ids = get(inc_patches_ind_pmap, *first); + const typename Gt::Point_3& p1 = *polyline.begin(); + const typename Gt::Point_3& p2 = *boost::prior(polyline.end()); Set_of_patch_ids& ids_p1 = corners_incidence_map_[p1]; - std::copy(first->context.adjacent_patches_ids.begin(), - first->context.adjacent_patches_ids.end(), + std::copy(patches_ids.begin(), + patches_ids.end(), std::inserter(ids_p1, ids_p1.begin())); Set_of_patch_ids& ids_p2 = corners_incidence_map_[p2]; - std::copy(first->context.adjacent_patches_ids.begin(), - first->context.adjacent_patches_ids.end(), + std::copy(patches_ids.begin(), + patches_ids.end(), std::inserter(ids_p2, ids_p2.begin())); Curve_index curve_id = - insert_edge(first->polyline_content.begin(), first->polyline_content.end()); - edges_incidences_[curve_id] = first->context.adjacent_patches_ids; + insert_edge(polyline.begin(), polyline.end()); + edges_incidences_[curve_id].insert(patches_ids.begin(), patches_ids.end()); *indices_out++ = curve_id; } compute_corners_incidences(); From 728f358c31bba72a7a9fa0469874e25e236752bc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 5 Sep 2017 15:43:34 +0200 Subject: [PATCH 2/9] Write the documentation --- .../Mesh_domain_with_polyline_features_3.h | 82 ----- Mesh_3/doc/Mesh_3/Doxyfile.in | 4 +- .../Mesh_domain_with_polyline_features_3.h | 342 ++++++++++-------- 3 files changed, 198 insertions(+), 230 deletions(-) delete mode 100644 Mesh_3/doc/Mesh_3/CGAL/Mesh_domain_with_polyline_features_3.h diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_domain_with_polyline_features_3.h deleted file mode 100644 index a15642524d9..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_domain_with_polyline_features_3.h +++ /dev/null @@ -1,82 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh_3Domains - -The class `Mesh_domain_with_polyline_features_3` is designed to allow the user -to add some 0- and 1-dimensional -features into any model of the `MeshDomain_3` concept. -The 1-dimensional features are described as polylines -whose endpoints are the added corners. - -\tparam MeshDomain_3 is the type -of the domain which should be extended. -It has to be a model of the `MeshDomain_3` concept. - -\cgalModels `MeshDomainWithFeatures_3` - -\sa `MeshDomain_3` -\sa `MeshPolyline_3` -\sa `CGAL::Implicit_mesh_domain_3` -\sa `CGAL::Polyhedral_mesh_domain_3` -\sa `CGAL::Labeled_image_mesh_domain_3` - -*/ -template< typename MeshDomain_3 > -class Mesh_domain_with_polyline_features_3 : public MeshDomain_3 { -public: - -/// \name Types -/// @{ - -/*! -`Corner_index` type. -*/ -typedef int Corner_index; - -/*! -`Curve_index` type. -*/ -typedef int Curve_index; - -/// @} - -/// \name Creation -/// @{ - -/*! -Constructor. Forwards the arguments to the constructor -of the base class. -*/ -template -Mesh_domain_with_polyline_features_3(T ...t); - -/// @} - -/// \name Operations -/// @{ - -/*! - -Add 1-dimensional features in the domain. `InputIterator` value type must -be a model of the concept `MeshPolyline_3`. -*/ -template -void add_features(InputIterator begin, InputIterator beyond); - -/*! - -Add 1-dimensional features in the domain with their incidences with 2-dimensional -features of the domain. The `InputIterator` value type must be -`std::pair >` -where `Polyline` must be a model of the concept `MeshPolyline_3` -and the internal pair gives a range on surface patches indices which are incident -to the polyline. -*/ -template -void add_features_and_incidences(InputIterator begin, InputIterator beyond); - -/// @} - -}; /* end Mesh_domain_with_polyline_features_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 46c3db39022..0a6229c8c69 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -1,6 +1,8 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} -INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_complex_mesh_domain_3.h +INPUT += \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_complex_mesh_domain_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_domain_with_polyline_features_3.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation" HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \ diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index c5357fe2e7c..f8af34788c9 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -50,6 +50,7 @@ namespace CGAL { +/// @cond DEVELOPERS namespace internal { namespace Mesh_3 { @@ -509,70 +510,93 @@ struct Display_incidences_to_curves_aux { } // end of namespace CGAL::internal::Mesh_3 } // end of namespace CGAL::internal +/// @endcond +/*! +\ingroup PkgMesh_3Domains +The class `Mesh_domain_with_polyline_features_3` is designed to allow the user +to add some 0- and 1-dimensional +features into any model of the `MeshDomain_3` concept. +The 1-dimensional features are described as polylines +whose endpoints are the added corners. +\tparam MeshDomain_3 is the type +of the domain which should be extended. +It has to be a model of the `MeshDomain_3` concept. +\cgalModels `MeshDomainWithFeatures_3` -/** - * @class Mesh_domain_with_polyline_features_3 - * - * - */ -template < typename MeshDomain > +\sa `MeshDomain_3` +\sa `MeshPolyline_3` +\sa `CGAL::Implicit_mesh_domain_3` +\sa `CGAL::Polyhedral_mesh_domain_3` +\sa `CGAL::Labeled_image_mesh_domain_3` + +*/ +template < typename MeshDomain_3 > class Mesh_domain_with_polyline_features_3 - : public MeshDomain + : public MeshDomain_3 { - typedef MeshDomain Base; - public: - // Index types - typedef typename Base::Index Index; +/// \name Types +/// @{ + typedef typename MeshDomain_3::Index Index; - typedef typename Base::Surface_patch_index + typedef typename MeshDomain_3::Surface_patch_index Surface_patch_index; typedef int Curve_index; typedef int Corner_index; + typedef CGAL::Tag_true Has_features; + typedef typename MeshDomain_3::R::FT FT; +/// @} + +#ifndef DOXYGEN_RUNNING #ifndef CGAL_NO_DEPRECATED_CODE typedef Curve_index Curve_segment_index; #endif - typedef typename Base::R Gt; + typedef typename MeshDomain_3::R Gt; typedef Gt R; - typedef typename Base::Point_3 Point_3; - typedef typename Gt::FT FT; - - typedef CGAL::Tag_true Has_features; - + typedef typename MeshDomain_3::Point_3 Point_3; +#endif // DOXYGEN_RUNNING #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +/// \name Creation +/// @{ + +/*! +Constructor. Forwards the arguments to the constructor +of the base class. +*/ template Mesh_domain_with_polyline_features_3(const T& ...t) - : Base(t...) + : MeshDomain_3(t...) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} +/// @} #else /// Constructors /// Call the base class constructor Mesh_domain_with_polyline_features_3() - : Base() + : MeshDomain_3() , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} template Mesh_domain_with_polyline_features_3(const T1& o1) - : Base(o1) + : MeshDomain_3(o1) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} template Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2) - : Base(o1, o2) + : MeshDomain_3(o1, o2) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} @@ -580,7 +604,7 @@ public: template Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2, const T3& o3) - : Base(o1, o2, o3) + : MeshDomain_3(o1, o2, o3) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} @@ -588,70 +612,130 @@ public: template Mesh_domain_with_polyline_features_3(const T1& o1, const T2& o2, const T3& o3, const T4& o4) - : Base(o1, o2, o3, o4) + : MeshDomain_3(o1, o2, o3, o4) , current_corner_index_(1) , current_curve_index_(1) , curves_aabb_tree_is_built(false) {} #endif - /// Destructor - ~Mesh_domain_with_polyline_features_3() {} +/// \name Operations +/// @{ + /// @cond DEVELOPERS + /// @{ + /// Overloads where the last parameter \c out is not + /// `CGAL::Emptyset_iterator()`. + template + IndicesOutputIterator + add_features(InputIterator first, InputIterator end, + IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/); + + template + IndicesOutputIterator + add_features_and_incidences + (InputIterator first, InputIterator end, + PolylinePMap polyline_pmap, + IncidentPatchesIndicesPMap incident_paches_indices_pmap, + IndicesOutputIterator out /* = CGAL::Emptyset_iterator() */); + + template + IndicesOutputIterator + add_features_with_context(InputIterator first, InputIterator end, + IndicesOutputIterator out /*= + CGAL::Emptyset_iterator()*/); + /// @} + /// \endcond + /*! + Add 1-dimensional features in the domain. `InputIterator` value type must + be a model of the concept `MeshPolyline_3`. + */ + template + void + add_features(InputIterator first, InputIterator end) + { add_features(first, end, CGAL::Emptyset_iterator()); } + + /// @cond DEVELOPERS + /// Undocumented function, kept for backward-compatibility with existing + /// code + template + void + add_features_with_context(InputIterator first, InputIterator end) + { add_features_with_context(first, end, CGAL::Emptyset_iterator()); } + /// @endcond + + /*! + Add 1-dimensional features (curves) from the range `[first, end)` in the domain with their incidences + with 2-dimensional features (patches) of the domain. + + \tparam InputIterator input iterator over curves + \tparam PolylinePMap is a model of `ReadablePropertyMap` with key type + `std::iterator_traits::%reference` and a value type + that is a model of `MeshPolyline_3`. + \tparam IncidentPatchesIndicesPMap is a model of `ReadablePropertyMap` + with key type `std::iterator_traits::%reference` and a + value type that is a range of `Surface_patch_index`. + */ + template + void + add_features_and_incidences + (InputIterator first, InputIterator end, + PolylinePMap polyline_pmap, + IncidentPatchesIndicesPMap incident_paches_indices_pmap) + { + add_features_and_incidences(first, end, polyline_pmap, + incident_paches_indices_pmap, + CGAL::Emptyset_iterator()); + } +/// @} + +/// \name Implementation of the concept MeshDomainWithFeatures_3 +/// The following methods implement the requirement of the concept +/// `MeshDomainWithFeatures_3`. +/// @{ + + /// Implements `MeshDomainWithFeatures_3::get_corners()`. /// OutputIterator value type is std::pair template OutputIterator get_corners(OutputIterator out) const; + /// Implements `MeshDomainWithFeatures_3::get_curves()`. /// OutputIterator value type is CGAL::cpp11::tuple, std::pair > template OutputIterator get_curves(OutputIterator out) const; - /// Returns the length of the curve segment, on the curve with index - /// \c curve_index, from \c p to \c q, in the orientation - /// \c orientation - /// - /// If the curve containing \c p and \c q is a loop, - /// the orientation gives identifies which portion of the loop - /// corresponds to the arc, otherwise \c orientation must be compatible - /// with the orientation of \c p and \c q on the curve segment. + /// Implements `MeshDomainWithFeatures_3::curve_segment_length()`. FT curve_segment_length(const Point_3& p, const Point_3 q, const Curve_index& curve_index, CGAL::Orientation orientation) const; - /// Returns the length of the curve with index - /// \c curve_index + /// Implements `MeshDomainWithFeatures_3::curve_length()`. FT curve_length(const Curve_index& curve_index) const; - /// Returns the signed geodesic distance between points \c p and \c q - /// of curve \c curve_index - FT signed_geodesic_distance(const Point_3& p, const Point_3& q, - const Curve_index& curve_index) const; - /// Construct a point on curve \c curve_index at geodesic distance \c distance - /// of \c starting_point + /// Implements `MeshDomainWithFeatures_3::construct_point_on_curve()`. Point_3 construct_point_on_curve(const Point_3& starting_point, const Curve_index& curve_index, FT distance) const; - - /// Returns the sign of the orientation of p,q,r along curve segment - /// of index \c index + /// Implements `MeshDomainWithFeatures_3::distance_sign_along_loop()`. CGAL::Sign distance_sign_along_loop(const Point_3& p, const Point_3& q, const Point_3& r, const Curve_index& index) const; - /// Returns the sign of the geodesic distance between \c p and \c q - /// \pre Curve of index \c index is not a loop + /// Implements `MeshDomainWithFeatures_3::distance_sign()`. CGAL::Sign distance_sign(const Point_3& p, const Point_3& q, const Curve_index& index) const; - /// Returns `true` if curve \c curve_index is a loop + /// Implements `MeshDomainWithFeatures_3::is_loop()`. bool is_loop(const Curve_index& index) const; - /// Returns `true` if the portion of the curve segment of index \c index, - /// from \c c1 to \c c2 in the orientation \c orientation, is covered by the spheres of - /// centers \c c1 and \c c2 and squared radii \c sq_r1 and \c sq_r2 - /// respectively. + /// Implements `MeshDomainWithFeatures_3::is_curve_segment_covered()`. bool is_curve_segment_covered(const Curve_index& index, CGAL::Orientation orientation, const Point_3& c1, const Point_3& c2, @@ -673,57 +757,11 @@ public: Corner_index corner_index(const Index& index) const { return boost::get(index); } - /// Insert a bunch of edges into domain - /// + InputIterator type should have begin() and end() function - /// + InputIterator::iterator value type must be Point_3 - // + IndicesOutputIterator is an output iterator of value_type equal - /// to Curve_index - template - IndicesOutputIterator - add_features(InputIterator first, InputIterator last, - IndicesOutputIterator out /*= CGAL::Emptyset_iterator()*/); + /// @cond DEVELOPERS + CGAL_DEPRECATED + FT signed_geodesic_distance(const Point_3& p, const Point_3& q, + const Curve_index& curve_index) const; - template - IndicesOutputIterator - add_features_and_incidences - (InputIterator first, InputIterator last, - PolylinePMap polyline_pmap, - IncidentPatchesIndicesPMap incident_paches_indices_pmap, - IndicesOutputIterator out /* = CGAL::Emptyset_iterator() */); - - template - IndicesOutputIterator - add_features_with_context(InputIterator first, InputIterator last, - IndicesOutputIterator out /*= - CGAL::Emptyset_iterator()*/); - - template - void - add_features(InputIterator first, InputIterator last) - { add_features(first, last, CGAL::Emptyset_iterator()); } - - template - void - add_features_with_context(InputIterator first, InputIterator last) - { add_features_with_context(first, last, CGAL::Emptyset_iterator()); } - - template - void - add_features_and_incidences - (InputIterator first, InputIterator last, - PolylinePMap polyline_pmap, - IncidentPatchesIndicesPMap incident_paches_indices_pmap) - { - add_features_and_incidences(first, last, polyline_pmap, - incident_paches_indices_pmap, - CGAL::Emptyset_iterator()); - } - template void reindex_patches(const std::vector& map, IncidenceMap& incidence_map); @@ -752,8 +790,8 @@ public: /// Insert one edge into domain /// InputIterator value type is Point_3 template - Curve_index insert_edge(InputIterator first, InputIterator last); - + Curve_index insert_edge(InputIterator first, InputIterator end); + /// @endcond private: void register_corner(const Point_3& p, const Curve_index& index); void compute_corners_incidences(); @@ -788,6 +826,7 @@ private: Edges_incidences edges_incidences_; public: + /// @cond DEVELOPERS typedef CGAL::AABB_tree Curves_AABB_tree; typedef std::set Set_of_patch_ids; typedef std::map Corners_incidence_map; @@ -838,7 +877,7 @@ public: std::cerr << " done (" << timer.time() * 1000 << " ms)" << std::endl; #endif } // end build_curves_aabb_tree() - + /// @endcond private: // Disabled copy constructor & assignment operator typedef Mesh_domain_with_polyline_features_3 Self; @@ -943,21 +982,6 @@ curve_length(const Curve_index& curve_index) const } -template -typename Mesh_domain_with_polyline_features_3::FT -Mesh_domain_with_polyline_features_3:: -signed_geodesic_distance(const Point_3& p, const Point_3& q, - const Curve_index& curve_index) const -{ - // Get corresponding polyline - typename Edges::const_iterator eit = edges_.find(curve_index); - CGAL_assertion(eit != edges_.end()); - - // Compute geodesic_distance - return eit->second.signed_geodesic_distance(p,q); -} - - template typename Mesh_domain_with_polyline_features_3::Point_3 Mesh_domain_with_polyline_features_3:: @@ -979,11 +1003,11 @@ template template IndicesOutputIterator Mesh_domain_with_polyline_features_3:: -add_features(InputIterator first, InputIterator last, +add_features(InputIterator first, InputIterator end, IndicesOutputIterator indices_out) { // Insert one edge for each element - while ( first != last ) + while ( first != end ) { *indices_out++ = insert_edge(first->begin(), first->end()); ++first; @@ -992,7 +1016,7 @@ add_features(InputIterator first, InputIterator last, return indices_out; } - +/// @cond DEVELOPERS namespace details { template @@ -1020,21 +1044,7 @@ struct Get_patches_id_from_polyline_with_context { }; // end Get_patches_id_from_polyline_with_context } // end namespace details - -template -template -IndicesOutputIterator -Mesh_domain_with_polyline_features_3:: -add_features_with_context(InputIterator first, InputIterator last, - IndicesOutputIterator indices_out) -{ - typedef typename std::iterator_traits::value_type Pwc; - return add_features_and_incidences - (first, last, - details::Get_content_from_polyline_with_context(), - details::Get_patches_id_from_polyline_with_context(), - indices_out); -} +/// @endcond template template IndicesOutputIterator Mesh_domain_with_polyline_features_3:: -add_features_and_incidences(InputIterator first, InputIterator last, +add_features_and_incidences(InputIterator first, InputIterator end, PolylinePMap polyline_pmap, IncidentPatchesIndicesPMap inc_patches_ind_pmap, IndicesOutputIterator indices_out) { // Insert one edge for each element - for( ; first != last ; ++first ) + for( ; first != end ; ++first ) { const typename boost::property_traits::reference polyline = get(polyline_pmap, *first); @@ -1074,6 +1084,37 @@ add_features_and_incidences(InputIterator first, InputIterator last, return indices_out; } +/// @cond DEVELOPERS +template +typename Mesh_domain_with_polyline_features_3::FT +Mesh_domain_with_polyline_features_3:: +signed_geodesic_distance(const Point_3& p, const Point_3& q, + const Curve_index& curve_index) const +{ + // Get corresponding polyline + typename Edges::const_iterator eit = edges_.find(curve_index); + CGAL_assertion(eit != edges_.end()); + + // Compute geodesic_distance + return eit->second.signed_geodesic_distance(p,q); +} + + +template +template +IndicesOutputIterator +Mesh_domain_with_polyline_features_3:: +add_features_with_context(InputIterator first, InputIterator end, + IndicesOutputIterator indices_out) +{ + typedef typename std::iterator_traits::value_type Pwc; + return add_features_and_incidences + (first, end, + details::Get_content_from_polyline_with_context(), + details::Get_patches_id_from_polyline_with_context(), + indices_out); +} + template template void @@ -1147,7 +1188,9 @@ get_corner_incident_curves(Corner_index id, const std::set& incidences = it->second; return std::copy(incidences.begin(), incidences.end(), indices_out); } +/// @endcond +/// @cond DEVELOPERS namespace internal { namespace Mesh_3 { template @@ -1214,7 +1257,9 @@ operator()(std::ostream& os, Point p, typename MDwPF_::Curve_index id, } }} // end namespaces internal::Mesh_3:: and internal:: +/// @endcond +/// @cond DEVELOPERS template void Mesh_domain_with_polyline_features_3:: @@ -1230,7 +1275,7 @@ display_corner_incidences(std::ostream& os, Point_3 p, Corner_index id) D_i_t_c()(os, p, id, corners_tmp_incidences_[id]); D_i_t_p()(os, p, id, corners_incidences_[id]); } - +/// @endcond template void Mesh_domain_with_polyline_features_3:: @@ -1280,6 +1325,7 @@ compute_corners_incidences() } } +/// @cond DEVELOPERS template const typename Mesh_domain_with_polyline_features_3::Surface_patch_index_set& Mesh_domain_with_polyline_features_3:: @@ -1288,6 +1334,7 @@ get_incidences(Curve_index id) const typename Edges_incidences::const_iterator it = edges_incidences_.find(id); return it->second; } +/// @endcond template void @@ -1312,13 +1359,14 @@ register_corner(const Point_3& p, const Curve_index& curve_index) corners_tmp_incidences_[index].insert(curve_index); } +/// @cond DEVELOPERS template template typename Mesh_domain_with_polyline_features_3::Curve_index Mesh_domain_with_polyline_features_3:: -insert_edge(InputIterator first, InputIterator last) +insert_edge(InputIterator first, InputIterator end) { - CGAL_assertion(std::distance(first,last) > 1); + CGAL_assertion(std::distance(first,end) > 1); const Curve_index curve_index = current_curve_index_++; @@ -1329,9 +1377,9 @@ insert_edge(InputIterator first, InputIterator last) // 'compute_corners_incidences()', that corner is incident only to a // loop, then it will be removed from the set of corners. register_corner(*first, curve_index); - if ( *first != *boost::prior(last) ) + if ( *first != *boost::prior(end) ) { - register_corner(*boost::prior(last), curve_index); + register_corner(*boost::prior(end), curve_index); } // Create a new polyline @@ -1339,13 +1387,13 @@ insert_edge(InputIterator first, InputIterator last) edges_.insert(std::make_pair(curve_index,Polyline())); // Fill polyline with data - while ( first != last ) + while ( first != end ) { insertion.first->second.add_point(*first++); } return curve_index; } - +/// @endcond template CGAL::Sign From dbd818e68bbb0f28f606e4054cbeded5e99a0a81 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 3 Oct 2017 10:46:30 +0200 Subject: [PATCH 3/9] Remove the deprecation of signed_geodesic_distance That function is still required by `Sizing_field_with_aabb_tree`. We will document it later. --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index f8af34788c9..690527f472e 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -758,7 +758,6 @@ of the base class. { return boost::get(index); } /// @cond DEVELOPERS - CGAL_DEPRECATED FT signed_geodesic_distance(const Point_3& p, const Point_3& q, const Curve_index& curve_index) const; From 430a62fd608722f0f4e81c218a84412c1ff7971c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 3 Oct 2017 16:29:00 +0200 Subject: [PATCH 4/9] Document also the parameters --- .../include/CGAL/Mesh_domain_with_polyline_features_3.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 690527f472e..e564a7ebf5d 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -677,6 +677,15 @@ of the base class. \tparam IncidentPatchesIndicesPMap is a model of `ReadablePropertyMap` with key type `std::iterator_traits::%reference` and a value type that is a range of `Surface_patch_index`. + + \param first iterator to the first curve of the sequence + \param end past-the-end iterator of the sequence of curves + \param polyline_pmap the property map that provides access to the + polyline, model of `MeshPolyline_3`, from the `%reference` type of + the iterator + \param incident_paches_indices_pmap the property map that provides + access the set of indices of the surface patches that are incident to + a given 1D-feature (curve) */ template Date: Tue, 3 Oct 2017 16:58:13 +0200 Subject: [PATCH 5/9] paches->patches --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index e564a7ebf5d..7b4029f5247 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -683,7 +683,7 @@ of the base class. \param polyline_pmap the property map that provides access to the polyline, model of `MeshPolyline_3`, from the `%reference` type of the iterator - \param incident_paches_indices_pmap the property map that provides + \param incident_patches_indices_pmap the property map that provides access the set of indices of the surface patches that are incident to a given 1D-feature (curve) */ @@ -694,10 +694,10 @@ of the base class. add_features_and_incidences (InputIterator first, InputIterator end, PolylinePMap polyline_pmap, - IncidentPatchesIndicesPMap incident_paches_indices_pmap) + IncidentPatchesIndicesPMap incident_patches_indices_pmap) { add_features_and_incidences(first, end, polyline_pmap, - incident_paches_indices_pmap, + incident_patches_indices_pmap, CGAL::Emptyset_iterator()); } /// @} From 250cfea70cce57e0c250a0ea133bbdc16d535dc8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 3 Oct 2017 16:58:49 +0200 Subject: [PATCH 6/9] typo --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 7b4029f5247..114449aada0 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -684,7 +684,7 @@ of the base class. polyline, model of `MeshPolyline_3`, from the `%reference` type of the iterator \param incident_patches_indices_pmap the property map that provides - access the set of indices of the surface patches that are incident to + access to the set of indices of the surface patches that are incident to a given 1D-feature (curve) */ template Date: Wed, 4 Oct 2017 10:58:51 +0200 Subject: [PATCH 7/9] Re-add curve_segment_index(..) as a deprecated compatibility method --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 114449aada0..03f3c64a113 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -767,6 +767,13 @@ of the base class. { return boost::get(index); } /// @cond DEVELOPERS +#ifndef CGAL_NO_DEPRECATED_CODE + CGAL_DEPRECATED_MSG("deprecated: use curve_index() instead") + Curve_index curve_segment_index(const Index& index) const { + return curve_index(index); + } +#endif // CGAL_NO_DEPRECATED_CODE + FT signed_geodesic_distance(const Point_3& p, const Point_3& q, const Curve_index& curve_index) const; From 69397e159de054fb16805c487fef61e018ef236c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 4 Oct 2017 10:59:33 +0200 Subject: [PATCH 8/9] Remove that include - it is actually not used - it does not exist in older Boost versions (1.48) --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 03f3c64a113..340f1a0a830 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -46,7 +46,6 @@ #include // for boost::prior and boost::next #include #include -#include namespace CGAL { From 69360e294663d810be293e46c945d8dbfe2ee78b Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 4 Oct 2017 14:07:03 +0200 Subject: [PATCH 9/9] Fix typos See Mael's comment https://github.com/CGAL/cgal/pull/2482#issuecomment-334126506 --- .../include/CGAL/Mesh_domain_with_polyline_features_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 340f1a0a830..43ec4677d19 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -749,19 +749,19 @@ of the base class. const Point_3& c1, const Point_3& c2, const FT sq_r1, const FT sq_r2) const; - /// Returns an Index from a Curve_index + /// Returns an `Index` from a `Curve_index` Index index_from_curve_index(const Curve_index& index) const { return Index(index); } - /// Returns an Curve_index from an Index + /// Returns a `Curve_index` from an `Index` Curve_index curve_index(const Index& index) const { return boost::get(index); } - /// Returns an Index from a Corner_index + /// Returns an `Index` from a `Corner_index` Index index_from_corner_index(const Corner_index& index) const { return Index(index); } - /// Returns an Corner_index from an Index + /// Returns a `Corner_index` from an `Index` Corner_index corner_index(const Index& index) const { return boost::get(index); }