From 0666d4c9f0ce4486c97fa2555c31d733192b9b37 Mon Sep 17 00:00:00 2001 From: Chairn Date: Wed, 8 Jan 2025 21:00:13 +0100 Subject: [PATCH] Replace Cubicroot function with std::cbrt --- src/game/client/render_map.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/game/client/render_map.cpp b/src/game/client/render_map.cpp index b438d8b1e3b..c613bf8ae28 100644 --- a/src/game/client/render_map.cpp +++ b/src/game/client/render_map.cpp @@ -124,16 +124,6 @@ const CEnvPointBezier *CMapBasedEnvelopePointAccess::GetBezier(int Index) const return nullptr; } -static double CubicRoot(double x) -{ - if(x == 0.0) - return 0.0; - else if(x < 0.0) - return -std::exp(std::log(-x) / 3.0); - else - return std::exp(std::log(x) / 3.0); -} - static float SolveBezier(float x, float p0, float p1, float p2, float p3) { const double x3 = -p0 + 3.0 * p1 - 3.0 * p2 + p3; @@ -193,12 +183,12 @@ static float SolveBezier(float x, float p0, float p1, float p2, float p3) { // only one 'real' solution const double s = std::sqrt(D); - return CubicRoot(s - q) - CubicRoot(s + q) - sub; + return std::cbrt(s - q) - std::cbrt(s + q) - sub; } else if(D == 0.0) { // one single, one double solution or triple solution - const double s = CubicRoot(-q); + const double s = std::cbrt(-q); const double t = 2.0 * s - sub; if(0.0 <= t && t <= 1.0001)