mirror of https://github.com/CGAL/cgal
Merge pull request #5547 from sgiraudot/Fix_stdpow_related_warnings-GF
Fix warning: std::pow(float, int) returns double instead of float in recent C++
This commit is contained in:
commit
343ef10367
|
|
@ -21,6 +21,7 @@
|
||||||
#include <CGAL/function_objects.h>
|
#include <CGAL/function_objects.h>
|
||||||
#include <CGAL/copy_n.h>
|
#include <CGAL/copy_n.h>
|
||||||
#include <CGAL/number_type_config.h>
|
#include <CGAL/number_type_config.h>
|
||||||
|
#include <CGAL/double.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
@ -192,7 +193,7 @@ void random_convex_hull_in_disc_2(std::size_t n, double radius, std::list<typena
|
||||||
(simulated_points < n)); // initialization such that 0 in P_n
|
(simulated_points < n)); // initialization such that 0 in P_n
|
||||||
|
|
||||||
std::size_t T = n;
|
std::size_t T = n;
|
||||||
if (!fast) T = static_cast<std::size_t>(std::floor(n / std::pow(std::log(static_cast<double>(n)), 2)));
|
if (!fast) T = static_cast<std::size_t>(std::floor(n / CGAL::square(std::log(static_cast<double>(n)))));
|
||||||
|
|
||||||
while (simulated_points < n) {
|
while (simulated_points < n) {
|
||||||
// l is a list coming from a convex hull operation. we are moving the
|
// l is a list coming from a convex hull operation. we are moving the
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ compute_denoise_projection(
|
||||||
Vector normal_sum = CGAL::NULL_VECTOR;
|
Vector normal_sum = CGAL::NULL_VECTOR;
|
||||||
|
|
||||||
FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0);
|
FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0);
|
||||||
FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
|
FT sharpness_bandwidth = CGAL::square((CGAL::max)(1e-8, 1 - cos_sigma));
|
||||||
|
|
||||||
for (typename PointRange::iterator it : neighbor_pwns)
|
for (typename PointRange::iterator it : neighbor_pwns)
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +101,7 @@ compute_denoise_projection(
|
||||||
if (dist2 < radius2)
|
if (dist2 < radius2)
|
||||||
{
|
{
|
||||||
FT theta = std::exp(dist2 * iradius16);
|
FT theta = std::exp(dist2 * iradius16);
|
||||||
FT psi = std::exp(-std::pow(1 - get(normal_map, vt) * nn, 2)
|
FT psi = std::exp(-CGAL::square(1 - get(normal_map, vt) * nn)
|
||||||
/ sharpness_bandwidth);
|
/ sharpness_bandwidth);
|
||||||
|
|
||||||
weight = theta * psi;
|
weight = theta * psi;
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ update_new_point(
|
||||||
|
|
||||||
for (unsigned int j = 0; j < candidate_num; j++)
|
for (unsigned int j = 0; j < candidate_num; j++)
|
||||||
{
|
{
|
||||||
FT psi = std::exp(-std::pow(FT(1) - normal_cadidate[j] * t.normal, FT(2))
|
FT psi = std::exp(-CGAL::square(FT(1) - normal_cadidate[j] * t.normal)
|
||||||
/ sharpness_bandwidth);
|
/ sharpness_bandwidth);
|
||||||
FT project_diff_t_v = (t.pt - new_v.pt) * t.normal;
|
FT project_diff_t_v = (t.pt - new_v.pt) * t.normal;
|
||||||
FT weight = psi * theta;
|
FT weight = psi * theta;
|
||||||
|
|
@ -435,7 +435,7 @@ edge_aware_upsample_point_set(
|
||||||
//
|
//
|
||||||
FT cos_sigma = static_cast<FT>(std::cos(FT(CGAL::to_double(sharpness_angle))
|
FT cos_sigma = static_cast<FT>(std::cos(FT(CGAL::to_double(sharpness_angle))
|
||||||
/ FT(180) * FT(CGAL_PI)));
|
/ FT(180) * FT(CGAL_PI)));
|
||||||
FT sharpness_bandwidth = std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2);
|
FT sharpness_bandwidth = CGAL::square((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma));
|
||||||
|
|
||||||
FT sum_density = 0.0;
|
FT sum_density = 0.0;
|
||||||
unsigned int count_density = 1;
|
unsigned int count_density = 1;
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ compute_update_sample_point(
|
||||||
if (dist2 < 1e-10) continue;
|
if (dist2 < 1e-10) continue;
|
||||||
FT dist = std::sqrt(dist2);
|
FT dist = std::sqrt(dist2);
|
||||||
|
|
||||||
weight = std::exp(dist2 * iradius16) * std::pow(FT(1.0) / dist, 2); // L1
|
weight = std::exp(dist2 * iradius16) * CGAL::square(FT(1.0) / dist); // L1
|
||||||
|
|
||||||
if (!is_sample_densities_empty)
|
if (!is_sample_densities_empty)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1030,7 +1030,7 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline FT stop_probability(std::size_t largest_candidate, std::size_t num_pts, std::size_t num_candidates, std::size_t octree_depth) const {
|
inline FT stop_probability(std::size_t largest_candidate, std::size_t num_pts, std::size_t num_candidates, std::size_t octree_depth) const {
|
||||||
return (std::min<FT>)(std::pow(FT(1) - FT(largest_candidate)
|
return (std::min<FT>)((FT)std::pow(FT(1) - FT(largest_candidate)
|
||||||
/ (FT(num_pts) * FT(octree_depth+1)
|
/ (FT(num_pts) * FT(octree_depth+1)
|
||||||
* FT(1 << (m_required_samples - 1))),
|
* FT(1 << (m_required_samples - 1))),
|
||||||
int(num_candidates)), FT(1));
|
int(num_candidates)), FT(1));
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
for(std::size_t i = 0; i < number_of_points; ++i) {
|
for(std::size_t i = 0; i < number_of_points; ++i) {
|
||||||
double Q = i * golden_ratio * CGAL_PI;
|
double Q = i * golden_ratio * CGAL_PI;
|
||||||
double R = std::sqrt(static_cast<double>(i) / number_of_points);
|
double R = std::sqrt(static_cast<double>(i) / number_of_points);
|
||||||
double weight = exp(-0.5 * (std::pow(R / CGAL_ANGLE_ST_DEV_DIVIDER, 2)));
|
double weight = exp(-0.5 * (CGAL::square(R / CGAL_ANGLE_ST_DEV_DIVIDER)));
|
||||||
*out_it++ = Tuple(R * cos(Q), R * sin(Q), weight);
|
*out_it++ = Tuple(R * cos(Q), R * sin(Q), weight);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ private:
|
||||||
return x == mean ? 1.0 : 0.0;
|
return x == mean ? 1.0 : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double e_over = -0.5 * std::pow((x - mean) / deviation, 2);
|
double e_over = -0.5 * CGAL::square((x - mean) / deviation);
|
||||||
return exp(e_over) / deviation;
|
return exp(e_over) / deviation;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -289,7 +289,7 @@ private:
|
||||||
double new_deviation = 0.0;
|
double new_deviation = 0.0;
|
||||||
for(std::size_t point_i = 0; point_i < points.size(); ++point_i) {
|
for(std::size_t point_i = 0; point_i < points.size(); ++point_i) {
|
||||||
double membership = responsibility_matrix[center_i][point_i];
|
double membership = responsibility_matrix[center_i][point_i];
|
||||||
new_deviation += membership * std::pow(points[point_i] - new_mean, 2);
|
new_deviation += membership * CGAL::square(points[point_i] - new_mean);
|
||||||
}
|
}
|
||||||
new_deviation = std::sqrt(new_deviation/total_membership);
|
new_deviation = std::sqrt(new_deviation/total_membership);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <CGAL/boost/graph/iterator.h>
|
#include <CGAL/boost/graph/iterator.h>
|
||||||
|
#include <CGAL/number_utils.h>
|
||||||
|
#include <CGAL/double.h>
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -92,7 +94,7 @@ public:
|
||||||
double deviation = 0.0;
|
double deviation = 0.0;
|
||||||
for(typename std::map<face_descriptor, std::size_t>::iterator it =
|
for(typename std::map<face_descriptor, std::size_t>::iterator it =
|
||||||
neighbors.begin(); it != neighbors.end(); ++it) {
|
neighbors.begin(); it != neighbors.end(); ++it) {
|
||||||
deviation += std::pow(get(values, it->first) - current_sdf_value, 2);
|
deviation += CGAL::square(get(values, it->first) - current_sdf_value);
|
||||||
}
|
}
|
||||||
deviation = std::sqrt(deviation / neighbors.size());
|
deviation = std::sqrt(deviation / neighbors.size());
|
||||||
if(deviation == 0.0) {
|
if(deviation == 0.0) {
|
||||||
|
|
@ -133,7 +135,7 @@ public:
|
||||||
private:
|
private:
|
||||||
/** Gaussian function for weighting. */
|
/** Gaussian function for weighting. */
|
||||||
double gaussian_function(double value, double deviation) const {
|
double gaussian_function(double value, double deviation) const {
|
||||||
return exp(-0.5 * (std::pow(value / deviation, 2)));
|
return exp(-0.5 * (CGAL::square(value / deviation)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public:
|
||||||
double cumulative_distance_square = 0.0;
|
double cumulative_distance_square = 0.0;
|
||||||
// distance_square holds closest distance that points have, so just test new coming center (i.e. centers.back())
|
// distance_square holds closest distance that points have, so just test new coming center (i.e. centers.back())
|
||||||
for(std::size_t j = 0; j < points.size(); ++j) {
|
for(std::size_t j = 0; j < points.size(); ++j) {
|
||||||
double new_distance = std::pow(centers.back() - points[j], 2);
|
double new_distance = CGAL::square(centers.back() - points[j]);
|
||||||
if(new_distance < distance_square[j]) {
|
if(new_distance < distance_square[j]) {
|
||||||
distance_square[j] = new_distance;
|
distance_square[j] = new_distance;
|
||||||
}
|
}
|
||||||
|
|
@ -422,7 +422,7 @@ private:
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
for(std::vector<K_means_point>::const_iterator point_it = points.begin();
|
for(std::vector<K_means_point>::const_iterator point_it = points.begin();
|
||||||
point_it != points.end(); ++point_it) {
|
point_it != points.end(); ++point_it) {
|
||||||
sum += std::pow(centers[point_it->center_id].mean - point_it->data, 2);
|
sum += CGAL::square(centers[point_it->center_id].mean - point_it->data);
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue