fix split test

This commit is contained in:
Lingjie Zhu 2017-08-22 00:22:28 +08:00
parent 47fdf5e3e3
commit cbcac2c8d8
2 changed files with 35 additions and 17 deletions

View File

@ -518,7 +518,8 @@ public:
} }
/*! /*!
* @brief Merge two specified adjacent regions, the re-fitting is performed. * @brief Merge two specified adjacent regions.
* The overall re-fitting is not performed and the proxy map is maintained.
* @pre two proxies must be adjacent and px_enlarged < px_merged * @pre two proxies must be adjacent and px_enlarged < px_merged
* @param px_enlarged the enlarged proxy * @param px_enlarged the enlarged proxy
* @param px_merged the merged proxy * @param px_merged the merged proxy
@ -617,26 +618,32 @@ public:
} }
/*! /*!
* @brief Merge adjacent regions, the re-fitting is performed. * @brief Split one proxy by default bisection, but N-section is also possible
* @param range_of_proxies range of proxies, must be adjacent * No re-fitting performed and the proxy map is maintained.
* @param px proxy index
* @param n split section
* @return change of error * @return change of error
*/ */
// FT merge(range_of_proxies) {} FT split(const std::size_t px, const std::size_t n = 2) {
// Document what happens when the model has only one proxy,. if (px >= proxies.size())
return FT(0);
/*! std::size_t count = 1;
* @brief Split one proxy by default bisection, but N-section is also possible. FT err(0);
* @param p proxy BOOST_FOREACH(face_descriptor f, faces(*m_pmesh)) {
* @return change of error if (count >= n)
*/ break;
// FT split(Proxy &p, int n = 2) {}
/*! if (seg_pmap[f] == px && f != proxies[px].seed) {
* @brief Split range of proxies by default bisection, but N-section is also possible. err += (*fit_error)(f, proxies[px]);
* @param range_of_proxies range of proxies seg_pmap[f] = proxies.size();
* @return change of error proxies.push_back(fit_new_proxy(f));
*/ ++count;
// FT split(range_of_proxies, int n = 2) {} }
}
return err;
}
/*! /*!
* @brief Meshing, choose the default area weighted or the PCA plane fitting. * @brief Meshing, choose the default area weighted or the PCA plane fitting.

View File

@ -78,9 +78,20 @@ int main()
// merge and teleport the proxies from local minimal // merge and teleport the proxies from local minimal
std::cout << "teleport" << std::endl; std::cout << "teleport" << std::endl;
l2_approx.teleport_proxies(3, false); l2_approx.teleport_proxies(3, false);
for (std::size_t i = 0; i < 10; ++i)
l2_approx.run_one_step();
if (l2_approx.get_proxies_size() != 16) if (l2_approx.get_proxies_size() != 16)
return EXIT_FAILURE; return EXIT_FAILURE;
// split proxy 0 into 2 proxies
// precondition: proxy 0 should have more than 2 facets
std::cout << "spliting" << std::endl;
l2_approx.split(0);
for (std::size_t i = 0; i < 10; ++i)
l2_approx.run_one_step();
if (l2_approx.get_proxies_size() != 17)
return EXIT_FAILURE;
// extract the approximation polyhedron // extract the approximation polyhedron
std::cout << "meshing" << std::endl; std::cout << "meshing" << std::endl;
Polyhedron_3 out_mesh; Polyhedron_3 out_mesh;