Skip to content

Commit 41193b3

Browse files
committed
Compute angle only once
1 parent 12fdb33 commit 41193b3

File tree

1 file changed

+8
-4
lines changed
  • surface/include/pcl/surface/impl

1 file changed

+8
-4
lines changed

surface/include/pcl/surface/impl/gp3.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ pcl::GreedyProjectionTriangulation<PointInT>::reconstructPolygons (std::vector<p
135135
angles_.resize(nnn_);
136136
std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > uvn_nn (nnn_);
137137
Eigen::Vector2f uvn_s;
138+
const double cos_eps_angle_ = std::cos(eps_angle_);
138139

139140
// iterating through fringe points and finishing them until everything is done
140141
while (is_free != NONE)
@@ -374,10 +375,13 @@ pcl::GreedyProjectionTriangulation<PointInT>::reconstructPolygons (std::vector<p
374375
double cosine = nc.dot (neighbor_normal);
375376
if (cosine > 1) cosine = 1;
376377
if (cosine < -1) cosine = -1;
377-
double angle = std::acos (cosine);
378-
if ((!consistent_) && (angle > M_PI/2))
379-
angle = M_PI - angle;
380-
if (angle > eps_angle_)
378+
379+
bool too_large_angle;
380+
if (consistent_)
381+
too_large_angle = (cosine < cos_eps_angle_);
382+
else
383+
too_large_angle = (std::fabs(cosine) < cos_eps_angle_);
384+
if (too_large_angle)
381385
{
382386
angles_[i].visible = false;
383387
same_side = false;

0 commit comments

Comments
 (0)