From 7ff3c99876fc6eb00a4ea1eb5e189a4379eeae3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 28 Apr 2015 18:59:25 +0200 Subject: [PATCH] Avoid an unnecessary projection on tangent planes If the center of the star is the origin of the tangent basis, there is no need to compute a projection (it'll be the origin, locally) (cherry picked from commit e04c440477a43498aa79fa10e36f07893bcf572b) --- .../include/CGAL/Tangential_complex.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Tangential_complex/include/CGAL/Tangential_complex.h b/Tangential_complex/include/CGAL/Tangential_complex.h index 5aee87487f8..e035aa7c77c 100644 --- a/Tangential_complex/include/CGAL/Tangential_complex.h +++ b/Tangential_complex/include/CGAL/Tangential_complex.h @@ -1057,9 +1057,21 @@ private: //*************************************************** // Insert p - const Weighted_point wp = compute_perturbed_weighted_point(i); - Tr_point proj_wp = project_point_and_compute_weight(wp, m_tangent_spaces[i], - local_tr_traits); + typename Kernel::Equal_d eq = m_k.equal_d_object(); + + Tr_point proj_wp; + if(eq(compute_perturbed_point(i), m_tangent_spaces[i].origin())) + { + proj_wp = local_tr_traits.construct_weighted_point_d_object()( + local_tr_traits.construct_point_d_object()(m_intrinsic_dimension, ORIGIN), + m_weights[i]); + } + else + { + const Weighted_point& wp = compute_perturbed_weighted_point(i); + proj_wp = project_point_and_compute_weight(wp, m_tangent_spaces[i], + local_tr_traits); + } center_vertex = local_tr.insert(proj_wp); center_vertex->data() = i;