Skip to content

Commit

Permalink
Replace C-style sqrtf with std::sqrt
Browse files Browse the repository at this point in the history
  • Loading branch information
taketwo authored and UnaNancyOwen committed Nov 24, 2017
1 parent a1c711a commit 00eba31
Show file tree
Hide file tree
Showing 50 changed files with 131 additions and 132 deletions.
16 changes: 8 additions & 8 deletions 2d/include/pcl/2d/impl/edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pcl::Edge<PointInT, PointOutT>::detectEdgeSobel (
output[i].magnitude_x = (*magnitude_x)[i].intensity;
output[i].magnitude_y = (*magnitude_y)[i].intensity;
output[i].magnitude =
sqrtf ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
output[i].direction =
atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
}
Expand Down Expand Up @@ -121,8 +121,8 @@ pcl::Edge<PointInT, PointOutT>::sobelMagnitudeDirection (
output[i].magnitude_x = (*magnitude_x)[i].intensity;
output[i].magnitude_y = (*magnitude_y)[i].intensity;
output[i].magnitude =
sqrtf ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
output[i].direction =
atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
}
Expand Down Expand Up @@ -160,8 +160,8 @@ pcl::Edge<PointInT, PointOutT>::detectEdgePrewitt (pcl::PointCloud<PointOutT> &o
output[i].magnitude_x = (*magnitude_x)[i].intensity;
output[i].magnitude_y = (*magnitude_y)[i].intensity;
output[i].magnitude =
sqrtf ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
output[i].direction =
atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
}
Expand Down Expand Up @@ -199,8 +199,8 @@ pcl::Edge<PointInT, PointOutT>::detectEdgeRoberts (pcl::PointCloud<PointOutT> &o
output[i].magnitude_x = (*magnitude_x)[i].intensity;
output[i].magnitude_y = (*magnitude_y)[i].intensity;
output[i].magnitude =
sqrtf ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
output[i].direction =
atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace pcl

float avg_dist_neighbours = 0.0;
for (size_t j = 1; j < nn_indices.size (); j++)
avg_dist_neighbours += sqrtf (nn_distances[j]);
avg_dist_neighbours += std::sqrt (nn_distances[j]);

avg_dist_neighbours /= static_cast<float> (nn_indices.size ());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace pcl
{
float r1 = static_cast<float> (uniform_deviate (rand ()));
float r2 = static_cast<float> (uniform_deviate (rand ()));
float r1sqr = sqrtf (r1);
float r1sqr = std::sqrt (r1);
float OneMinR1Sqr = (1 - r1sqr);
float OneMinR2 = (1 - r2);
a1 *= OneMinR1Sqr;
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/nn_classification.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ namespace pcl
{
result->first.push_back (classes_[it - sqr_distances->begin ()]);
// TODO leave it squared, and relate param to sigma...
result->second.push_back (expf (-sqrtf (*it) / gaussian_param));
result->second.push_back (expf (-std::sqrt (*it) / gaussian_param));
}

// Return label/score list pair
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/common/distances.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace pcl
template<typename PointType1, typename PointType2> inline float
euclideanDistance (const PointType1& p1, const PointType2& p2)
{
return (sqrtf (squaredEuclideanDistance (p1, p2)));
return (std::sqrt (squaredEuclideanDistance (p1, p2)));
}
}
/*@*/
Expand Down
12 changes: 6 additions & 6 deletions common/include/pcl/common/impl/norms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ L2_Norm_SQR (FloatVectorT a, FloatVectorT b, int dim)
template <typename FloatVectorT> inline float
L2_Norm (FloatVectorT a, FloatVectorT b, int dim)
{
return sqrtf(L2_Norm_SQR(a, b, dim));
return std::sqrt (L2_Norm_SQR(a, b, dim));
}


Expand All @@ -129,9 +129,9 @@ JM_Norm (FloatVectorT a, FloatVectorT b, int dim)
float norm = 0.0;

for (int i = 0; i < dim; ++i)
norm += (sqrtf (a[i]) - sqrtf (b[i])) * (sqrtf (a[i]) - sqrtf (b[i]));
norm += (std::sqrt (a[i]) - std::sqrt (b[i])) * (std::sqrt (a[i]) - std::sqrt (b[i]));

return sqrtf (norm);
return std::sqrt (norm);
}


