diff --git a/src/Misc/DynamicPatcher/Helpers/CircleDifferentiator.cpp b/src/Misc/DynamicPatcher/Helpers/CircleDifferentiator.cpp index ca44de057..24c54dc5f 100644 --- a/src/Misc/DynamicPatcher/Helpers/CircleDifferentiator.cpp +++ b/src/Misc/DynamicPatcher/Helpers/CircleDifferentiator.cpp @@ -3,10 +3,10 @@ std::vector CircleDifferentiator::DivideArcByTolerance(const CoordStruct& center, int radius, int tolerance, const Vector3D& upVector) { - tolerance = MinImpl(tolerance, (int)(Math::SQRT_TWO) * radius)); + tolerance = MinImpl(tolerance, (int)(Math::SQRT_TWO * radius)); // start from nearest count n that satisfy: d = sqrt(2) * r * sin(a) <= tolerance, a = 2 * pi / n - double maxRad = Math::asin(tolerance / (Math::SQRT_TWO) * radius)); + double maxRad = Math::asin(tolerance / (Math::SQRT_TWO * radius)); int n = (int)(Math::TWO_BY_PI / maxRad); // find n that satisfy d <= length, d = sqrt(2) * r * sin(a), a = 2 * pi / n diff --git a/src/Misc/Hooks.Otamaa.cpp b/src/Misc/Hooks.Otamaa.cpp index 77affe4ac..02775a908 100644 --- a/src/Misc/Hooks.Otamaa.cpp +++ b/src/Misc/Hooks.Otamaa.cpp @@ -7426,7 +7426,7 @@ class NOVTABLE FakeIonBlastClass : public IonBlastClass const float uz = deltax * sinA - deltay * cosA; const float uy = deltaz; - float proj = Math::sqrtux * ux + uz * uz + uy * uy); + float proj = Math::sqrt(ux * ux + uz * uz + uy * uy); const float align = cosA * ux - sinA * proj; if (Math::abs(align - deltax) > 0.0002f || Math::abs(cosA * proj + sinA * ux - deltay) > 0.0002f) diff --git a/src/Phobos.Math.h b/src/Phobos.Math.h index a70370b8e..4776bae87 100644 --- a/src/Phobos.Math.h +++ b/src/Phobos.Math.h @@ -23,19 +23,19 @@ struct PhobosMath return std::atan2(a1, a2); } - static float __cdecl cosd(double a1) + static double __cdecl cosd(double a1) { - return (float)std::cos(a1); + return std::cos(a1); } - static float __cdecl sind(double a1) + static double __cdecl sind(double a1) { - return (float)std::sin(a1); + return std::sin(a1); } - static float __cdecl sqrtd(double a1) + static double __cdecl sqrtd(double a1) { - return (float)std::sqrt(a1); + return std::sqrt(a1); } static double __cdecl tand(double a1) @@ -44,43 +44,43 @@ struct PhobosMath } //=================================== - static double __cdecl acosf(float a1) + static float __cdecl acosf(float a1) { - return std::acos(a1); + return (float)std::acos(a1); } - static double __stdcall asinf(float a1) + static float __cdecl asinf(float a1) { - return std::asin(a1); + return (float)std::asin(a1); } - static double __stdcall atanf(float a1) + static float __cdecl atanf(float a1) { - return std::atan(a1); + return (float)std::atan(a1); } - static double __stdcall atan2f(float a1, float a2) + static float __cdecl atan2f(float a1, float a2) { - return std::atan2(a1, a2); + return (float)std::atan2(a1, a2); } - static double __cdecl cosf(float a1) + static float __cdecl cosf(float a1) { - return std::cos(a1); + return (float)std::cos(a1); } - static double __cdecl sinf(float a1) + static float __cdecl sinf(float a1) { - return std::sin(a1); + return (float)std::sin(a1); } - static double __cdecl sqrtf(float a1) + static float __cdecl sqrtf(float a1) { - return std::sqrt(a1); + return (float)std::sqrt(a1); } - static double __cdecl tanf(float a1) + static float __cdecl tanf(float a1) { - return std::tan(a1); + return (float)std::tan(a1); } }; \ No newline at end of file