diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp index 7f42c5427da..2379fa81890 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp @@ -26,38 +26,64 @@ struct Coref_point_map typedef boost::property_traits::key_type key_type; // exterior references - Exact_point_computed& exact_point_computed; - Exact_point_map& exact_point; - Mesh& mesh; + Exact_point_computed* exact_point_computed_ptr; + Exact_point_map* exact_point_ptr; + Mesh* mesh_ptr; + + Exact_point_computed& exact_point_computed() const + { + CGAL_assertion(exact_point_computed_ptr!=NULL); + return *exact_point_computed_ptr; + } + + Exact_point_map& exact_point() const + { + CGAL_assertion(exact_point_ptr!=NULL); + return *exact_point_ptr; + } + + Mesh& mesh() const + { + CGAL_assertion(mesh_ptr!=NULL); + return *mesh_ptr; + } // Converters CGAL::Cartesian_converter to_exact; CGAL::Cartesian_converter to_input; + Coref_point_map() + : exact_point_computed_ptr(NULL) + , exact_point_ptr(NULL) + , mesh_ptr(NULL) + {} + Coref_point_map(Exact_point_map& ep, Exact_point_computed& epc, Mesh& m) - :exact_point_computed(epc), exact_point(ep), mesh(m) + : exact_point_computed_ptr(&epc) + , exact_point_ptr(&ep) + , mesh_ptr(&m) {} friend reference get(const Coref_point_map& map, key_type k) { // create exact point if it does not exist - if (!map.exact_point_computed[k]){ - map.exact_point[k]=map.to_exact(map.mesh.point(k)); - map.exact_point_computed[k]=true; + if (!map.exact_point_computed()[k]){ + map.exact_point()[k]=map.to_exact(map.mesh().point(k)); + map.exact_point_computed()[k]=true; } - return map.exact_point[k]; + return map.exact_point()[k]; } friend void put(const Coref_point_map& map, key_type k, const EK::Point_3& p) { - map.exact_point_computed[k]=true; - map.exact_point[k]=p; + map.exact_point_computed()[k]=true; + map.exact_point()[k]=p; // create the input point from the exact one - map.mesh.point(k)=map.to_input(p); + map.mesh().point(k)=map.to_input(p); } }; @@ -99,12 +125,15 @@ int main(int argc, char* argv[]) if ( PMP::intersection(mesh1, mesh2, mesh1, + params::vertex_point_map(mesh1_maps), + params::vertex_point_map(mesh2_maps), params::vertex_point_map(mesh1_maps) ) ) { if ( PMP::join(mesh1, mesh2, mesh2, params::vertex_point_map(mesh1_maps), + params::vertex_point_map(mesh2_maps), params::vertex_point_map(mesh2_maps) ) ) { std::cout << "Intersection and union were successfully computed\n"; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index a85f83bbdaa..d1ec791fc1a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -228,7 +228,7 @@ boolean_operation(const TriangleMesh& const_tm1, * @param np2 optional sequence of \ref namedparameters among the ones listed below * * \cgalNamedParamsBegin - * \cgalParamBegin{vertex_point_map} a property map with the points associated to the vertices of `tm1` (`tm2`) \cgalParamEnd + * \cgalParamBegin{vertex_point_map} a default constructible property map with the points associated to the vertices of `tm1` (`tm2`) \cgalParamEnd * \cgalParamBegin{edge_is_constrained_map} a property map containing the * constrained-or-not status of each edge of `tm1` (`tm2`). * \cgalParamBegin{face_index_map} a property map containing the index of each face of `tm1` (`tm2`) \cgalParamEnd @@ -237,7 +237,7 @@ boolean_operation(const TriangleMesh& const_tm1, * @param np_out optional sequence of \ref namedparameters among the ones listed below * * \cgalNamedParamsBegin - * \cgalParamBegin{vertex_point_map} a property map with the points associated to the vertices of `tm_out` \cgalParamEnd + * \cgalParamBegin{vertex_point_map} a default constructible property map with the points associated to the vertices of `tm_out` \cgalParamEnd * \cgalParamBegin{edge_is_constrained_map} a property map containing the * constrained-or-not status of each edge of `tm_out`. An edge of `tm_out` is constrained * if it is on the intersection of `tm1` and `tm2`, or if the edge corresponds to a @@ -268,9 +268,10 @@ join(const TriangleMesh& tm1, return boolean_operation(tm1, tm2, desired_output, np1, np2, cpp11::make_tuple(np_out, - all_default(), - all_default(), - all_default()))[Corefinement::JOIN]; + no_parameters(np_out), + no_parameters(np_out), + no_parameters(np_out))) + [Corefinement::JOIN]; } /** @@ -297,10 +298,11 @@ intersection(const TriangleMesh& tm1, return boolean_operation(tm1, tm2, desired_output, np1, np2, - cpp11::make_tuple(all_default(), + cpp11::make_tuple(no_parameters(np_out), np_out, - all_default(), - all_default()))[Corefinement::INTER]; + no_parameters(np_out), + no_parameters(np_out))) + [Corefinement::INTER]; } /** @@ -328,10 +330,10 @@ difference(const TriangleMesh& tm1, return boolean_operation(tm1, tm2, desired_output, np1, np2, - cpp11::make_tuple(all_default(), - all_default(), + cpp11::make_tuple(no_parameters(np_out), + no_parameters(np_out), np_out, - all_default()))[TM1_MINUS_TM2]; + no_parameters(np_out)))[TM1_MINUS_TM2]; } /** @@ -378,8 +380,8 @@ difference(const TriangleMesh& tm1, NamedParameters1>::const_type Vpm; typedef typename GetVertexPointMap::const_type Vpm2; - CGAL_assertion_code(static const bool same_vpm = ) - boost::is_same::value; + CGAL_assertion_code( + static const bool same_vpm = (boost::is_same::value);) CGAL_static_assertion(same_vpm); Vpm vpm1 = choose_pmap(get_param(np1, boost::vertex_point), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h index 19a60a408f4..11e272917e1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h @@ -116,7 +116,7 @@ struct Ecm_bind, No_mark > Ecm_bind(G&, G&, const No_mark&, const No_mark&){} typedef typename boost::graph_traits::edge_descriptor edge_descriptor; void put(G&, edge_descriptor, bool) const {} - bool get(G& g, edge_descriptor e) const { + bool get(G&, edge_descriptor) const { return false; } }; @@ -452,7 +452,7 @@ public: //used when object was created with hedge but opposite was used to split the original face void update_original_halfedge(halfedge_descriptor original, halfedge_descriptor new_hedge, - TriangleMesh& tm) + TriangleMesh& /*tm*/) { typename std::map::iterator it_id = hedges_ids.find(original); @@ -602,7 +602,7 @@ public: { TriangleMesh& tm=*it->first; Intersection_edge_map& intersection_edges = mesh_to_intersection_edges[&tm]; - Face_boundaries& face_boundaries=mesh_to_face_boundaries[&tm]; + // Face_boundaries& face_boundaries=mesh_to_face_boundaries[&tm]; std::set > already_done; Node_to_target_of_hedge_map& nodes_to_hedge=it->second;