Expand All @@ -141,7 +141,7 @@ B_Norm (FloatVectorT a, FloatVectorT b, int dim)
float norm = 0.0, result;

for (int i = 0; i < dim; ++i)
norm += sqrtf (a[i] * b[i]);
norm += std::sqrt (a[i] * b[i]);

if (norm > 0)
result = -logf (norm);
Expand All @@ -158,7 +158,7 @@ Sublinear_Norm (FloatVectorT a, FloatVectorT b, int dim)
float norm = 0.0;

for (int i = 0; i < dim; ++i)
norm += sqrtf (fabsf (a[i] - b[i]));
norm += std::sqrt (fabsf (a[i] - b[i]));

return norm;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ PF_Norm (FloatVectorT a, FloatVectorT b, int dim, float P1, float P2)

for (int i = 0; i < dim; ++i)
norm += (P1 * a[i] - P2 * b[i]) * (P1 * a[i] - P2 * b[i]);
return sqrtf (norm);
return std::sqrt (norm);
}


Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/common/impl/polynomial_calculations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ inline bool
{
return false;
// Reduce degree of polynomial
//polynomial_degree = (unsigned int) (0.5f* (sqrtf (8*samplePoints.size ()+1) - 3));
//polynomial_degree = (unsigned int) (0.5f* (std::sqrt (8*samplePoints.size ()+1) - 3));
//parameters_size = BivariatePolynomialT<real>::getNoOfParametersFromDegree (polynomial_degree);
//cout << "Not enough points, so degree of polynomial was decreased to "<<polynomial_degree
// << " ("<<samplePoints.size ()<<" points => "<<parameters_size<<" parameters)\n";
Expand Down
10 changes: 5 additions & 5 deletions common/include/pcl/range_image/impl/range_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ RangeImage::getImpactAngle (const PointWithRange& point1, const PointWithRange&
float r1Sqr = r1*r1,
r2Sqr = r2*r2,
dSqr = squaredEuclideanDistance (point1, point2),
d = sqrtf (dSqr);
d = std::sqrt (dSqr);
float cos_impact_angle = (r2Sqr + dSqr - r1Sqr)/ (2.0f*r2*d);
cos_impact_angle = (std::max) (0.0f, (std::min) (1.0f, cos_impact_angle));
impact_angle = acosf (cos_impact_angle); // Using the cosine rule
Expand Down Expand Up @@ -770,9 +770,9 @@ RangeImage::getSurfaceAngleChange (int x, int y, int radius, float& angle_change
//return acosf ( (Eigen::Vector3f (point.x, point.y, point.z)-getSensorPos ()).normalized ().dot ( (Eigen::Vector3f (neighbor1.x, neighbor1.y, neighbor1.z)-Eigen::Vector3f (point.x, point.y, point.z)).normalized ()));

//float d1_squared = squaredEuclideanDistance (point, neighbor1),
//d1 = sqrtf (d1_squared),
//d1 = std::sqrt (d1_squared),
//d2_squared = squaredEuclideanDistance (point, neighbor2),
//d2 = sqrtf (d2_squared),
//d2 = std::sqrt (d2_squared),
//d3_squared = squaredEuclideanDistance (neighbor1, neighbor2);
//float cos_surface_change = (d1_squared + d2_squared - d3_squared)/ (2.0f*d1*d2),
//surface_change = acosf (cos_surface_change);
Expand Down Expand Up @@ -871,9 +871,9 @@ RangeImage::getAverageEuclideanDistance (int x, int y, int offset_x, int offset_
else
break;
}
//std::cout << x<<","<<y<<"->"<<x2<<","<<y2<<": "<<sqrtf (pixel_distance)<<"m\n";
//std::cout << x<<","<<y<<"->"<<x2<<","<<y2<<": "<<std::sqrt (pixel_distance)<<"m\n";
weight += 1.0f;
average_pixel_distance += sqrtf (pixel_distance);
average_pixel_distance += std::sqrt (pixel_distance);
}
average_pixel_distance /= weight;
//std::cout << x<<","<<y<<","<<offset_x<<","<<offset_y<<" => "<<average_pixel_distance<<"\n";
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/range_image/impl/range_image_planar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ RangeImagePlanar::calculate3DPoint (float image_x, float image_y, float range, E
//cout << __PRETTY_FUNCTION__ << " called.\n";
float delta_x = (image_x+static_cast<float> (image_offset_x_)-center_x_)*focal_length_x_reciprocal_,
delta_y = (image_y+static_cast<float> (image_offset_y_)-center_y_)*focal_length_y_reciprocal_;
point[2] = range / (sqrtf (delta_x*delta_x + delta_y*delta_y + 1));
point[2] = range / (std::sqrt (delta_x*delta_x + delta_y*delta_y + 1));
point[0] = delta_x*point[2];
point[1] = delta_y*point[2];
point = to_world_system_ * point;
Expand Down
6 changes: 3 additions & 3 deletions common/src/poses_from_matches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ pcl::PosesFromMatches::estimatePosesUsing2Correspondences (const pcl::PointCorre
if ( distance_quotient_squared < min_distance_quotient_squared
|| distance_quotient_squared > max_distance_quotient_squared)
{
//std::cout << "Skipping because of mismatching distances "<<sqrtf (distance1_squared)
// << " and "<<sqrtf (distance1_corr_squared)<<".\n";
//std::cout << "Skipping because of mismatching distances "<<std::sqrt (distance1_squared)
// << " and "<<std::sqrt (distance1_corr_squared)<<".\n";
continue;
}

float distance = sqrtf (distance_squared);
float distance = std::sqrt (distance_squared);

Eigen::Vector3f corr3=corr1, corr4=corr2;
corr3[0]+=distance; corr4[0]+=distance;
Expand Down
2 changes: 1 addition & 1 deletion common/src/range_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ RangeImage::getNormalBasedUprightTransformation (const Eigen::Vector3f& point, f
continue;
}
still_in_range = true;
float distance = sqrtf (distance_squared),
float distance = std::sqrt (distance_squared),
weight = distance*max_dist_reciprocal;
vector_average.add (neighbor, weight);
}
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/3dsc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pcl::ShapeContext3DEstimation<PointInT, PointNT, PointOutT>::computePoint (

/// ----- Compute current neighbour polar coordinates -----
/// Get distance between the neighbour and the origin
float r = sqrtf (nn_dists[ne]);
float r = std::sqrt (nn_dists[ne]);

/// Project point into the tangent plane
Eigen::Vector3f proj;
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/crh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pcl::CRHEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut
for (size_t i = 0; i < grid.points.size (); ++i)
{
bin = static_cast<int> ((((atan2 (grid.points[i].normal_y, grid.points[i].normal_x) + M_PI) * 180 / M_PI) / bin_angle)) % nbins;
w = sqrtf (grid.points[i].normal_y * grid.points[i].normal_y + grid.points[i].normal_x * grid.points[i].normal_x);
w = std::sqrt (grid.points[i].normal_y * grid.points[i].normal_y + grid.points[i].normal_x * grid.points[i].normal_x);
sum_w += w;
spatial_data[bin] += w;
}
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/esf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pcl::ESFEstimation<PointInT, PointOutT>::computeESF (
}

// D3 ( herons formula )
d3v.push_back (sqrtf (sqrtf (s * (s-a) * (s-b) * (s-c))));
d3v.push_back (std::sqrt (std::sqrt (s * (s-a) * (s-b) * (s-c))));
if (vxlcnt_sum <= 21)
{
wt_d3.push_back (0);
Expand Down
4 changes: 2 additions & 2 deletions features/include/pcl/features/impl/integral_image_normal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ pcl::IntegralImageNormalEstimation<PointInT, PointOutT>::computePointNormal (

flipNormalTowardsViewpoint (input_->points[point_index], vpx_, vpy_, vpz_, normal_x, normal_y, normal_z);

const float scale = 1.0f / sqrtf (normal_length);
const float scale = 1.0f / std::sqrt (normal_length);

normal.normal_x = normal_x * scale;
normal.normal_y = normal_y * scale;
Expand Down Expand Up @@ -697,7 +697,7 @@ pcl::IntegralImageNormalEstimation<PointInT, PointOutT>::computePointNormalMirro

flipNormalTowardsViewpoint (input_->points[point_index], vpx_, vpy_, vpz_, normal_x, normal_y, normal_z);

const float scale = 1.0f / sqrtf (normal_length);
const float scale = 1.0f / std::sqrt (normal_length);

normal.normal_x = normal_x * scale;
normal.normal_y = normal_y * scale;
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/intensity_spin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pcl::IntensitySpinEstimation<PointInT, PointOutT>::computeIntensitySpinImage (
{
// Normalize distance and intensity values to: 0.0 <= d,i < nr_distance_bins,nr_intensity_bins
const float eps = std::numeric_limits<float>::epsilon ();
float d = static_cast<float> (nr_distance_bins) * sqrtf (squared_distances[idx]) / (radius + eps);
float d = static_cast<float> (nr_distance_bins) * std::sqrt (squared_distances[idx]) / (radius + eps);
float i = static_cast<float> (nr_intensity_bins) *
(cloud.points[indices[idx]].intensity - min_intensity) / (max_intensity - min_intensity + eps);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pcl::LinearLeastSquaresNormalEstimation<PointInT, PointOutT>::computePointNormal
}
else
{
const float normInv = 1.0f / sqrtf (length);
const float normInv = 1.0f / std::sqrt (length);

normal.normal_x = -nx * normInv;
normal.normal_y = -ny * normInv;
Expand Down Expand Up @@ -252,7 +252,7 @@ pcl::LinearLeastSquaresNormalEstimation<PointInT, PointOutT>::computeFeature (Po
}
else
{
const float normInv = 1.0f / sqrtf (length);
const float normInv = 1.0f / std::sqrt (length);

output.points[index].normal_x = nx * normInv;
output.points[index].normal_y = ny * normInv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pcl::MultiscaleFeaturePersistence<PointSource, PointFeature>::extractUniqueFeatu
standard_dev += diff * diff;
diff_vector[point_i] = diff;
}
standard_dev = sqrtf (standard_dev / static_cast<float> (features_at_scale_vectorized_[scale_i].size ()));
standard_dev = std::sqrt (standard_dev / static_cast<float> (features_at_scale_vectorized_[scale_i].size ()));
PCL_DEBUG ("[pcl::MultiscaleFeaturePersistence::extractUniqueFeatures] Standard deviation for scale %f is %f\n", scale_values_[scale_i], standard_dev);

// Select only points outside (mean +/- alpha * standard_dev)
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/narf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ inline void Narf::copyToNarf36(Narf36& narf36) const
//{
//diff = (diff - middle_value)*normalization_factor2;
//diff = 0.5f + 0.5f*diff;
////diff = 0.5f + 0.5f*sqrtf(diff);
////diff = 0.5f + 0.5f*std::sqrt(diff);
////diff = 0.5f + 0.5f*powf(diff, 0.3f);
//}
//ret += diff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pcl::NormalBasedSignatureEstimation<PointT, PointNT, PointFeature>::computeFeatu
Xk_real += static_cast<float> (s_matrix (n, column_i) * cos (2.0f * M_PI / static_cast<double> (N_ * k * n)));
Xk_imag += static_cast<float> (s_matrix (n, column_i) * sin (2.0f * M_PI / static_cast<double> (N_ * k * n)));
}
dft_col[k] = sqrtf (Xk_real*Xk_real + Xk_imag*Xk_imag);
dft_col[k] = std::sqrt (Xk_real*Xk_real + Xk_imag*Xk_imag);
}
dft_matrix.col (column_i).matrix () = dft_col;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ float RangeImageBorderExtractor::getNeighborDistanceChangeScore(
float neighbor_distance_squared = squaredEuclideanDistance(neighbor, point);
if (neighbor_distance_squared <= local_surface.max_neighbor_distance_squared)
return 0.0f;
float ret = 1.0f - sqrtf(local_surface.max_neighbor_distance_squared / neighbor_distance_squared);
float ret = 1.0f - std::sqrt (local_surface.max_neighbor_distance_squared / neighbor_distance_squared);
if (neighbor.range < point.range)
ret = -ret;
return ret;
Expand Down Expand Up @@ -376,15 +376,15 @@ bool RangeImageBorderExtractor::calculateMainPrincipalCurvature(int x, int y, in

Eigen::Vector3f eigen_values, eigen_vector1, eigen_vector2;
vector_average.doPCA(eigen_values, eigen_vector1, eigen_vector2, main_direction);
magnitude = sqrtf(eigen_values[2]);
magnitude = std::sqrt (eigen_values[2]);
//magnitude = eigen_values[2];
//magnitude = 1.0f - powf(1.0f-magnitude, 5);
//magnitude = 1.0f - powf(1.0f-magnitude, 10);
//magnitude += magnitude - powf(magnitude,2);
//magnitude += magnitude - powf(magnitude,2);

//magnitude = sqrtf(local_surface->eigen_values[0]/local_surface->eigen_values.sum());
//magnitude = sqrtf(local_surface->eigen_values_no_jumps[0]/local_surface->eigen_values_no_jumps.sum());
//magnitude = std::sqrt (local_surface->eigen_values[0]/local_surface->eigen_values.sum());
//magnitude = std::sqrt (local_surface->eigen_values_no_jumps[0]/local_surface->eigen_values_no_jumps.sum());

//if (surface_structure_[y*range_image_->width+x+1]==NULL||surface_structure_[y*range_image_->width+x-1]==NULL)
//{
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/rift.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pcl::RIFTEstimation<PointInT, GradientT, PointOutT>::computeRIFT (

// Normalize distance and angle values to: 0.0 <= d,g < nr_distances_bins,nr_gradient_bins
const float eps = std::numeric_limits<float>::epsilon ();
float d = static_cast<float> (nr_distance_bins) * sqrtf (sqr_distances[idx]) / (radius + eps);
float d = static_cast<float> (nr_distance_bins) * std::sqrt (sqr_distances[idx]) / (radius + eps);
float g = static_cast<float> (nr_gradient_bins) * gradient_angle_from_center / (static_cast<float> (M_PI) + eps);

// Compute the bin indices that need to be updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pcl::StatisticalMultiscaleInterestRegionExtraction<PointT>::generateCloudGraph (
kdtree.nearestKSearch (static_cast<int> (point_i), 16, k_indices, k_distances);

for (int k_i = 0; k_i < static_cast<int> (k_indices.size ()); ++k_i)
add_edge (point_i, k_indices[k_i], Weight (sqrtf (k_distances[k_i])), cloud_graph);
add_edge (point_i, k_indices[k_i], Weight (std::sqrt (k_distances[k_i])), cloud_graph);
}

const size_t E = num_edges (cloud_graph),
Expand Down Expand Up @@ -159,7 +159,7 @@ pcl::StatisticalMultiscaleInterestRegionExtraction<PointT>::computeF ()
for (size_t point_j = 0; point_j < input_->points.size (); ++point_j)
{
float d_g = geodesic_distances_[point_i][point_j];
float phi_i_j = 1.0f / sqrtf (2.0f * static_cast<float> (M_PI) * scale_squared) * expf ( (-1) * d_g*d_g / (2.0f * scale_squared));
float phi_i_j = 1.0f / std::sqrt (2.0f * static_cast<float> (M_PI) * scale_squared) * expf ( (-1) * d_g*d_g / (2.0f * scale_squared));

point_density_i += phi_i_j;
phi_row[point_j] = phi_i_j;
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/usc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pcl::UniqueShapeContext<PointInT, PointOutT, PointRFT>::computePointDescriptor (
// ----- Compute current neighbour polar coordinates -----

// Get distance between the neighbour and the origin
float r = sqrtf (nn_dists[ne]);
float r = std::sqrt (nn_dists[ne]);

// Project point into the tangent plane
Eigen::Vector3f proj;
Expand Down
2 changes: 1 addition & 1 deletion filters/include/pcl/filters/normal_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace pcl
}

// Normalize if norm valid and non-zero
const float norm = sqrtf (nx * nx + ny * ny + nz * nz);
const float norm = std::sqrt (nx * nx + ny * ny + nz * nz);
if (pcl_isfinite (norm) && norm > std::numeric_limits<float>::epsilon ())
{
point.normal_x = nx / norm;
Expand Down
2 changes: 1 addition & 1 deletion geometry/include/pcl/geometry/impl/polygon_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pcl::approximatePolygon2D (const typename pcl::PointCloud<PointT>::VectorType &p
float line_y = polygon [currentInterval.second].x - polygon [currentInterval.first].x;
float line_d = polygon [currentInterval.first].x * polygon [currentInterval.second].y - polygon [currentInterval.first].y * polygon [currentInterval.second].x;

float linelen = 1.0f / sqrtf (line_x * line_x + line_y * line_y);
float linelen = 1.0f / std::sqrt (line_x * line_x + line_y * line_y);

line_x *= linelen;
line_y *= linelen;
Expand Down
Loading

0 comments on commit 00eba31

Please sign in to comment.