Rename and move stuff

This commit is contained in:
Andreas Fabri 2022-03-15 10:34:36 +01:00
parent b1926b715a
commit a6ae3b1ac1
3 changed files with 49 additions and 34 deletions

View File

@ -19,29 +19,10 @@
#include <CGAL/Constrained_Delaunay_triangulation_face_base_2.h> #include <CGAL/Constrained_Delaunay_triangulation_face_base_2.h>
#include <CGAL/Has_timestamp.h> #include <CGAL/Has_timestamp.h>
#include <boost/property_map/property_map.hpp>
namespace CGAL { namespace CGAL {
template <typename CDT>
struct In_domain {
typedef typename CDT::Face_handle key_type;
typedef bool value_type;
typedef bool reference;
typedef boost::read_write_property_map_tag category;
friend bool get(In_domain, const key_type& k)
{
return k->is_in_domain();
}
friend void put(In_domain, const key_type& k, const value_type& v)
{
k->set_in_domain(v);
}
};
template <class Gt, template <class Gt,
class Fb = Constrained_Delaunay_triangulation_face_base_2<Gt> > class Fb = Constrained_Delaunay_triangulation_face_base_2<Gt> >

View File

@ -45,7 +45,7 @@ int main( )
in_domain(in_domain_map); in_domain(in_domain_map);
//Mark facets that are inside the domain bounded by the polygon //Mark facets that are inside the domain bounded by the polygon
CGAL::mark_domains(cdt, in_domain); CGAL::mark_domain_in_triangulation(cdt, in_domain);
int count=0; int count=0;
for (Face_handle f : cdt.finite_face_handles()) for (Face_handle f : cdt.finite_face_handles())

View File

@ -9,22 +9,44 @@
// //
// Author(s) : Andreas Fabri // Author(s) : Andreas Fabri
#ifndef CGAL_MARK_DOMAINS_H #ifndef CGAL_MARK_DOMAIN_IN_TRIANGULATION_H
#define CGAL_MARK_DOMAINS_H #define CGAL_MARK_DOMAIN_IN_TRIANGULATION_H
#include <CGAL/license/Triangulation_2.h> #include <CGAL/license/Triangulation_2.h>
#include <list> #include <list>
#include <deque> #include <deque>
#include <boost/property_map/property_map.hpp>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
namespace CGAL { namespace CGAL {
namespace internal {
template <typename CDT, typename InDomainPmap> template <typename CDT>
struct In_domain {
typedef typename CDT::Face_handle key_type;
typedef bool value_type;
typedef bool reference;
typedef boost::read_write_property_map_tag category;
friend bool get(In_domain, const key_type& k)
{
return k->is_in_domain();
}
friend void put(In_domain, const key_type& k, const value_type& v)
{
k->set_in_domain(v);
}
};
template <typename CDT, typename InDomainPmap>
void void
mark_domains(CDT& ct, mark_domain_in_triangulation(CDT& ct,
Unique_hash_map<typename CDT::Face_handle,int>& nesting_level, Unique_hash_map<typename CDT::Face_handle,int>& nesting_level,
typename CDT::Face_handle start, typename CDT::Face_handle start,
int index, int index,
@ -60,6 +82,9 @@ mark_domains(CDT& ct,
} }
} }
} // namesapce internal
//explore set of facets connected with non constrained edges, //explore set of facets connected with non constrained edges,
//and attribute to each such set a nesting level. //and attribute to each such set a nesting level.
//We start from facets incident to the infinite vertex, with a nesting //We start from facets incident to the infinite vertex, with a nesting
@ -68,7 +93,7 @@ mark_domains(CDT& ct,
//Facets in the domain are those with an odd nesting level. //Facets in the domain are those with an odd nesting level.
template <typename CDT, typename InDomainPmap> template <typename CDT, typename InDomainPmap>
void void
mark_domains(CDT& cdt, InDomainPmap ipm) mark_domain_in_triangulation(CDT& cdt, InDomainPmap ipm)
{ {
typedef typename CDT::Face_handle Face_handle; typedef typename CDT::Face_handle Face_handle;
typedef typename CDT::Edge Edge; typedef typename CDT::Edge Edge;
@ -80,17 +105,26 @@ mark_domains(CDT& cdt, InDomainPmap ipm)
} }
std::list<Edge> border; std::list<Edge> border;
mark_domains(cdt, nesting_level, cdt.infinite_face(), 0, border, ipm); internal::mark_domain_in_triangulation(cdt, nesting_level, cdt.infinite_face(), 0, border, ipm);
while(! border.empty()){ while(! border.empty()){
Edge e = border.front(); Edge e = border.front();
border.pop_front(); border.pop_front();
Face_handle n = e.first->neighbor(e.second); Face_handle n = e.first->neighbor(e.second);
if(nesting_level[n] == -1){ if(nesting_level[n] == -1){
mark_domains(cdt, nesting_level, n, nesting_level[e.first]+1, border, ipm); internal::mark_domain_in_triangulation(cdt, nesting_level, n, nesting_level[e.first]+1, border, ipm);
} }
} }
} }
template <typename CDT, typename InDomainPmap>
void
mark_domain_in_triangulation(CDT& cdt)
{
internal::In_domain<CDT> in_domain;
mark_domain_in_triangulation(cdt, in_domain);
}
} // namespace CGAL } // namespace CGAL
#endif // CGAL_MARK_DOMAINS_H #endif // CGAL_MARK_DOMAIN_IN_TRIANGULATION_H