diff --git a/matrix/AxisAngle.hpp b/matrix/AxisAngle.hpp index 5a6cc4af9f..b281138e0e 100644 --- a/matrix/AxisAngle.hpp +++ b/matrix/AxisAngle.hpp @@ -76,9 +76,9 @@ public: Vector() { AxisAngle &v = *this; - Type ang = Type(2.0f)*acosf(q(0)); - Type mag = sinf(ang/2.0f); - if (fabsf(mag) > 0) { + Type ang = Type(2.0f)*acos(q(0)); + Type mag = sin(ang/2.0f); + if (fabs(mag) > 0) { v(0) = ang*q(1)/mag; v(1) = ang*q(2)/mag; v(2) = ang*q(3)/mag; diff --git a/matrix/Quaternion.hpp b/matrix/Quaternion.hpp index c7a5f2bda3..0873c8757c 100644 --- a/matrix/Quaternion.hpp +++ b/matrix/Quaternion.hpp @@ -97,28 +97,28 @@ public: Quaternion &q = *this; Type t = R.trace(); if (t > Type(0)) { - t = sqrtf(Type(1) + t); + t = sqrt(Type(1) + t); q(0) = Type(0.5) * t; t = Type(0.5) / t; q(1) = (R(2,1) - R(1,2)) * t; q(2) = (R(0,2) - R(2,0)) * t; q(3) = (R(1,0) - R(0,1)) * t; } else if (R(0,0) > R(1,1) && R(0,0) > R(2,2)) { - t = sqrtf(Type(1) + R(0,0) - R(1,1) - R(2,2)); + t = sqrt(Type(1) + R(0,0) - R(1,1) - R(2,2)); q(1) = Type(0.5) * t; t = Type(0.5) / t; q(0) = (R(2,1) - R(1,2)) * t; q(2) = (R(1,0) + R(0,1)) * t; q(3) = (R(0,2) + R(2,0)) * t; } else if (R(1,1) > R(2,2)) { - t = sqrtf(Type(1) - R(0,0) + R(1,1) - R(2,2)); + t = sqrt(Type(1) - R(0,0) + R(1,1) - R(2,2)); q(2) = Type(0.5) * t; t = Type(0.5) / t; q(0) = (R(0,2) - R(2,0)) * t; q(1) = (R(1,0) + R(0,1)) * t; q(3) = (R(2,1) + R(1,2)) * t; } else { - t = sqrtf(Type(1) - R(0,0) - R(1,1) + R(2,2)); + t = sqrt(Type(1) - R(0,0) - R(1,1) + R(2,2)); q(3) = Type(0.5) * t; t = Type(0.5) / t; q(0) = (R(1,0) - R(0,1)) * t; @@ -171,8 +171,8 @@ public: q(0) = Type(1.0); q(1) = q(2) = q(3) = 0; } else { - Type magnitude = sinf(angle / 2.0f); - q(0) = cosf(angle / 2.0f); + Type magnitude = sin(angle / 2.0f); + q(0) = cos(angle / 2.0f); q(1) = axis(0) * magnitude; q(2) = axis(1) * magnitude; q(3) = axis(2) * magnitude; @@ -389,9 +389,9 @@ public: q(1) = q(2) = q(3) = 0; } - Type magnitude = sinf(theta / 2.0f); + Type magnitude = sin(theta / 2.0f); - q(0) = cosf(theta / 2.0f); + q(0) = cos(theta / 2.0f); q(1) = axis(0) * magnitude; q(2) = axis(1) * magnitude; q(3) = axis(2) * magnitude; @@ -418,7 +418,7 @@ public: if (axis_magnitude >= Type(1e-10)) { vec = vec / axis_magnitude; - vec = vec * wrap_pi(Type(2.0) * atan2f(axis_magnitude, q(0))); + vec = vec * wrap_pi(Type(2.0) * atan2(axis_magnitude, q(0))); } return vec; diff --git a/matrix/SquareMatrix.hpp b/matrix/SquareMatrix.hpp index f1a5a9b134..5b2560dc71 100644 --- a/matrix/SquareMatrix.hpp +++ b/matrix/SquareMatrix.hpp @@ -136,12 +136,12 @@ bool inv(const SquareMatrix & A, SquareMatrix & inv) for (size_t n = 0; n < M; n++) { // if diagonal is zero, swap with row below - if (fabsf(static_cast(U(n, n))) < 1e-8f) { + if (fabs(static_cast(U(n, n))) < 1e-8f) { //printf("trying pivot for row %d\n",n); for (size_t i = n + 1; i < M; i++) { //printf("\ttrying row %d\n",i); - if (fabsf(static_cast(U(i, n))) > 1e-8f) { + if (fabs(static_cast(U(i, n))) > 1e-8f) { //printf("swapped %d\n",i); U.swapRows(i, n); P.swapRows(i, n); @@ -157,11 +157,11 @@ bool inv(const SquareMatrix & A, SquareMatrix & inv) //printf("U:\n"); U.print(); //printf("P:\n"); P.print(); //fflush(stdout); - //ASSERT(fabsf(U(n, n)) > 1e-8f); + //ASSERT(fabs(U(n, n)) > 1e-8f); #endif // failsafe, return zero matrix - if (fabsf(static_cast(U(n, n))) < 1e-8f) { + if (fabs(static_cast(U(n, n))) < 1e-8f) { return false; } @@ -280,7 +280,7 @@ SquareMatrix cholesky(const SquareMatrix & A) if (res <= 0) { L(j, j) = 0; } else { - L(j, j) = sqrtf(res); + L(j, j) = sqrt(res); } } else { float sum = 0;