mirror of https://github.com/CGAL/cgal
partition candidate with constructor
This commit is contained in:
parent
6556f504a2
commit
9cef351b45
|
|
@ -59,24 +59,30 @@ class VSA_approximation {
|
||||||
|
|
||||||
// The facet candidate to be queued.
|
// The facet candidate to be queued.
|
||||||
struct FacetToIntegrate {
|
struct FacetToIntegrate {
|
||||||
face_descriptor f; // facet
|
FacetToIntegrate(const face_descriptor &_f, const std::size_t &_px, const FT &_err)
|
||||||
std::size_t px; // proxy index
|
: f(_f), px(_px), err(_err) {}
|
||||||
FT err; // fitting error
|
|
||||||
bool operator<(const FacetToIntegrate &rhs) const {
|
bool operator<(const FacetToIntegrate &rhs) const {
|
||||||
return err > rhs.err;
|
return err > rhs.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
face_descriptor f; // facet
|
||||||
|
std::size_t px; // proxy index
|
||||||
|
FT err; // fitting error
|
||||||
};
|
};
|
||||||
|
|
||||||
// proxy error with proxy index
|
// Proxy error with its index.
|
||||||
struct ProxyError {
|
struct ProxyError {
|
||||||
ProxyError(const std::size_t &_px, const FT &_error)
|
ProxyError(const std::size_t &_px, const FT &_err)
|
||||||
: px(_px), error(_error) {}
|
: px(_px), err(_err) {}
|
||||||
|
|
||||||
// in ascending order
|
// in ascending order
|
||||||
bool operator<(const ProxyError &rhs) const {
|
bool operator<(const ProxyError &rhs) const {
|
||||||
return error < rhs.error;
|
return err < rhs.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t px;
|
std::size_t px;
|
||||||
FT error;
|
FT err;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The average positioned anchor attached to a vertex.
|
// The average positioned anchor attached to a vertex.
|
||||||
|
|
@ -357,11 +363,8 @@ public:
|
||||||
BOOST_FOREACH(face_descriptor fadj, faces_around_face(halfedge(f, *m_pmesh), *m_pmesh)) {
|
BOOST_FOREACH(face_descriptor fadj, faces_around_face(halfedge(f, *m_pmesh), *m_pmesh)) {
|
||||||
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
||||||
&& seg_pmap[fadj] == CGAL_NOT_TAGGED_ID) {
|
&& seg_pmap[fadj] == CGAL_NOT_TAGGED_ID) {
|
||||||
FacetToIntegrate cand;
|
facet_pqueue.push(FacetToIntegrate(
|
||||||
cand.f = fadj;
|
fadj, i, (*fit_error)(fadj, proxies[i])));
|
||||||
cand.err = (*fit_error)(fadj, proxies[i]);
|
|
||||||
cand.px = i;
|
|
||||||
facet_pqueue.push(cand);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -374,11 +377,8 @@ public:
|
||||||
BOOST_FOREACH(face_descriptor fadj, faces_around_face(halfedge(c.f, *m_pmesh), *m_pmesh)) {
|
BOOST_FOREACH(face_descriptor fadj, faces_around_face(halfedge(c.f, *m_pmesh), *m_pmesh)) {
|
||||||
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
||||||
&& seg_pmap[fadj] == CGAL_NOT_TAGGED_ID) {
|
&& seg_pmap[fadj] == CGAL_NOT_TAGGED_ID) {
|
||||||
FacetToIntegrate cand;
|
facet_pqueue.push(FacetToIntegrate(
|
||||||
cand.f = fadj;
|
fadj, c.px, (*fit_error)(fadj, proxies[c.px])));
|
||||||
cand.err = (*fit_error)(fadj, proxies[c.px]);
|
|
||||||
cand.px = c.px;
|
|
||||||
facet_pqueue.push(cand);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -876,7 +876,7 @@ private:
|
||||||
BOOST_FOREACH(const ProxyError &pxe, px_error) {
|
BOOST_FOREACH(const ProxyError &pxe, px_error) {
|
||||||
// add error residual from previous proxy
|
// add error residual from previous proxy
|
||||||
// to_add maybe negative but greater than -0.5
|
// to_add maybe negative but greater than -0.5
|
||||||
FT to_add = (residual + pxe.error) / avg_error;
|
FT to_add = (residual + pxe.err) / avg_error;
|
||||||
// floor_to_add maybe negative but no less than -1
|
// floor_to_add maybe negative but no less than -1
|
||||||
FT floor_to_add = FT(std::floor(CGAL::to_double(to_add)));
|
FT floor_to_add = FT(std::floor(CGAL::to_double(to_add)));
|
||||||
const std::size_t q_to_add = static_cast<std::size_t>(CGAL::to_double(
|
const std::size_t q_to_add = static_cast<std::size_t>(CGAL::to_double(
|
||||||
|
|
@ -886,7 +886,7 @@ private:
|
||||||
}
|
}
|
||||||
for (std::size_t i = 0; i < px_error.size(); ++i)
|
for (std::size_t i = 0; i < px_error.size(); ++i)
|
||||||
std::cout << "#px " << px_error[i].px
|
std::cout << "#px " << px_error[i].px
|
||||||
<< ", #error " << px_error[i].error
|
<< ", #error " << px_error[i].err
|
||||||
<< ", #num_to_add " << num_to_add[px_error[i].px] << std::endl;
|
<< ", #num_to_add " << num_to_add[px_error[i].px] << std::endl;
|
||||||
|
|
||||||
std::size_t num_inserted = 0;
|
std::size_t num_inserted = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue