remove setup functions

get rid of set_mesh, set_metric, rebuild functions
This commit is contained in:
Lingjie Zhu 2018-07-16 16:07:44 +08:00
parent 8d2cd2c8fa
commit e1b5252f19
2 changed files with 3 additions and 60 deletions

View File

@ -313,59 +313,8 @@ public:
CGAL::internal::remove_property(m_fproxy_map, *(const_cast<TriangleMesh *>(m_ptm)));
}
}
/// \name Setup
/// @{
/*!
* @brief Sets the mesh for approximation and rebuilds the internal data structure.
* @pre @a tm.is_pure_triangle()
* @param tm `CGAL TriangleMesh` on which approximation operates.
* @param vpoint_map vertex point map of the mesh.
*/
void set_mesh(const TriangleMesh &tm, const VertexPointMap &vpoint_map) {
m_ptm = &tm;
m_vpoint_map = vpoint_map;
rebuild();
}
/*!
* @brief Sets the approximation traits.
* @param error_metric an `ErrorMetricProxy` object.
*/
void set_metric(const Error_metric &error_metric) {
m_metric = &error_metric;
}
/*!
* @brief Rebuilds the internal data structure.
*/
void rebuild() {
// cleanup
m_proxies.clear();
m_px_planes.clear();
m_anchors.clear();
m_bcycles.clear();
m_tris.clear();
if (!m_ptm)
return;
// rebuild internal data structure
CGAL::internal::remove_property(m_fproxy_map, *m_ptm);
m_fproxy_map = CGAL::internal::add_property(
Face_proxy_tag("VSA-face_proxy"), *(const_cast<TriangleMesh *>(m_ptm)));
BOOST_FOREACH(face_descriptor f, faces(*m_ptm))
put(m_fproxy_map, f, CGAL_VSA_INVALID_TAG);
CGAL::internal::remove_property(m_vanchor_map, *m_ptm);
m_vanchor_map = CGAL::internal::add_property(
Vertex_anchor_tag("VSA-vertex_anchor"), *(const_cast<TriangleMesh *>(m_ptm)));
BOOST_FOREACH(vertex_descriptor v, vertices(*m_ptm))
put(m_vanchor_map, v, CGAL_VSA_INVALID_TAG);
}
/// @}
/// \name Processing
/// \name Approximation
/// @{
/*!
* @brief Initializes the seeds with both maximum number of proxies

View File

@ -119,18 +119,12 @@ int main()
const FT drop(0.001);
const std::size_t iterations = 5;
std::cout << "rebuild and hierarchical seeding" << std::endl;
approx.rebuild();
if (approx.proxies_size() != 0)
return EXIT_FAILURE;
std::cout << "re-initialize and hierarchical seeding" << std::endl;
approx.initialize_seeds(CGAL::VSA::Hierarchical, boost::none, drop, iterations);
approx.run(10);
std::cout << "#proxies " << approx.proxies_size() << std::endl;
std::cout << "rebuild and incremental seeding" << std::endl;
approx.rebuild();
if (approx.proxies_size() != 0)
return EXIT_FAILURE;
std::cout << "re-initialize and incremental seeding" << std::endl;
approx.initialize_seeds(CGAL::VSA::Incremental, boost::none, drop, iterations);
approx.run(10);
std::cout << "#proxies " << approx.proxies_size() << std::endl;