Fix rebase

This commit is contained in:
Maxime Gimeno 2017-04-26 10:09:32 +02:00
parent ca23909bb1
commit 8b9eae7f44
9 changed files with 160 additions and 360 deletions

View File

@ -35,6 +35,8 @@
#include <set>
#include <CGAL/Polygon_mesh_processing/properties.h>
namespace CGAL {
namespace Mesh_3 {
@ -215,4 +217,117 @@ struct Mesh_polyhedron_3
typedef type Type;
};
template <typename Gt, typename Patch_id>
struct Patch_id_pmap {
typedef typename Mesh_polyhedron_3<Gt,Patch_id>::type Polyhedron;
typedef typename Polyhedron::Face_handle key_type;
typedef typename Polyhedron::Facet::Patch_id value_type;
typedef value_type reference;
typedef boost::writable_property_map_tag category;
friend Patch_id get(const Patch_id_pmap&, key_type h)
{
return h->patch_id();
}
friend void put(const Patch_id_pmap&, key_type h,
Patch_id pid)
{
h->set_patch_id(pid);
}
};
template <typename Gt, typename Patch_id>
inline Patch_id_pmap<Gt,Patch_id>
get(CGAL::face_patch_id_t,
const Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<Patch_id> >&)
{
return Patch_id_pmap<Gt,Patch_id>();
}
template <typename Gt, typename Patch_id>
struct vertex_num_feature_edges_pmap {
typedef typename Mesh_polyhedron_3<Gt,Patch_id>::type Polyhedron;
typedef typename Polyhedron::Vertex_handle key_type;
typedef int value_type;
friend int get(const vertex_num_feature_edges_pmap&, key_type h)
{
return h->nb_of_feature_edges;
}
friend void put(const vertex_num_feature_edges_pmap&, key_type h, int n)
{
h->nb_of_feature_edges = n;
}
};
template <typename Gt, typename Patch_id>
inline vertex_num_feature_edges_pmap<Gt,Patch_id>
get(vertex_num_feature_edges_t,
const Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<Patch_id> >&)
{
return vertex_num_feature_edges_pmap<Gt,Patch_id>();
}
template <typename Gt, typename Patch_id>
struct Is_feature_pmap {
typedef typename Mesh_polyhedron_3<Gt,Patch_id>::type Polyhedron;
typedef typename Polyhedron::Halfedge_handle key_type;
typedef bool value_type;
friend bool get(const Is_feature_pmap&, key_type h)
{
return h->is_feature_edge();
}
friend void put(const Is_feature_pmap&, key_type h, bool b)
{
h->set_feature_edge(b);
}
};
template <typename Gt, typename Patch_id>
inline Is_feature_pmap<Gt,Patch_id>
get(halfedge_is_feature_t,
const Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<Patch_id> >&)
{
return Is_feature_pmap<Gt,Patch_id> ();
}
} // end namespace CGAL
namespace boost {
template <typename Gt, typename Patch_id>
struct property_map<CGAL::Polyhedron_3<Gt, CGAL::Mesh_3::Mesh_polyhedron_items<Patch_id> >, CGAL::face_patch_id_t>
{
typedef CGAL::Patch_id_pmap<Gt,Patch_id> type;
};
template <typename Gt, typename Patch_id>
struct property_map<CGAL::Polyhedron_3<Gt, CGAL::Mesh_3::Mesh_polyhedron_items<Patch_id> >, CGAL::vertex_num_feature_edges_t>
{
typedef CGAL::vertex_num_feature_edges_pmap<Gt,Patch_id> type;
};
template <typename Gt, typename Patch_id>
struct property_map<CGAL::Polyhedron_3<Gt, CGAL::Mesh_3::Mesh_polyhedron_items<Patch_id> >, CGAL::halfedge_is_feature_t>
{
typedef CGAL::Is_feature_pmap<Gt,Patch_id> type;
};
} // namespace boost
#endif // CGAL_MESH_POLYHEDRON_3_H

