Skip to content

Commit

Permalink
GRIDEDIT-779: fix sonarcloud warning
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasbuykx committed Nov 8, 2023
1 parent 2c94e2f commit 5ef5f50
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libs/MeshKernel/src/Polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ void RefineSegment(std::vector<meshkernel::Point>& refinedPolygon,

const double segmentLength = ComputeDistance(n0, n1, projection);

auto n = std::lround(std::round(segmentLength / refinementDistance));
if (n * refinementDistance > segmentLength ||
meshkernel::IsEqual(n * refinementDistance, segmentLength, meshkernel::constants::geometric::refinementTolerance))
int n = std::lround(segmentLength / refinementDistance);
const double refinedLength = n * refinementDistance;
if (refinedLength > segmentLength ||
meshkernel::IsEqual(refinedLength, segmentLength, meshkernel::constants::geometric::refinementTolerance))
--n;

// Refined segment step size.
Expand Down

0 comments on commit 5ef5f50

Please sign in to comment.