[core] Use constexpr when possible

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-10-24 08:36:38 +00:00
parent 936e05283c
commit 42f059f8f7
90 changed files with 258 additions and 259 deletions

View File

@@ -10,11 +10,11 @@ namespace df
namespace
{
double const kValidPathSplineTurn = 15 * math::pi / 180;
double const kCosTurn = cos(kValidPathSplineTurn);
double const kSinTurn = sin(kValidPathSplineTurn);
double const kRoundStep = 23;
int const kMaxStepsCount = 7;
double constexpr kValidPathSplineTurn = 15 * math::pi / 180;
double constexpr kCosTurn = cos(kValidPathSplineTurn);
double constexpr kSinTurn = sin(kValidPathSplineTurn);
double constexpr kRoundStep = 23;
int constexpr kMaxStepsCount = 7;
bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3, int leftStepsCount,
std::vector<m2::PointD> & roundedCorner)
@@ -31,7 +31,7 @@ bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const
return false;
double const vs = df::VisualParams::Instance().GetVisualScale();
double const kMinCornerDist = 1.0;
double constexpr kMinCornerDist = 1.0;
if ((p3 - p1).SquaredLength() < kMinCornerDist * vs)
{
roundedCorner.push_back(p1);
@@ -72,7 +72,7 @@ void ReplaceLastCorner(std::vector<m2::PointD> const & roundedCorner, m2::Spline
bool IsValidSplineTurn(m2::PointD const & normalizedDir1, m2::PointD const & normalizedDir2)
{
double const dotProduct = m2::DotProduct(normalizedDir1, normalizedDir2);
double const kEps = 1e-5;
double constexpr kEps = 1e-5;
return dotProduct > kCosTurn || fabs(dotProduct - kCosTurn) < kEps;
}