Skip to content

Commit

Permalink
[Topology] Check indices out-of-bound in TriangleSetTopologyContainer (
Browse files Browse the repository at this point in the history
…#4242)

* Check that triangles index match the size of the triangleAroundVertexArray (Like it is done in EdgeSetTopologyContainer for EdgeAroundVertexArray)

* Fix some typos
  • Loading branch information
olivier-goury authored and bakpaul committed Feb 19, 2024
1 parent 5469837 commit 1ada9a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void EdgeSetTopologyContainer::createEdgesAroundVertexArray()

if (edge[0] >= unsigned(nbPoints) || edge[1] >= unsigned(nbPoints))
{
msg_warning() << "EdgesAroundVertex creation failed, Edge buffer is not concistent with number of points: Edge: " << edge << " for: " << nbPoints << " points.";
msg_warning() << "EdgesAroundVertex creation failed, Edge buffer is not consistent with number of points, Edge: " << edge << " for: " << nbPoints << " points.";
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ void TriangleSetTopologyContainer::createTrianglesAroundVertexArray()
m_trianglesAroundVertex.resize(getNbPoints());
for (size_t i = 0; i < m_triangle.size(); ++i)
{
if (m_triangle[i][0] >= getNbPoints() || m_triangle[i][1] >= getNbPoints() || m_triangle[i][2] >= getNbPoints())
{
msg_warning() << "trianglesAroundVertex creation failed, Triangle buffer is not consistent with number of points, Triangle: " << m_triangle[i] << " for: " << getNbPoints() << " points.";
continue;
}


// adding edge i in the edge shell of both points
for (unsigned int j=0; j<3; ++j)
m_trianglesAroundVertex[ m_triangle[i][j] ].push_back( (TriangleID)i );
Expand Down

0 comments on commit 1ada9a2

Please sign in to comment.