From b34eadc7fd76d8fb186f1e4684f503435c31c08c Mon Sep 17 00:00:00 2001 From: Lingjie Zhu Date: Thu, 28 Feb 2019 20:12:33 +0800 Subject: [PATCH] fix approximate_sqrt for EPICK --- .../Surface_mesh/Surface_mesh_approximation_plugin.cpp | 8 ++++---- .../demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp | 2 +- .../demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h | 3 +-- .../vsa_isotropic_metric_example.cpp | 4 ++-- .../test/Surface_mesh_approximation/vsa_metric_test.cpp | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp index 85db082d3db..1712959d7f1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp @@ -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)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp index 423563e2c93..2f4e32fa8fb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp @@ -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); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h index 84fb8c01bfb..44d53dc8036 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h @@ -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 diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp index 81c440818c9..aea8960569d 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp @@ -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)); } diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp index 51c9cd19d08..39c4ef1d16c 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp @@ -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)); }