mirror of https://github.com/CGAL/cgal
update signature to be consistent
This commit is contained in:
parent
ad964de61d
commit
c9d4ab26df
|
|
@ -26,7 +26,7 @@ public:
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// Computes and returns fitting error from face f to proxy.
|
/// Computes and returns fitting error from face f to proxy.
|
||||||
FT compute_error(const TriangleMesh &tm, const face_descriptor f, const Proxy &proxy) const;
|
FT compute_error(const face_descriptor f, const TriangleMesh &tm, const Proxy &proxy) const;
|
||||||
|
|
||||||
/// Computes and returns fitted proxy from a range of faces.
|
/// Computes and returns fitted proxy from a range of faces.
|
||||||
/// @tparam FaceRange a range of
|
/// @tparam FaceRange a range of
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ struct Compact_metric_point_proxy
|
||||||
// compute and return error from a face to a proxy,
|
// compute and return error from a face to a proxy,
|
||||||
// defined as the Euclidean distance between
|
// defined as the Euclidean distance between
|
||||||
// the face center of mass and proxy point.
|
// the face center of mass and proxy point.
|
||||||
FT compute_error(const Polyhedron &tm, const Facet_handle &f, const Proxy &px) const {
|
FT compute_error(const Facet_handle &f, const Polyhedron &tm, const Proxy &px) const {
|
||||||
(void)(tm);
|
(void)(tm);
|
||||||
return FT(std::sqrt(CGAL::to_double(
|
return FT(std::sqrt(CGAL::to_double(
|
||||||
CGAL::squared_distance(center_pmap[f], px))));
|
CGAL::squared_distance(center_pmap[f], px))));
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
m_sum_functor = traits.construct_sum_of_vectors_3_object();
|
m_sum_functor = traits.construct_sum_of_vectors_3_object();
|
||||||
m_scale_functor = traits.construct_scaled_vector_3_object();
|
m_scale_functor = traits.construct_scaled_vector_3_object();
|
||||||
|
|
||||||
// construct internal facet normal & area map
|
// construct internal face normal & area map
|
||||||
BOOST_FOREACH(face_descriptor f, faces(tm)) {
|
BOOST_FOREACH(face_descriptor f, faces(tm)) {
|
||||||
const halfedge_descriptor he = halfedge(f, tm);
|
const halfedge_descriptor he = halfedge(f, tm);
|
||||||
const Point_3 &p0 = vpmap[source(he, tm)];
|
const Point_3 &p0 = vpmap[source(he, tm)];
|
||||||
|
|
@ -78,13 +78,13 @@ public:
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief computes the L2,1 error from a facet to a proxy.
|
* @brief computes the L2,1 error from a face to a proxy.
|
||||||
* @param tm input triangle mesh
|
* @param tm input triangle mesh
|
||||||
* @param f face_descriptor of a face
|
* @param f face_descriptor of a face
|
||||||
* @param px proxy
|
* @param px proxy
|
||||||
* @return computed error
|
* @return computed error
|
||||||
*/
|
*/
|
||||||
FT compute_error(const TriangleMesh &tm, const face_descriptor f, const Proxy &px) const {
|
FT compute_error(const face_descriptor f, const TriangleMesh &tm, const Proxy &px) const {
|
||||||
(void)(tm);
|
(void)(tm);
|
||||||
Vector_3 v = m_sum_functor(get(m_fnmap, f), m_scale_functor(px, FT(-1.0)));
|
Vector_3 v = m_sum_functor(get(m_fnmap, f), m_scale_functor(px, FT(-1.0)));
|
||||||
return get(m_famap, f) * m_scalar_product_functor(v, v);
|
return get(m_famap, f) * m_scalar_product_functor(v, v);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public:
|
||||||
* @param px proxy
|
* @param px proxy
|
||||||
* @return computed error
|
* @return computed error
|
||||||
*/
|
*/
|
||||||
FT compute_error(const TriangleMesh &tm, const face_descriptor f, const Proxy &px) const {
|
FT compute_error(const face_descriptor f, const TriangleMesh &tm, const Proxy &px) const {
|
||||||
(void)(tm);
|
(void)(tm);
|
||||||
halfedge_descriptor he = halfedge(f, *m_tm);
|
halfedge_descriptor he = halfedge(f, *m_tm);
|
||||||
const Point_3 &p0 = m_vpmap[source(he, *m_tm)];
|
const Point_3 &p0 = m_vpmap[source(he, *m_tm)];
|
||||||
|
|
|
||||||
|
|
@ -1200,7 +1200,7 @@ private:
|
||||||
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
||||||
&& get(m_fproxy_map, fadj) == CGAL_VSA_INVALID_TAG) {
|
&& get(m_fproxy_map, fadj) == CGAL_VSA_INVALID_TAG) {
|
||||||
face_pqueue.push(Face_to_integrate(
|
face_pqueue.push(Face_to_integrate(
|
||||||
fadj, pxw_itr->idx, m_metric->compute_error(*m_ptm, fadj, pxw_itr->px)));
|
fadj, pxw_itr->idx, m_metric->compute_error(fadj, *m_ptm, pxw_itr->px)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1214,7 +1214,7 @@ private:
|
||||||
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
if (fadj != boost::graph_traits<TriangleMesh>::null_face()
|
||||||
&& get(m_fproxy_map, fadj) == CGAL_VSA_INVALID_TAG) {
|
&& get(m_fproxy_map, fadj) == CGAL_VSA_INVALID_TAG) {
|
||||||
face_pqueue.push(Face_to_integrate(
|
face_pqueue.push(Face_to_integrate(
|
||||||
fadj, c.px, m_metric->compute_error(*m_ptm, fadj, m_proxies[c.px].px)));
|
fadj, c.px, m_metric->compute_error(fadj, *m_ptm, m_proxies[c.px].px)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1290,7 +1290,7 @@ private:
|
||||||
if (px_idx != px_worst || f == m_proxies[px_idx].seed)
|
if (px_idx != px_worst || f == m_proxies[px_idx].seed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FT err = m_metric->compute_error(*m_ptm, f, m_proxies[px_idx].px);
|
FT err = m_metric->compute_error(f, *m_ptm, m_proxies[px_idx].px);
|
||||||
if (first || max_error < err) {
|
if (first || max_error < err) {
|
||||||
first = false;
|
first = false;
|
||||||
max_error = err;
|
max_error = err;
|
||||||
|
|
@ -1325,10 +1325,10 @@ private:
|
||||||
|
|
||||||
// find proxy seed and sum error
|
// find proxy seed and sum error
|
||||||
face_descriptor seed = *px_patch.begin();
|
face_descriptor seed = *px_patch.begin();
|
||||||
FT err_min = m_metric->compute_error(*m_ptm, seed, px);
|
FT err_min = m_metric->compute_error(seed, *m_ptm, px);
|
||||||
FT sum_error(0.0);
|
FT sum_error(0.0);
|
||||||
BOOST_FOREACH(face_descriptor f, px_patch) {
|
BOOST_FOREACH(face_descriptor f, px_patch) {
|
||||||
const FT err = m_metric->compute_error(*m_ptm, f, px);
|
const FT err = m_metric->compute_error(f, *m_ptm, px);
|
||||||
sum_error += err;
|
sum_error += err;
|
||||||
if (err < err_min) {
|
if (err < err_min) {
|
||||||
err_min = err;
|
err_min = err;
|
||||||
|
|
@ -1362,13 +1362,13 @@ private:
|
||||||
// fit proxy parameters
|
// fit proxy parameters
|
||||||
std::vector<face_descriptor> fvec(1, f);
|
std::vector<face_descriptor> fvec(1, f);
|
||||||
const Proxy px = m_metric->fit_proxy(fvec, *m_ptm);
|
const Proxy px = m_metric->fit_proxy(fvec, *m_ptm);
|
||||||
const FT err = m_metric->compute_error(*m_ptm, f, px);
|
const FT err = m_metric->compute_error(f, *m_ptm, px);
|
||||||
|
|
||||||
// original proxy map should always be falid
|
// original proxy map should always be falid
|
||||||
const std::size_t prev_px_idx = get(m_fproxy_map, f);
|
const std::size_t prev_px_idx = get(m_fproxy_map, f);
|
||||||
CGAL_assertion(prev_px_idx != CGAL_VSA_INVALID_TAG);
|
CGAL_assertion(prev_px_idx != CGAL_VSA_INVALID_TAG);
|
||||||
// update the proxy error and proxy map
|
// update the proxy error and proxy map
|
||||||
m_proxies[prev_px_idx].err -= m_metric->compute_error(*m_ptm, f, m_proxies[prev_px_idx].px);
|
m_proxies[prev_px_idx].err -= m_metric->compute_error(f, *m_ptm, m_proxies[prev_px_idx].px);
|
||||||
put(m_fproxy_map, f, px_idx);
|
put(m_fproxy_map, f, px_idx);
|
||||||
|
|
||||||
return Proxy_wrapper(px, px_idx, f, err);
|
return Proxy_wrapper(px, px_idx, f, err);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ struct Compact_metric_point_proxy {
|
||||||
// compute and return error from a face to a proxy,
|
// compute and return error from a face to a proxy,
|
||||||
// defined as the Euclidean distance between
|
// defined as the Euclidean distance between
|
||||||
// the face center of mass and proxy point.
|
// the face center of mass and proxy point.
|
||||||
FT compute_error(const Polyhedron &tm, const Facet_handle &f, const Proxy &px) const {
|
FT compute_error(const Facet_handle &f, const Polyhedron &tm, const Proxy &px) const {
|
||||||
(void)(tm);
|
(void)(tm);
|
||||||
return FT(std::sqrt(CGAL::to_double(
|
return FT(std::sqrt(CGAL::to_double(
|
||||||
CGAL::squared_distance(center_pmap[f], px))));
|
CGAL::squared_distance(center_pmap[f], px))));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue