vertex point map must be default constructible

This commit is contained in:
Sébastien Loriot 2016-09-27 17:32:12 +02:00
parent 6488a8a172
commit 5de5315ef5
3 changed files with 58 additions and 27 deletions

View File

@ -26,38 +26,64 @@ struct Coref_point_map
typedef boost::property_traits<Exact_point_map>::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<K, EK> to_exact;
CGAL::Cartesian_converter<EK, K> 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";

View File

@ -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<TriangleMesh,
NamedParameters2>::const_type Vpm2;
CGAL_assertion_code(static const bool same_vpm = )
boost::is_same<Vpm,Vpm2>::value;
CGAL_assertion_code(
static const bool same_vpm = (boost::is_same<Vpm,Vpm2>::value);)
CGAL_static_assertion(same_vpm);
Vpm vpm1 = choose_pmap(get_param(np1, boost::vertex_point),

View File

@ -116,7 +116,7 @@ struct Ecm_bind<G, No_mark<G>, No_mark<G> >
Ecm_bind(G&, G&, const No_mark<G>&, const No_mark<G>&){}
typedef typename boost::graph_traits<G>::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<halfedge_descriptor,int>::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<std::pair<Node_id,Node_id> > already_done;
Node_to_target_of_hedge_map& nodes_to_hedge=it->second;