Skip to content

Commit

Permalink
viewshed.cpp: remove useless parentheses around std::min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 11, 2024
1 parent 2048869 commit a1d0a75
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions alg/viewshed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ inline static double CalcHeight(double dfZ, double dfZ2, GDALViewshedMode eMode)
if (eMode == GVM_Edge)
return dfZ2;
else if (eMode == GVM_Max)
return (std::max)(dfZ, dfZ2);
return std::max(dfZ, dfZ2);
else if (eMode == GVM_Min)
return (std::min)(dfZ, dfZ2);
return std::min(dfZ, dfZ2);
else
return dfZ;
}
Expand Down Expand Up @@ -285,13 +285,13 @@ GDALDatasetH GDALViewshedGenerate(
constexpr double EPSILON = 1e-8;
int nXStart =
dfMaxDistance > 0
? (std::max)(
? std::max(
0, static_cast<int>(std::floor(
nX - adfInvGeoTransform[1] * dfMaxDistance + EPSILON)))
: 0;
int nXStop =
dfMaxDistance > 0
? (std::min)(
? std::min(
nXSize,
static_cast<int>(
std::ceil(nX + adfInvGeoTransform[1] * dfMaxDistance -
Expand All @@ -300,17 +300,16 @@ GDALDatasetH GDALViewshedGenerate(
: nXSize;
int nYStart =
dfMaxDistance > 0
? (std::max)(
? std::max(
0, static_cast<int>(std::floor(
nY - std::fabs(adfInvGeoTransform[5]) * dfMaxDistance +
EPSILON)) -
(adfInvGeoTransform[5] > 0 ? 1 : 0))
: 0;
int nYStop =
dfMaxDistance > 0
? (std::min)(
nYSize,
static_cast<int>(std::ceil(nY +
? std::min(nYSize, static_cast<int>(
std::ceil(nY +
std::fabs(adfInvGeoTransform[5]) *
dfMaxDistance -
EPSILON) +
Expand Down

0 comments on commit a1d0a75

Please sign in to comment.