fix approximate_sqrt for EPICK

This commit is contained in:
Lingjie Zhu 2019-02-28 20:12:33 +08:00
parent 0a52d1033f
commit b34eadc7fd
5 changed files with 10 additions and 11 deletions

View File

@ -225,8 +225,8 @@ public:
EPICK::Vector_3 base1 = plane.base1();
EPICK::Vector_3 base2 = plane.base2();
base1 = base1 / CGAL::approximate_sqrt(base1.squared_length());
base2 = base2 / CGAL::approximate_sqrt(base2.squared_length());
base1 = base1 / CGAL::sqrt(base1.squared_length());
base2 = base2 / CGAL::sqrt(base2.squared_length());
EPICK::Line_3 base_linex(origin, base1);
EPICK::Line_3 base_liney(origin, base2);
@ -236,8 +236,8 @@ public:
const Point_3 point = plane.projection(p);
EPICK::Vector_3 vecx(origin, base_linex.projection(point));
EPICK::Vector_3 vecy(origin, base_liney.projection(point));
double x = CGAL::approximate_sqrt(vecx.squared_length());
double y = CGAL::approximate_sqrt(vecy.squared_length());
double x = CGAL::sqrt(vecx.squared_length());
double y = CGAL::sqrt(vecy.squared_length());
x = vecx * base1 < 0 ? -x : x;
y = vecy * base2 < 0 ? -y : y;
pts_2d.push_back(EPICK::Point_2(x, y));

View File

@ -15,7 +15,7 @@ VSA_wrapper::VSA_wrapper(const SMesh &mesh) :
const Point_3 &p2 = vpm[target(next(he, mesh), mesh)];
put(m_center_pmap, f, CGAL::centroid(p0, p1, p2));
put(m_area_pmap, f, CGAL::approximate_sqrt(CGAL::squared_area(p0, p1, p2)));
put(m_area_pmap, f, CGAL::sqrt(CGAL::squared_area(p0, p1, p2)));
}
m_pl21_metric = new L21_metric(mesh, vpm);

View File

@ -65,8 +65,7 @@ class VSA_WRAPPER_EXPORT VSA_wrapper {
: center_pmap(center_pmap_), area_pmap(area_pmap_) {}
FT compute_error(const face_descriptor f, const SMesh &, const Proxy &px) const {
return CGAL::approximate_sqrt(
CGAL::squared_distance(get(center_pmap, f), px));
return CGAL::sqrt(CGAL::squared_distance(get(center_pmap, f), px));
}
template <typename FaceRange>

View File

@ -36,7 +36,7 @@ struct Compact_metric_point_proxy
// defined as the Euclidean distance between
// the face center of mass and proxy point.
FT compute_error(const face_descriptor &f, const Mesh &, const Proxy &px) const {
return CGAL::approximate_sqrt(CGAL::squared_distance(center_pmap[f], px));
return CGAL::sqrt(CGAL::squared_distance(center_pmap[f], px));
}
// template functor to compute a best-fit
@ -84,7 +84,7 @@ int main()
const Point_3 &p0 = vpmap[source(he, mesh)];
const Point_3 &p1 = vpmap[target(he, mesh)];
const Point_3 &p2 = vpmap[target(next(he, mesh), mesh)];
put(area_pmap, f, CGAL::approximate_sqrt(CGAL::squared_area(p0, p1, p2)));
put(area_pmap, f, CGAL::sqrt(CGAL::squared_area(p0, p1, p2)));
put(center_pmap, f, CGAL::centroid(p0, p1, p2));
}

View File

@ -36,7 +36,7 @@ struct Compact_metric_point_proxy {
// defined as the Euclidean distance between
// the face center of mass and proxy point.
FT compute_error(const face_descriptor &f, const Mesh &, const Proxy &px) const {
return CGAL::approximate_sqrt(CGAL::squared_distance(center_pmap[f], px));
return CGAL::sqrt(CGAL::squared_distance(center_pmap[f], px));
}
// template functor to compute a best-fit
@ -97,7 +97,7 @@ int main()
const Point_3 &p0 = vpmap[source(he, mesh)];
const Point_3 &p1 = vpmap[target(he, mesh)];
const Point_3 &p2 = vpmap[target(next(he, mesh), mesh)];
put(area_pmap, f, FT(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2)))));
put(area_pmap, f, CGAL::sqrt(CGAL::squared_area(p0, p1, p2)));
put(center_pmap, f, CGAL::centroid(p0, p1, p2));
}