Commit: eac84bf52724b082cd2d0aa2ba7669e8053c342a
Author: Howard Trickey
Date: Wed Aug 19 18:20:31 2020 -0400
Branches: newboolean
https://developer.blender.org/rBeac84bf52724b082cd2d0aa2ba7669e8053c342a
Use std::abs instead of fabs in C++ code.
===================================================================
M source/blender/blenlib/BLI_double2.hh
M source/blender/blenlib/BLI_double3.hh
M source/blender/blenlib/intern/delaunay_2d.cc
M source/blender/blenlib/intern/mesh_intersect.cc
M source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
===================================================================
diff --git a/source/blender/blenlib/BLI_double2.hh
b/source/blender/blenlib/BLI_double2.hh
index a85f74ee442..1b3d1ae06f3 100644
--- a/source/blender/blenlib/BLI_double2.hh
+++ b/source/blender/blenlib/BLI_double2.hh
@@ -101,7 +101,7 @@ struct double2 {
static double2 abs(const double2 &a)
{
- return double2(fabsf(a.x), fabsf(a.y));
+ return double2(std::abs(a.x), std::abs(a.y));
}
static double distance(const double2 &a, const double2 &b)
diff --git a/source/blender/blenlib/BLI_double3.hh
b/source/blender/blenlib/BLI_double3.hh
index 11a88e121ca..e9c62e71882 100644
--- a/source/blender/blenlib/BLI_double3.hh
+++ b/source/blender/blenlib/BLI_double3.hh
@@ -218,7 +218,7 @@ struct double3 {
static double3 abs(const double3 &a)
{
- return double3(fabs(a.x), fabs(a.y), fabs(a.z));
+ return double3(std::abs(a.x), std::abs(a.y), std::abs(a.z));
}
/* orient3d gives the exact result, using multiprecision artihmetic when
result
diff --git a/source/blender/blenlib/intern/delaunay_2d.cc
b/source/blender/blenlib/intern/delaunay_2d.cc
index 0cb53a71432..f7523279c9e 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -48,7 +48,7 @@ template<> mpq_class math_abs<mpq_class>(const mpq_class v)
template<> double math_abs<double>(const double v)
{
- return fabs(v);
+ return std::abs(v);
}
template<typename T> double math_to_double(const T UNUSED(v))
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc
b/source/blender/blenlib/intern/mesh_intersect.cc
index d0def5c06a2..22d6d830e0a 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -838,7 +838,7 @@ static Array<BoundingBox> calc_face_bounding_boxes(const
Mesh &m)
for (Vertp v : face) {
bb.combine(v->co);
for (int i = 0; i < 3; ++i) {
- max_abs_val = max_dd(max_abs_val, fabs(v->co[i]));
+ max_abs_val = max_dd(max_abs_val, std::abs(v->co[i]));
}
}
}
@@ -1422,7 +1422,7 @@ static int filter_orient3d(const double3 &a, const
double3 &b, const double3 &c,
return 0;
}
double err_bound = supremum_orient3d(a, b, c, d) * index_orient3d *
DBL_EPSILON;
- if (fabs(o3dfast) > err_bound) {
+ if (std::abs(o3dfast) > err_bound) {
return o3dfast > 0.0 ? 1 : -1;
}
return 0;
diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
index 2287389f7aa..f2e05d573c9 100644
--- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
+++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
@@ -138,7 +138,7 @@ template<> mpq_class math_abs(const mpq_class v)
template<> double math_abs(const double v)
{
- return fabs(v);
+ return std::abs(v);
}
/* Find an output index corresponding to a given coordinate (appproximately).
@@ -150,7 +150,7 @@ template<typename T> int get_vertex_by_coord(const
CDT_result<T> &out, double x,
for (int i = 0; i < nv; ++i) {
double vx = math_to_double(out.vert[i][0]);
double vy = math_to_double(out.vert[i][1]);
- if (fabs(vx - x) <= 1e-5 && fabs(vy - y) <= 1e-5) {
+ if (std::abs(vx - x) <= 1e-5 && std::abs(vy - y) <= 1e-5) {
return i;
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs