mirror of https://github.com/CGAL/cgal
Replace std::pow(x,2) by CGAL::square(x)
This commit is contained in:
parent
91de37ec3a
commit
ab14acff77
|
|
@ -192,7 +192,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
|
||||
|
||||
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) {
|
||||
// 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;
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ compute_denoise_projection(
|
|||
if (dist2 < radius2)
|
||||
{
|
||||
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);
|
||||
|
||||
weight = theta * psi;
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ update_new_point(
|
|||
|
||||
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);
|
||||
FT project_diff_t_v = (t.pt - new_v.pt) * t.normal;
|
||||
FT weight = psi * theta;
|
||||
|
|
@ -437,7 +437,7 @@ edge_aware_upsample_point_set(
|
|||
//
|
||||
FT cos_sigma = static_cast<FT>(std::cos(FT(CGAL::to_double(sharpness_angle))
|
||||
/ FT(180) * FT(CGAL_PI)));
|
||||
FT sharpness_bandwidth = static_cast<FT>(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;
|
||||
unsigned int count_density = 1;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ compute_update_sample_point(
|
|||
if (dist2 < 1e-10) continue;
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public:
|
|||
for(std::size_t i = 0; i < number_of_points; ++i) {
|
||||
double Q = i * golden_ratio * CGAL_PI;
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private:
|
|||
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;
|
||||
}
|
||||
/**
|
||||
|
|
@ -289,7 +289,7 @@ private:
|
|||
double new_deviation = 0.0;
|
||||
for(std::size_t point_i = 0; point_i < points.size(); ++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);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public:
|
|||
double deviation = 0.0;
|
||||
for(typename std::map<face_descriptor, std::size_t>::iterator 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());
|
||||
if(deviation == 0.0) {
|
||||
|
|
@ -133,7 +133,7 @@ public:
|
|||
private:
|
||||
/** Gaussian function for weighting. */
|
||||
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;
|
||||
// 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) {
|
||||
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]) {
|
||||
distance_square[j] = new_distance;
|
||||
}
|
||||
|
|
@ -422,7 +422,7 @@ private:
|
|||
double sum = 0.0;
|
||||
for(std::vector<K_means_point>::const_iterator point_it = points.begin();
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue