Skip to content

Commit

Permalink
Fix uninitialized ball.planar value
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcars committed Aug 10, 2023
1 parent 1f611a9 commit 2311224
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions palace/utils/geodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,14 +792,16 @@ BoundingBall BoundingBallFromPointCloud(MPI_Comm comm,
});

constexpr double planar_tolerance = 1e-9;
if (PerpendicularDistance({delta, n_radial}, out_of_plane) > planar_tolerance)

ball.planar = PerpendicularDistance({delta, n_radial}, out_of_plane) < planar_tolerance;
if (!ball.planar)
{
// The points are not functionally coplanar, zero out the normal.
Vector3dMap(ball.planar_normal.data()) *= 0;
MFEM_VERIFY(PerpendicularDistance({delta, n_radial}, out_of_plane) <= ball.radius,
"A point perpendicular must be contained in the ball");
ball.planar = true;
}

}

Mpi::Broadcast(3, ball.center.data(), dominant_rank, comm);
Expand Down

0 comments on commit 2311224

Please sign in to comment.