Skip to content

Commit

Permalink
Add special case for MSVC output for GetNonManifoldEdges(), return em…
Browse files Browse the repository at this point in the history
…pty areas property if there are no triangles.
  • Loading branch information
ssheorey committed Jun 14, 2024
1 parent c33348b commit 6f2dd07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions cpp/open3d/t/geometry/TriangleMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ TriangleMesh &TriangleMesh::ComputeTriangleAreas() {
}

if (!HasTriangleIndices()) {
SetTriangleAttr("areas", core::Tensor::Empty({0}, GetVertexPositions().GetDtype(), GetDevice());
utility::LogWarning("TriangleMesh has no triangle indices.");
return *this;
}
Expand Down
14 changes: 9 additions & 5 deletions cpp/tests/t/geometry/TriangleMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,15 @@ TEST_P(TriangleMeshPermuteDevices, RemoveNonManifoldEdges) {
expected_edges = core::eigen_converter::EigenVector2iVectorToTensor(
legacy_mesh.GetNonManifoldEdges(true), core::Int64, device);
EXPECT_TRUE(mesh.GetNonManifoldEdges(true).AllClose(expected_edges));
expected_edges = core::eigen_converter::EigenVector2iVectorToTensor(
legacy_mesh.GetNonManifoldEdges(false), core::Int64, device);
std::cout << mesh.GetNonManifoldEdges(false).ToString() << std::endl;
std::cout << expected_edges.ToString() << std::endl;

#ifdef _MSC_VER
expected_edges = core::Tensor::Init<int64_t>(
{{0 8}, {1 8}, {0 1}, {6 7}, {0 2}, {0 4}, {2, 8}, {6 6}, {4 8}},
device);
#else
expected_edges = core::Tensor::Init<int64_t>(
{{0 8}, {1 8}, {0 1}, {6 7}, {0 2}, {0 4}, {6 6}, {4 8}, {2 8}},
device);
#endif
EXPECT_TRUE(mesh.GetNonManifoldEdges(false).AllClose(expected_edges));

mesh.RemoveNonManifoldEdges();
Expand Down

0 comments on commit 6f2dd07

Please sign in to comment.