mirror of https://github.com/CGAL/cgal
polyhedral domain with features works for Surface_mesh and cheese.off (Polyhedron does no longer :(
Conflicts: Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h Surface_mesh/include/CGAL/boost/graph/PMP_properties_Surface_mesh.h
This commit is contained in:
parent
7bd5016c6d
commit
5db694c154
|
|
@ -127,9 +127,10 @@ Property maps can be wrapped with `Graph_with_descriptor_with_graph_property_map
|
||||||
\cgalModels `MutableFaceGraph` if `Graph` is a model of `MutableFaceGraph`
|
\cgalModels `MutableFaceGraph` if `Graph` is a model of `MutableFaceGraph`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename Graph>
|
template<typename Graph_>
|
||||||
struct Graph_with_descriptor_with_graph
|
struct Graph_with_descriptor_with_graph
|
||||||
{
|
{
|
||||||
|
typedef Graph_ Graph;
|
||||||
Graph* graph;
|
Graph* graph;
|
||||||
|
|
||||||
typedef boost::graph_traits<Graph> gt;
|
typedef boost::graph_traits<Graph> gt;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <CGAL/Mesh_triangulation_3.h>
|
#include <CGAL/Mesh_triangulation_3.h>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <CGAL/boost/graph/PMP_properties_Surface_mesh.h>
|
#include <CGAL/boost/graph/PMP_properties_Surface_mesh.h>
|
||||||
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
||||||
#include <CGAL/make_mesh_3.h>
|
#include <CGAL/make_mesh_3.h>
|
||||||
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
|
|
@ -47,6 +48,8 @@ int main(int argc, char*argv[])
|
||||||
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
CGAL::Timer t;
|
||||||
|
t.start();
|
||||||
// Create domain
|
// Create domain
|
||||||
Mesh_domain domain(polyhedron);
|
Mesh_domain domain(polyhedron);
|
||||||
|
|
||||||
|
|
@ -61,6 +64,7 @@ int main(int argc, char*argv[])
|
||||||
// Mesh generation
|
// Mesh generation
|
||||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
|
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
|
||||||
|
|
||||||
|
std::cerr << t.time() << " sec." << std::endl;
|
||||||
// Output
|
// Output
|
||||||
std::ofstream medit_file("out.mesh");
|
std::ofstream medit_file("out.mesh");
|
||||||
c3t3.output_to_medit(medit_file);
|
c3t3.output_to_medit(medit_file);
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,15 @@ get(CGAL::face_patch_id_t<Patch_id>,
|
||||||
return Patch_id_pmap<Gt,Patch_id>();
|
return Patch_id_pmap<Gt,Patch_id>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Gt >
|
||||||
|
CGAL::static_property_map<typename boost::graph_traits<Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<int> > >::face_descriptor,std::pair<int,int> >
|
||||||
|
inline get(CGAL::face_patch_id_t<void>, Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<int> >& polyhedron)
|
||||||
|
{
|
||||||
|
typedef CGAL::static_property_map<typename boost::graph_traits<Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<int> > >::face_descriptor,std::pair<int,int> > Pmap;
|
||||||
|
|
||||||
|
return Pmap(std::make_pair(0,1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Gt, typename Patch_id>
|
template <typename Gt, typename Patch_id>
|
||||||
struct vertex_num_feature_edges_pmap {
|
struct vertex_num_feature_edges_pmap {
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,42 @@ max_length(const Bbox_3& b)
|
||||||
// Surface_patch_index_generator
|
// Surface_patch_index_generator
|
||||||
// To use patch_id enclosed in AABB_primitives or not
|
// To use patch_id enclosed in AABB_primitives or not
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
template < typename Subdomain_index, typename Polyhedron, typename Tag >
|
|
||||||
|
// here we had Tag_true instead of Patch_id
|
||||||
|
template < typename Subdomain_index, typename Polyhedron, typename Patch_id>
|
||||||
struct Surface_patch_index_generator
|
struct Surface_patch_index_generator
|
||||||
|
{
|
||||||
|
typedef Patch_id Surface_patch_index;
|
||||||
|
typedef Surface_patch_index type;
|
||||||
|
|
||||||
|
template < typename Primitive_id >
|
||||||
|
Surface_patch_index operator()(const Primitive_id& primitive_id)
|
||||||
|
{
|
||||||
|
return primitive_id->patch_id();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template < typename Subdomain_index, typename P, typename Patch_id>
|
||||||
|
struct Surface_patch_index_generator<Subdomain_index, Graph_with_descriptor_with_graph<Surface_mesh<P> >, Patch_id>
|
||||||
|
{
|
||||||
|
typedef Patch_id Surface_patch_index;
|
||||||
|
typedef Surface_patch_index type;
|
||||||
|
|
||||||
|
template < typename Primitive_id >
|
||||||
|
Surface_patch_index operator()(const Primitive_id& primitive_id)
|
||||||
|
{
|
||||||
|
typedef boost::property_map<Surface_mesh<P>, face_patch_id_t<Patch_id> >::type Fpim;
|
||||||
|
typename Fpim fpim = get(face_patch_id_t<Patch_id>(),*((*primitive_id).graph));
|
||||||
|
Surface_patch_index spi = get(fpim, (*primitive_id).descriptor);
|
||||||
|
return spi;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template < typename Subdomain_index, typename Polyhedron>
|
||||||
|
struct Surface_patch_index_generator<Subdomain_index, Polyhedron,void>
|
||||||
{
|
{
|
||||||
typedef std::pair<Subdomain_index,Subdomain_index> Surface_patch_index;
|
typedef std::pair<Subdomain_index,Subdomain_index> Surface_patch_index;
|
||||||
typedef Surface_patch_index type;
|
typedef Surface_patch_index type;
|
||||||
|
|
@ -94,17 +128,6 @@ struct Surface_patch_index_generator
|
||||||
{ return Surface_patch_index(0,1); }
|
{ return Surface_patch_index(0,1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template < typename Subdomain_index, typename Polyhedron >
|
|
||||||
struct Surface_patch_index_generator<Subdomain_index, Polyhedron, CGAL::Tag_true>
|
|
||||||
{
|
|
||||||
typedef typename Polyhedron::Face::Patch_id Surface_patch_index; // AF: change for Surface_mesh
|
|
||||||
typedef Surface_patch_index type;
|
|
||||||
|
|
||||||
template < typename Primitive_id >
|
|
||||||
Surface_patch_index operator()(const Primitive_id& primitive_id)
|
|
||||||
{ return primitive_id->patch_id(); } // AF partial specialization for GwDwG ??
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Index_generator
|
// Index_generator
|
||||||
|
|
@ -162,14 +185,18 @@ struct IGT_generator<Gt,CGAL::Tag_false>
|
||||||
template<class Polyhedron,
|
template<class Polyhedron,
|
||||||
class IGT_,
|
class IGT_,
|
||||||
class TriangleAccessor=Triangle_accessor_3<Polyhedron,IGT_>,
|
class TriangleAccessor=Triangle_accessor_3<Polyhedron,IGT_>,
|
||||||
class Use_patch_id_tag=Tag_false,
|
class Patch_id_ = void,
|
||||||
class Use_exact_intersection_construction_tag = CGAL::Tag_true>
|
class Use_exact_intersection_construction_tag = CGAL::Tag_true>
|
||||||
class Polyhedral_mesh_domain_3
|
class Polyhedral_mesh_domain_3
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef typename Mesh_3::details::IGT_generator<
|
typedef typename Mesh_3::details::IGT_generator<
|
||||||
IGT_,Use_exact_intersection_construction_tag>::type IGT;
|
IGT_,Use_exact_intersection_construction_tag>::type IGT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef Patch_id_ Patch_id;
|
||||||
|
|
||||||
/// Geometric object types
|
/// Geometric object types
|
||||||
typedef typename IGT::Point_3 Point_3;
|
typedef typename IGT::Point_3 Point_3;
|
||||||
typedef typename IGT::Segment_3 Segment_3;
|
typedef typename IGT::Segment_3 Segment_3;
|
||||||
|
|
@ -186,7 +213,7 @@ public:
|
||||||
typedef boost::optional<Subdomain_index> Subdomain;
|
typedef boost::optional<Subdomain_index> Subdomain;
|
||||||
/// Type of indexes for surface patch of the input complex
|
/// Type of indexes for surface patch of the input complex
|
||||||
typedef Mesh_3::details::Surface_patch_index_generator<
|
typedef Mesh_3::details::Surface_patch_index_generator<
|
||||||
Subdomain_index,Polyhedron,Use_patch_id_tag> Surface_patch_index_generator;
|
Subdomain_index,Polyhedron,Patch_id> Surface_patch_index_generator;
|
||||||
typedef typename Surface_patch_index_generator::type Surface_patch_index;
|
typedef typename Surface_patch_index_generator::type Surface_patch_index;
|
||||||
typedef boost::optional<Surface_patch_index> Surface_patch;
|
typedef boost::optional<Surface_patch_index> Surface_patch;
|
||||||
/// Type of indexes to characterize the lowest dimensional face of the input
|
/// Type of indexes to characterize the lowest dimensional face of the input
|
||||||
|
|
@ -584,7 +611,7 @@ public:
|
||||||
{
|
{
|
||||||
Mesh_3::details::Surface_patch_index_generator<Subdomain_index,
|
Mesh_3::details::Surface_patch_index_generator<Subdomain_index,
|
||||||
Polyhedron,
|
Polyhedron,
|
||||||
Use_patch_id_tag> generator;
|
Patch_id> generator;
|
||||||
|
|
||||||
return generator(primitive_id);
|
return generator(primitive_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,28 +193,27 @@ struct Extract_polyline_with_context_visitor
|
||||||
template < class IGT_,
|
template < class IGT_,
|
||||||
class Polyhedron_ = typename Mesh_polyhedron_3<IGT_>::type,
|
class Polyhedron_ = typename Mesh_polyhedron_3<IGT_>::type,
|
||||||
class TriangleAccessor=Triangle_accessor_3<Polyhedron_,IGT_>,
|
class TriangleAccessor=Triangle_accessor_3<Polyhedron_,IGT_>,
|
||||||
class Use_patch_id_tag = Tag_true,
|
class Patch_id=int,
|
||||||
class Use_exact_intersection_construction_tag = Tag_true >
|
class Use_exact_intersection_construction_tag = Tag_true >
|
||||||
class Polyhedral_mesh_domain_with_features_3
|
class Polyhedral_mesh_domain_with_features_3
|
||||||
: public Mesh_domain_with_polyline_features_3<
|
: public Mesh_domain_with_polyline_features_3<
|
||||||
Polyhedral_mesh_domain_3< Polyhedron_,
|
Polyhedral_mesh_domain_3< Polyhedron_,
|
||||||
IGT_,
|
IGT_,
|
||||||
TriangleAccessor,
|
TriangleAccessor,
|
||||||
Use_patch_id_tag,
|
Patch_id,
|
||||||
Use_exact_intersection_construction_tag > >
|
Use_exact_intersection_construction_tag > >
|
||||||
{
|
{
|
||||||
typedef Mesh_domain_with_polyline_features_3<
|
typedef Mesh_domain_with_polyline_features_3<
|
||||||
Polyhedral_mesh_domain_3<
|
Polyhedral_mesh_domain_3<
|
||||||
Polyhedron_, IGT_, TriangleAccessor,
|
Polyhedron_, IGT_, TriangleAccessor,
|
||||||
Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base;
|
Patch_id, Use_exact_intersection_construction_tag > > Base;
|
||||||
|
|
||||||
typedef boost::adjacency_list<
|
typedef boost::adjacency_list<
|
||||||
boost::setS, // this avoids parallel edges
|
boost::setS, // this avoids parallel edges
|
||||||
boost::vecS,
|
boost::vecS,
|
||||||
boost::undirectedS,
|
boost::undirectedS,
|
||||||
typename IGT_::Point_3,
|
typename IGT_::Point_3,
|
||||||
// AF typename Polyhedron_::Vertex::Set_of_indices> Featured_edges_copy_graph;
|
std::set<Surface_patch_index> > Featured_edges_copy_graph;
|
||||||
std::set<int> > Featured_edges_copy_graph;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Polyhedron_ Polyhedron;
|
typedef Polyhedron_ Polyhedron;
|
||||||
|
|
@ -372,9 +371,9 @@ initialize_ts(Polyhedron& p)
|
||||||
typedef boost::property_map<Polyhedron,vertex_time_stamp_t>::type Vtmap;
|
typedef boost::property_map<Polyhedron,vertex_time_stamp_t>::type Vtmap;
|
||||||
typedef boost::property_map<Polyhedron,halfedge_time_stamp_t>::type Htmap;
|
typedef boost::property_map<Polyhedron,halfedge_time_stamp_t>::type Htmap;
|
||||||
typedef boost::property_map<Polyhedron,face_time_stamp_t>::type Ftmap;
|
typedef boost::property_map<Polyhedron,face_time_stamp_t>::type Ftmap;
|
||||||
Vtmap vtm;
|
Vtmap vtm = get(vertex_time_stamp,p);
|
||||||
Htmap htm;
|
Htmap htm = get(halfedge_time_stamp,p);
|
||||||
Ftmap ftm;
|
Ftmap ftm = get(face_time_stamp,p);
|
||||||
|
|
||||||
std::size_t ts = 0;
|
std::size_t ts = 0;
|
||||||
BOOST_FOREACH(typename boost::graph_traits<Polyhedron>::vertex_descriptor vd, vertices(p))
|
BOOST_FOREACH(typename boost::graph_traits<Polyhedron>::vertex_descriptor vd, vertices(p))
|
||||||
|
|
@ -437,10 +436,9 @@ detect_features(FT angle_in_degree, std::vector<Polyhedron>& poly)
|
||||||
// TODO: replace this map by and unordered_map
|
// TODO: replace this map by and unordered_map
|
||||||
P2vmap p2vmap;
|
P2vmap p2vmap;
|
||||||
|
|
||||||
typedef int ID; // AF
|
|
||||||
typedef typename boost::property_map<Polyhedron,face_patch_id_t<ID> >::type Face_patch_id_pmap;
|
|
||||||
CGAL::Polygon_mesh_processing::Detect_features_in_polyhedra<Polyhedron,Face_patch_id_pmap> detect_features(get(face_patch_id_t<ID>(), poly.front()));
|
|
||||||
|
|
||||||
|
typedef typename boost::property_map<Polyhedron,face_patch_id_t<Patch_id> >::type Face_patch_id_pmap;
|
||||||
|
CGAL::Polygon_mesh_processing::Detect_features_in_polyhedra<Polyhedron,Face_patch_id_pmap> detect_features(get(face_patch_id_t<Patch_id>(), poly.front()));
|
||||||
|
|
||||||
BOOST_FOREACH(Polyhedron& p, poly)
|
BOOST_FOREACH(Polyhedron& p, poly)
|
||||||
{
|
{
|
||||||
|
|
@ -544,9 +542,8 @@ add_featured_edges_to_graph(const Polyhedron& p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int ID; // AF
|
typedef typename boost::property_map<Polyhedron,face_patch_id_t<Patch_id> >::type Face_patch_id_pmap;
|
||||||
typedef typename boost::property_map<Polyhedron,face_patch_id_t<ID> >::type Face_patch_id_pmap;
|
Face_patch_id_pmap fpm = get(face_patch_id_t<Patch_id>(),p);
|
||||||
Face_patch_id_pmap fpm = get(face_patch_id_t<ID>(),p);
|
|
||||||
|
|
||||||
BOOST_FOREACH(Graph_edge_descriptor e, edges(graph)){
|
BOOST_FOREACH(Graph_edge_descriptor e, edges(graph)){
|
||||||
vertex_descriptor vs = p2vmap[get(vpm,source(e,graph))];
|
vertex_descriptor vs = p2vmap[get(vpm,source(e,graph))];
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,8 @@ struct vertex_incident_patches_pmap {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
inline vertex_incident_patches_pmap get(CGAL::vertex_incident_patches_t, const Polyhedron&)
|
template<typename Pid>
|
||||||
|
inline vertex_incident_patches_pmap get(CGAL::vertex_incident_patches_t<Pid>, const Polyhedron&)
|
||||||
{
|
{
|
||||||
return vertex_incident_patches_pmap();
|
return vertex_incident_patches_pmap();
|
||||||
}
|
}
|
||||||
|
|
@ -343,8 +344,8 @@ namespace boost {
|
||||||
{
|
{
|
||||||
typedef vertex_num_feature_edges_pmap type;
|
typedef vertex_num_feature_edges_pmap type;
|
||||||
};
|
};
|
||||||
template <>
|
template <typename Pid>
|
||||||
struct property_map<Polyhedron, CGAL::vertex_incident_patches_t>
|
struct property_map<Polyhedron, CGAL::vertex_incident_patches_t<Pid> >
|
||||||
{
|
{
|
||||||
typedef vertex_incident_patches_pmap type;
|
typedef vertex_incident_patches_pmap type;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,14 @@ inline get(CGAL::face_patch_id_t<I>, SMesh& smesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CGAL::static_property_map<boost::graph_traits<SMesh> ::face_descriptor,std::pair<int,int> >
|
||||||
|
inline get(CGAL::face_patch_id_t<void>, SMesh & smesh)
|
||||||
|
{
|
||||||
|
typedef CGAL::static_property_map<boost::graph_traits<SMesh>::face_descriptor,
|
||||||
|
std::pair<int,int> > Pmap;
|
||||||
|
|
||||||
|
return Pmap(std::make_pair(0,1));
|
||||||
|
}
|
||||||
|
|
||||||
SMesh::Property_map< boost::graph_traits<SMesh >::face_descriptor,int>
|
SMesh::Property_map< boost::graph_traits<SMesh >::face_descriptor,int>
|
||||||
inline get(CGAL::face_selection_t, SMesh& smesh)
|
inline get(CGAL::face_selection_t, SMesh& smesh)
|
||||||
|
|
@ -91,6 +99,15 @@ struct property_map<SMesh, CGAL::face_patch_id_t<I> >
|
||||||
typedef SMesh::Property_map<face_descriptor, I> type;
|
typedef SMesh::Property_map<face_descriptor, I> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct property_map<SMesh, CGAL::face_patch_id_t<void> >
|
||||||
|
{
|
||||||
|
|
||||||
|
typedef typename boost::graph_traits<SMesh>::face_descriptor face_descriptor;
|
||||||
|
|
||||||
|
typedef CGAL::static_property_map< boost::graph_traits<SMesh>::face_descriptor,std::pair<int,int> > type;
|
||||||
|
typedef type const_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,31 @@ namespace CGAL {
|
||||||
|
|
||||||
/// \cond SKIP_DOXYGEN
|
/// \cond SKIP_DOXYGEN
|
||||||
|
|
||||||
|
template <typename K, typename V>
|
||||||
|
class static_property_map
|
||||||
|
{
|
||||||
|
typedef K key_type;
|
||||||
|
typedef const V& value_type;
|
||||||
|
typedef const V& reference;
|
||||||
|
typedef boost::read_write_property_map_tag category;
|
||||||
|
V v;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static_property_map(V pv)
|
||||||
|
:v(pv){}
|
||||||
|
inline friend
|
||||||
|
value_type
|
||||||
|
get(const static_property_map& pm, const key_type&)
|
||||||
|
{
|
||||||
|
return pm.v;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline friend
|
||||||
|
void
|
||||||
|
put(static_property_map& pm, const key_type&, const value_type&)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename PM1, typename PM2>
|
template <typename PM1, typename PM2>
|
||||||
class OR_property_map {
|
class OR_property_map {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue