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)
This commit is contained in:
Mael Rouxel-Labbé 2015-04-28 18:59:25 +02:00 committed by Clement Jamin
parent 9cfc9ea8ea
commit 7ff3c99876
1 changed files with 15 additions and 3 deletions

View File

@ -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;