map_type change to state_type

This commit is contained in:
Baskin Senbaslar 2019-07-13 12:37:38 +03:00 committed by Mael Rouxel-Labbé
parent b3595ecf6e
commit a662c97f00
7 changed files with 23 additions and 25 deletions

View File

@ -45,16 +45,15 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_map_type map;
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(map);
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_state_type state;
int r = SMS::edge_collapse(surface_mesh,
CGAL::Surface_mesh_simplification::GarlandHeckbert_cost_stop_predicate<double>(threshold),
CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
.halfedge_index_map(get(CGAL::halfedge_external_index ,surface_mesh))
.get_cost(SMS::GarlandHeckbert_cost <Surface_mesh>(map))
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(map))
.visitor(vis));
.get_cost(SMS::GarlandHeckbert_cost <Surface_mesh>(state))
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(state))
.visitor(SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>(state)));
std::cout << "\nFinished...\n" << r << " edges removed.\n"
<< (surface_mesh.size_of_halfedges()/2) << " final edges.\n";

View File

@ -42,8 +42,7 @@ int main(int argc, char** argv)
// left in the surface mesh drops below the specified number (1000)
SMS::Count_stop_predicate<Surface_mesh> stop(1000);
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_map_type map;
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(map);
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_state_type state;
// This the actual call to the simplification algorithm.
// The surface mesh and stop conditions are mandatory arguments.
@ -54,9 +53,9 @@ int main(int argc, char** argv)
,stop
,CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
.halfedge_index_map (get(CGAL::halfedge_external_index, surface_mesh))
.get_cost(SMS::GarlandHeckbert_cost<Surface_mesh>(map))
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(map))
.visitor(vis)
.get_cost(SMS::GarlandHeckbert_cost<Surface_mesh>(state))
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(state))
.visitor(SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>(state))
);
std::chrono::steady_clock::time_point end_time
= std::chrono::steady_clock::now();

View File

@ -108,21 +108,21 @@ int main(int argc, char** argv)
std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_map_type map;
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>::garland_heckbert_state_type state;
// stop
SMS::Count_ratio_stop_predicate<Surface_mesh> stop(stop_ratio);
// SMS::GarlandHeckbert_cost_stop_predicate<double> stop(stop_ratio);
// cost
SMS::GarlandHeckbert_cost<Surface_mesh> cost(map);
SMS::GarlandHeckbert_cost<Surface_mesh> cost(state);
// placement
SMS::GarlandHeckbert_placement<Surface_mesh> gh_placement(map);
SMS::GarlandHeckbert_placement<Surface_mesh> gh_placement(state);
SMS::Bounded_normal_change_placement<SMS::GarlandHeckbert_placement<Surface_mesh> > placement(gh_placement);
// visitor
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(map);
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(state);
int r = SMS::edge_collapse(surface_mesh, stop,
CGAL::parameters::get_cost(cost)

View File

@ -25,14 +25,14 @@ struct GarlandHeckbert_edge_collapse_visitor_base : Edge_collapse_visitor_base<T
typedef typename Edge_collapse_visitor_base<TM>::Kernel Kernel;
typedef typename internal::GarlandHeckbertCore<TM>::Matrix4x4 Matrix4x4;
typedef typename internal::GarlandHeckbertCore<TM>::garland_heckbert_map_type garland_heckbert_map_type;
typedef typename internal::GarlandHeckbertCore<TM>::garland_heckbert_state_type garland_heckbert_state_type;
typedef typename internal::GarlandHeckbertCore<TM>::FT FT;
garland_heckbert_map_type& mCostMatrices;
garland_heckbert_state_type& mCostMatrices;
FT mDiscontinuityMultiplier;
GarlandHeckbert_edge_collapse_visitor_base(
garland_heckbert_map_type& aCostMatrices, FT aDiscontinuityMultiplier = 100.0)
garland_heckbert_state_type& aCostMatrices, FT aDiscontinuityMultiplier = 100.0)
:
mCostMatrices(aCostMatrices),
mDiscontinuityMultiplier(aDiscontinuityMultiplier) {

View File

@ -18,7 +18,7 @@ public:
typedef typename internal::GarlandHeckbertCore<TM> GHC;
typedef typename GHC::garland_heckbert_map_type garland_heckbert_map_type;
typedef typename GHC::garland_heckbert_state_type garland_heckbert_state_type;
typedef typename GHC::Matrix4x4 Matrix4x4;
typedef typename GHC::Row4 Row4;
typedef typename GHC::Col4 Col4;
@ -26,7 +26,7 @@ public:
typedef typename boost::optional<FT> Optional_FT;
GarlandHeckbert_cost(const garland_heckbert_map_type& aCostMatrices)
GarlandHeckbert_cost(const garland_heckbert_state_type& aCostMatrices)
: mCostMatrices(aCostMatrices) {
}
@ -51,7 +51,7 @@ public:
}
private:
const garland_heckbert_map_type& mCostMatrices;
const garland_heckbert_state_type& mCostMatrices;
};
} // namespace Surface_mesh_simplification

View File

@ -20,7 +20,7 @@ public:
typedef typename internal::GarlandHeckbertCore<TM> GHC;
typedef typename GHC::garland_heckbert_map_type garland_heckbert_map_type;
typedef typename GHC::garland_heckbert_state_type garland_heckbert_state_type;
typedef typename GHC::Matrix4x4 Matrix4x4;
typedef typename GHC::Row4 Row4;
typedef typename GHC::Col4 Col4;
@ -28,7 +28,7 @@ public:
typedef typename boost::optional<FT> Optional_FT;
GarlandHeckbert_placement(const garland_heckbert_map_type& aCostMatrices)
GarlandHeckbert_placement(const garland_heckbert_state_type& aCostMatrices)
: mCostMatrices(aCostMatrices)
{}
@ -53,7 +53,7 @@ public:
}
private:
const garland_heckbert_map_type& mCostMatrices;
const garland_heckbert_state_type& mCostMatrices;
};
} // namespace Surface_mesh_simplification
} // namespace CGAL

View File

@ -41,7 +41,7 @@ struct GarlandHeckbertCore
typedef typename Eigen::Matrix<FT, 4, 1> Col4;
typedef std::unordered_map<vertex_descriptor, Matrix4x4> garland_heckbert_map_type;
typedef std::unordered_map<vertex_descriptor, Matrix4x4> garland_heckbert_state_type;
static Col4 point_to_homogenous_column(const Point& pt) {