View File

@ -40,7 +40,6 @@
#include <CGAL/Mesh_3/Detect_polylines_in_polyhedra.h>
#include <CGAL/Mesh_3/Polyline_with_context.h>
#include <CGAL/Polygon_mesh_processing/Detect_features_in_polyhedra.h>
#include <CGAL/boost/graph/PMP_properties_Polyhedron_3.h>
#include <CGAL/enum.h>
#include <CGAL/IO/Polyhedron_iostream.h>

View File

@ -51,9 +51,6 @@ if ( Boost_VERSION GREATER 103400 )
message(STATUS "warning: the plugin mesh_3_plugin requires Boost>=1.34.1 and will not be compiled.")
endif( Boost_VERSION GREATER 103400 )
polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin)
target_link_libraries(detect_sharp_edges_plugin scene_polyhedron_item)
qt5_wrap_ui( ribUI_FILES Rib_dialog.ui)
polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES})
target_link_libraries(c3t3_rib_exporter_plugin scene_c3t3_item)

View File

@ -17,7 +17,7 @@
#include <CGAL/Real_timer.h>
using namespace CGAL::Three;
typedef Tr::Point Point_3;
typedef Tr::Point Tr_Point_3;
typedef Kernel::Point_3 Bare_point_3;
Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
@ -221,9 +221,9 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage,
Image_mesh_domain* p_domain = new Image_mesh_domain(*pImage, 1e-6);
if(protect_features && polylines.empty()){
std::vector<std::vector<Point_3> > polylines_on_bbox;
std::vector<std::vector<Tr_Point_3> > polylines_on_bbox;
CGAL::polylines_to_protect<
Point_3,
Tr_Point_3,
Image_mesh_domain::Image_word_type>(*pImage, polylines_on_bbox);
p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
}
@ -250,8 +250,8 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage,
{
std::cerr << "Warning : Automatic detection of features"
<< " in Gray images is not implemented yet" << std::endl;
//std::vector<std::vector<Point_3> > polylines_on_bbox;
//CGAL::polylines_to_protect<Point_3>(*pImage, polylines_on_bbox);
//std::vector<std::vector<Tr_Point_3> > polylines_on_bbox;
//CGAL::polylines_to_protect<Tr_Point_3>(*pImage, polylines_on_bbox);
//p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
}
if(! polylines.empty()){

View File

@ -89,3 +89,6 @@ target_link_libraries(isotropic_remeshing_plugin scene_polyhedron_item scene_po
polyhedron_demo_plugin(distance_plugin Distance_plugin)
target_link_libraries(distance_plugin scene_polyhedron_item scene_color_ramp)
polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin)
target_link_libraries(detect_sharp_edges_plugin scene_polyhedron_item)

View File

@ -401,8 +401,8 @@ public Q_SLOTS:
Kernel::Point_3 > Edge_graph;
Edge_graph edge_graph;
std::map<vertex_descriptor, Edge_graph::vertex_descriptor> p2vd;
std::map<vertex_descriptor, Edge_graph::vertex_descriptor>::iterator it_find;
std::map<fg_vertex_descriptor, Edge_graph::vertex_descriptor> p2vd;
std::map<fg_vertex_descriptor, Edge_graph::vertex_descriptor>::iterator it_find;
bool insert_OK;
Face_graph * poly = selection_item->polyhedron();
@ -410,7 +410,7 @@ public Q_SLOTS:
for(Scene_polyhedron_selection_item::Selection_set_edge::iterator begin = selection_item->selected_edges.begin();
begin != selection_item->selected_edges.end(); ++begin)
{
vertex_descriptor source = target(opposite(halfedge(*begin,*poly),*poly),*poly);
fg_vertex_descriptor source = target(opposite(halfedge(*begin,*poly),*poly),*poly);
boost::tie(it_find, insert_OK)
= p2vd.insert(std::make_pair(source, Edge_graph::vertex_descriptor()));
if (insert_OK)
@ -420,7 +420,7 @@ public Q_SLOTS:
}
Edge_graph::vertex_descriptor src=it_find->second;
vertex_descriptor targ = target(halfedge(*begin,*poly),*poly);
fg_vertex_descriptor targ = target(halfedge(*begin,*poly),*poly);
boost::tie(it_find, insert_OK)
= p2vd.insert(std::make_pair(targ, Edge_graph::vertex_descriptor()));
if (insert_OK)
@ -499,7 +499,7 @@ public Q_SLOTS:
return;
}
const Face_graph& poly = *selection_item->polyhedron();
BOOST_FOREACH(Scene_polyhedron_selection_item::edge_descriptor ed, selection_item->selected_edges)
BOOST_FOREACH(Scene_polyhedron_selection_item::fg_edge_descriptor ed, selection_item->selected_edges)
{
selection_item->selected_facets.insert(face(halfedge(ed, poly), poly));
selection_item->selected_facets.insert(face(opposite(halfedge(ed, poly), poly), poly));
@ -522,7 +522,7 @@ public Q_SLOTS:
}
const Face_graph& poly = *selection_item->polyhedron();
BOOST_FOREACH(Scene_polyhedron_selection_item::edge_descriptor ed, selection_item->selected_edges)
BOOST_FOREACH(Scene_polyhedron_selection_item::fg_edge_descriptor ed, selection_item->selected_edges)
{
selection_item->selected_vertices.insert(target(halfedge(ed, poly), poly));
selection_item->selected_vertices.insert(source(halfedge(ed, poly), poly));
@ -544,9 +544,9 @@ public Q_SLOTS:
return;
}
const Face_graph& poly = *selection_item->polyhedron();
std::vector<Scene_polyhedron_selection_item::halfedge_descriptor> boundary_edges;
std::vector<Scene_polyhedron_selection_item::fg_halfedge_descriptor> boundary_edges;
CGAL::Polygon_mesh_processing::border_halfedges(selection_item->selected_facets, poly, std::back_inserter(boundary_edges));
BOOST_FOREACH(Scene_polyhedron_selection_item::halfedge_descriptor h, boundary_edges)
BOOST_FOREACH(Scene_polyhedron_selection_item::fg_halfedge_descriptor h, boundary_edges)
{
selection_item->selected_edges.insert(edge(h, poly));
}
@ -567,9 +567,9 @@ public Q_SLOTS:
return;
}
const Face_graph& poly = *selection_item->polyhedron();
BOOST_FOREACH(Scene_polyhedron_selection_item::face_descriptor fh, selection_item->selected_facets)
BOOST_FOREACH(Scene_polyhedron_selection_item::fg_face_descriptor fh, selection_item->selected_facets)
{
BOOST_FOREACH(Scene_polyhedron_selection_item::halfedge_descriptor h, CGAL::halfedges_around_face(halfedge(fh,poly), poly) )
BOOST_FOREACH(Scene_polyhedron_selection_item::fg_halfedge_descriptor h, CGAL::halfedges_around_face(halfedge(fh,poly), poly) )
{
selection_item->selected_vertices.insert(target(h, poly));
}

View File

@ -1,314 +0,0 @@
// Copyright (c) 2017 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 Lesser 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$
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_PMP_PROPERTIES_POLYHEDRON_3_H
#define CGAL_PMP_PROPERTIES_POLYHEDRON_3_H
#include <CGAL/license/Polyhedron.h>
#include <CGAL/Polygon_mesh_processing/properties.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
#define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS
namespace CGAL {
struct Polyhedron_face_time_stamp_pmap
{
typedef void key_type;
typedef std::size_t value_type;
typedef std::size_t reference;
typedef boost::read_write_property_map_tag category;
};
template <typename Handle_type>
std::size_t get(Polyhedron_face_time_stamp_pmap, Handle_type h)
{
return h->time_stamp();
}
template <typename Handle_type>
void put(Polyhedron_face_time_stamp_pmap, Handle_type h,
std::size_t ts)
{
h->set_time_stamp(ts);
}
template <>
struct Polyhedron_property_map<CGAL::vertex_time_stamp_t>
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef Polyhedron_face_time_stamp_pmap type;
typedef type const_type;
};
};
template <>
struct Polyhedron_property_map<CGAL::halfedge_time_stamp_t>
: public Polyhedron_property_map<CGAL::vertex_time_stamp_t>
{};
template <>
struct Polyhedron_property_map<CGAL::face_time_stamp_t>
: public Polyhedron_property_map<CGAL::vertex_time_stamp_t>
{};
template <typename Patch_id>
struct Polyhedron_face_patch_id_pmap {
typedef void key_type;
typedef Patch_id value_type;
typedef Patch_id reference;
typedef boost::read_write_property_map_tag category;
};
template <typename Patch_id, typename Handle_type>
Patch_id get(Polyhedron_face_patch_id_pmap<Patch_id>, Handle_type h)
{
return h->patch_id();
}
template <typename Patch_id, typename Handle_type>
void put(Polyhedron_face_patch_id_pmap<Patch_id>, Handle_type h,
Patch_id pid)
{
h->set_patch_id(pid);
}
template <typename Patch_id>
struct Polyhedron_property_map<CGAL::face_patch_id_t<Patch_id> >
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef Polyhedron_face_patch_id_pmap<Patch_id> type;
typedef type const_type;
};
};
namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_DEF(Plane_3)
template <class Gt, class I, CGAL_HDS_PARAM_, class A>
struct Get_static_property_map {
typedef boost::graph_traits<CGAL::Polyhedron_3<Gt,I,HDS,A> > Graph_traits;
typedef CGAL::static_property_map<typename Graph_traits::face_descriptor,
std::pair<int,int> > type;
};
} // end namespace internal
template <class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::lazy_enable_if<
internal::has_Plane_3<Gt>,
internal::Get_static_property_map<Gt, I, HDS, A>
>::type
get(CGAL::face_patch_id_t<void>, const Polyhedron_3<Gt,I,HDS,A>&)
{
typedef typename internal::Get_static_property_map<Gt, I, HDS, A>::type Pmap;
return Pmap( std::pair<int,int>(0,1) );
}
template <>
struct Polyhedron_property_map<CGAL::face_patch_id_t<void> >
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef typename internal::Get_static_property_map<Gt,I,HDS,A>::type type;
typedef type const_type;
};
};
struct Polyhedron_num_feature_edges_pmap {
typedef void key_type;
typedef int value_type;
typedef int reference;
typedef boost::read_write_property_map_tag category;
};
template <typename Handle_type>
int get(Polyhedron_num_feature_edges_pmap, Handle_type h)
{
return h->nb_of_feature_edges;
}
template <typename Handle_type>
void put(Polyhedron_num_feature_edges_pmap, Handle_type h, int n)
{
h->nb_of_feature_edges = n;
}
template <>
struct Polyhedron_property_map<CGAL::vertex_num_feature_edges_t>
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef Polyhedron_num_feature_edges_pmap type;
typedef type const_type;
};
};
struct Polyhedron_is_feature_edge_pmap {
typedef void key_type;
typedef bool value_type;
typedef bool reference;
typedef boost::read_write_property_map_tag category;
};
template <typename Handle_type>
bool get(Polyhedron_is_feature_edge_pmap, Handle_type h)
{
return h->is_feature_edge();
}
template <typename Handle_type>
void put(Polyhedron_is_feature_edge_pmap, Handle_type h, bool b)
{
h->set_feature_edge(b);
}
template <>
struct Polyhedron_property_map<CGAL::halfedge_is_feature_t>
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef Polyhedron_is_feature_edge_pmap type;
typedef type const_type;
};
};
// template <typename Gt, typename Patch_id>
// inline Is_feature_pmap<Gt,Patch_id>
// get(halfedge_is_feature_t,
// const Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<Patch_id> >&)
// {
// return Is_feature_pmap<Gt,Patch_id> ();
// }
template <typename Patch_id>
struct Polyhedron_incident_patches_pmap {
typedef void key_type;
typedef std::set<Patch_id> value_type;
typedef std::set<Patch_id>& reference;
typedef boost::read_write_property_map_tag category;
};
template <typename Patch_id, typename Handle_type>
std::set<Patch_id>& get(Polyhedron_incident_patches_pmap<Patch_id>,
Handle_type h)
{
return h->incident_patches_ids_set();
}
template <typename Patch_id, typename Handle_type>
void put(Polyhedron_incident_patches_pmap<Patch_id>,
Handle_type h, const std::set<Patch_id>& v)
{
BOOST_FOREACH(Patch_id n, v)
h->add_incident_patch(n);
}
template <typename Patch_id>
struct Polyhedron_property_map<CGAL::vertex_incident_patches_t<Patch_id> >
{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct bind_
{
typedef Polyhedron_incident_patches_pmap<Patch_id> type;
typedef type const_type;
};
};
// template <typename Gt, typename Patch_id>
// inline vertex_incident_patches_pmap<Gt,Patch_id>
// get(CGAL::vertex_incident_patches_t<Patch_id>,
// const Polyhedron_3<Gt, Mesh_3::Mesh_polyhedron_items<Patch_id> >&)
// {
// return vertex_incident_patches_pmap<Gt,Patch_id>();
// }
} // end namespace CGAL
namespace boost {
// template <class Gt, class I, CGAL_HDS_PARAM_, class A>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::vertex_time_stamp_t>
// {
// typedef CGAL::Polyhedron_face_time_stamp_pmap type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::halfedge_time_stamp_t>
// {
// typedef CGAL::Polyhedron_face_time_stamp_pmap type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::face_time_stamp_t>
// {
// typedef CGAL::Polyhedron_face_time_stamp_pmap type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A, typename Patch_id>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::face_patch_id_t<Patch_id> >
// {
// typedef CGAL::Polyhedron_face_patch_id_pmap<Patch_id> type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::vertex_num_feature_edges_t>
// {
// typedef CGAL::Polyhedron_num_feature_edges_pmap type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::halfedge_is_feature_t>
// {
// typedef CGAL::Polyhedron_is_feature_edge_pmap type;
// };
// template <class Gt, class I, CGAL_HDS_PARAM_, class A, typename Patch_id>
// struct property_map<CGAL::Polyhedron_3<Gt,I,HDS,A>,
// CGAL::vertex_incident_patches_t<Patch_id> >
// {
// typedef CGAL::Polyhedron_incident_patches_pmap<Patch_id> type;
// };
} // namespace boost
#undef CGAL_HDS_PARAM_
#endif // CGAL_PMP_PROPERTIES_POLYHEDRON_3_H

View File

@ -184,7 +184,7 @@ void put(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key, const
put(pmap, key, value);
}
} // boost
} // CGAL
// specialization needs to be repeated for halfedge, vertex, face
#define CGAL_POLYHEDRON_INDEX_PM(ENTITY, TAG, ACCESSOR) \
@ -199,7 +199,7 @@ void put(PropertyTag p, CGAL::Polyhedron_3<Gt,I,HDS,A>& g, const Key& key, const
typedef type const_type; \
}; \
}; \
}
} //CGAL
CGAL_POLYHEDRON_INDEX_PM(halfedge, _index_t, Index)
CGAL_POLYHEDRON_INDEX_PM(vertex, _index_t, Index)