mirror of https://github.com/CGAL/cgal
map_type change to state_type
This commit is contained in:
parent
b3595ecf6e
commit
a662c97f00
|
|
@ -45,16 +45,15 @@ int main(int argc, char** argv)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(map);
|
|
||||||
|
|
||||||
int r = SMS::edge_collapse(surface_mesh,
|
int r = SMS::edge_collapse(surface_mesh,
|
||||||
CGAL::Surface_mesh_simplification::GarlandHeckbert_cost_stop_predicate<double>(threshold),
|
CGAL::Surface_mesh_simplification::GarlandHeckbert_cost_stop_predicate<double>(threshold),
|
||||||
CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
|
CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
|
||||||
.halfedge_index_map(get(CGAL::halfedge_external_index ,surface_mesh))
|
.halfedge_index_map(get(CGAL::halfedge_external_index ,surface_mesh))
|
||||||
.get_cost(SMS::GarlandHeckbert_cost <Surface_mesh>(map))
|
.get_cost(SMS::GarlandHeckbert_cost <Surface_mesh>(state))
|
||||||
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(map))
|
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(state))
|
||||||
.visitor(vis));
|
.visitor(SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>(state)));
|
||||||
|
|
||||||
std::cout << "\nFinished...\n" << r << " edges removed.\n"
|
std::cout << "\nFinished...\n" << r << " edges removed.\n"
|
||||||
<< (surface_mesh.size_of_halfedges()/2) << " final edges.\n";
|
<< (surface_mesh.size_of_halfedges()/2) << " final edges.\n";
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ int main(int argc, char** argv)
|
||||||
// left in the surface mesh drops below the specified number (1000)
|
// left in the surface mesh drops below the specified number (1000)
|
||||||
SMS::Count_stop_predicate<Surface_mesh> stop(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>::garland_heckbert_state_type state;
|
||||||
SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh> vis(map);
|
|
||||||
|
|
||||||
// This the actual call to the simplification algorithm.
|
// This the actual call to the simplification algorithm.
|
||||||
// The surface mesh and stop conditions are mandatory arguments.
|
// The surface mesh and stop conditions are mandatory arguments.
|
||||||
|
|
@ -54,9 +53,9 @@ int main(int argc, char** argv)
|
||||||
,stop
|
,stop
|
||||||
,CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
|
,CGAL::parameters::vertex_index_map(get(CGAL::vertex_external_index, surface_mesh))
|
||||||
.halfedge_index_map (get(CGAL::halfedge_external_index, surface_mesh))
|
.halfedge_index_map (get(CGAL::halfedge_external_index, surface_mesh))
|
||||||
.get_cost(SMS::GarlandHeckbert_cost<Surface_mesh>(map))
|
.get_cost(SMS::GarlandHeckbert_cost<Surface_mesh>(state))
|
||||||
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(map))
|
.get_placement(SMS::GarlandHeckbert_placement<Surface_mesh>(state))
|
||||||
.visitor(vis)
|
.visitor(SMS::GarlandHeckbert_edge_collapse_visitor_base<Surface_mesh>(state))
|
||||||
);
|
);
|
||||||
std::chrono::steady_clock::time_point end_time
|
std::chrono::steady_clock::time_point end_time
|
||||||
= std::chrono::steady_clock::now();
|
= std::chrono::steady_clock::now();
|
||||||
|
|
|
||||||
|
|
@ -108,21 +108,21 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
|
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
|
// stop
|
||||||
SMS::Count_ratio_stop_predicate<Surface_mesh> stop(stop_ratio);
|
SMS::Count_ratio_stop_predicate<Surface_mesh> stop(stop_ratio);
|
||||||
// SMS::GarlandHeckbert_cost_stop_predicate<double> stop(stop_ratio);
|
// SMS::GarlandHeckbert_cost_stop_predicate<double> stop(stop_ratio);
|
||||||
|
|
||||||
// cost
|
// cost
|
||||||
SMS::GarlandHeckbert_cost<Surface_mesh> cost(map);
|
SMS::GarlandHeckbert_cost<Surface_mesh> cost(state);
|
||||||
|
|
||||||
// placement
|
// 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);
|
SMS::Bounded_normal_change_placement<SMS::GarlandHeckbert_placement<Surface_mesh> > placement(gh_placement);
|
||||||
|
|
||||||
// visitor
|
// 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,
|
int r = SMS::edge_collapse(surface_mesh, stop,
|
||||||
CGAL::parameters::get_cost(cost)
|
CGAL::parameters::get_cost(cost)
|
||||||
|
|
|
||||||
|
|
@ -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 Edge_collapse_visitor_base<TM>::Kernel Kernel;
|
||||||
|
|
||||||
typedef typename internal::GarlandHeckbertCore<TM>::Matrix4x4 Matrix4x4;
|
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;
|
typedef typename internal::GarlandHeckbertCore<TM>::FT FT;
|
||||||
|
|
||||||
garland_heckbert_map_type& mCostMatrices;
|
garland_heckbert_state_type& mCostMatrices;
|
||||||
FT mDiscontinuityMultiplier;
|
FT mDiscontinuityMultiplier;
|
||||||
|
|
||||||
GarlandHeckbert_edge_collapse_visitor_base(
|
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),
|
mCostMatrices(aCostMatrices),
|
||||||
mDiscontinuityMultiplier(aDiscontinuityMultiplier) {
|
mDiscontinuityMultiplier(aDiscontinuityMultiplier) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
typedef typename internal::GarlandHeckbertCore<TM> GHC;
|
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::Matrix4x4 Matrix4x4;
|
||||||
typedef typename GHC::Row4 Row4;
|
typedef typename GHC::Row4 Row4;
|
||||||
typedef typename GHC::Col4 Col4;
|
typedef typename GHC::Col4 Col4;
|
||||||
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
typedef typename boost::optional<FT> Optional_FT;
|
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) {
|
: mCostMatrices(aCostMatrices) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const garland_heckbert_map_type& mCostMatrices;
|
const garland_heckbert_state_type& mCostMatrices;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Surface_mesh_simplification
|
} // namespace Surface_mesh_simplification
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
typedef typename internal::GarlandHeckbertCore<TM> GHC;
|
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::Matrix4x4 Matrix4x4;
|
||||||
typedef typename GHC::Row4 Row4;
|
typedef typename GHC::Row4 Row4;
|
||||||
typedef typename GHC::Col4 Col4;
|
typedef typename GHC::Col4 Col4;
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
typedef typename boost::optional<FT> Optional_FT;
|
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)
|
: mCostMatrices(aCostMatrices)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const garland_heckbert_map_type& mCostMatrices;
|
const garland_heckbert_state_type& mCostMatrices;
|
||||||
};
|
};
|
||||||
} // namespace Surface_mesh_simplification
|
} // namespace Surface_mesh_simplification
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ struct GarlandHeckbertCore
|
||||||
typedef typename Eigen::Matrix<FT, 4, 1> Col4;
|
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) {
|
static Col4 point_to_homogenous_column(const Point& pt) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue