Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacarniato committed Oct 25, 2023
1 parent 1fd4f5b commit 5394b80
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libs/MeshKernel/src/Mesh2DIntersections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,17 @@ void Mesh2DIntersections::Compute(const std::vector<Point>& polyLine)
const auto polyLineSize = static_cast<UInt>(polyLine.size());

std::vector<double> cumulativeLength(polyLine.size(), 0.0);
std::vector<BoundingBox> polyLineBoundingBoxes(polyLine.size());
std::vector<BoundingBox> polyLineBoundingBoxes(polyLine.size() - 1);
for (UInt i = 1; i < polyLineSize; ++i)
{
cumulativeLength[i] = cumulativeLength[i - 1] + ComputeDistance(polyLine[i], polyLine[i - 1], m_mesh.m_projection);
polyLineBoundingBoxes[i] = BoundingBox(polyLine[i - 1], polyLine[i]);

const auto lowerLeftX = std::min(polyLine[i - 1].x, polyLine[i].x);
const auto lowerLeftY = std::min(polyLine[i - 1].y, polyLine[i].y);
const auto upperRightX = std::max(polyLine[i - 1].x, polyLine[i].x);
const auto upperRightY = std::max(polyLine[i - 1].y, polyLine[i].y);

polyLineBoundingBoxes[i - 1] = BoundingBox({lowerLeftX, lowerLeftY}, {upperRightX, upperRightY});
}

std::queue<std::array<UInt, 2>> crossingEdges;
Expand Down

0 comments on commit 5394b80

Please sign in to comment.