Skip to content

Commit 9df875b

Browse files
Jiali Duanfacebook-github-bot
Jiali Duan
authored andcommitted
Fix Circleci build failure: Add != operator for Marching Cubes Vertex struct
Summary: Fix Circleci error: https://app.circleci.com/pipelines/github/facebookresearch/pytorch3d/1066/workflows/94df137b-4882-4959-8fe4-738af447db23/jobs/56560. Reviewed By: kjchalup Differential Revision: D40185409 fbshipit-source-id: 7121b0cae66bd60f718df2a5d9ef5d2ac3bc658c
1 parent 73ba66e commit 9df875b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pytorch3d/csrc/marching_cubes/marching_cubes_cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ std::tuple<at::Tensor, at::Tensor> MarchingCubesCpu(
8686
}
8787
tri.clear();
8888
ps.clear();
89-
}
90-
} // endif
89+
} // endif
90+
} // endfor edge enumeration
9191
} // endfor x
9292
} // endfor y
9393
} // endfor z

pytorch3d/csrc/marching_cubes/marching_cubes_utils.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,16 @@ struct Vertex {
310310
Vertex operator+(const Vertex& xyz) const {
311311
return Vertex(x + xyz.x, y + xyz.y, z + xyz.z);
312312
}
313-
// The == operator overrides is used for checking degenerate triangles
313+
// The =/!= operator overrides is used for checking degenerate triangles
314314
bool operator==(const Vertex& xyz) const {
315-
if (std::abs(x - xyz.x) < EPS && std::abs(y - xyz.y) < EPS &&
316-
std::abs(z - xyz.z) < EPS) {
317-
return true;
318-
}
319-
return false;
315+
return (
316+
std::abs(x - xyz.x) < EPS && std::abs(y - xyz.y) < EPS &&
317+
std::abs(z - xyz.z) < EPS);
318+
}
319+
bool operator!=(const Vertex& xyz) const {
320+
return (
321+
std::abs(x - xyz.x) >= EPS || std::abs(y - xyz.y) >= EPS ||
322+
std::abs(z - xyz.z) >= EPS);
320323
}
321324
// vertex position
322325
float x, y, z;

0 commit comments

Comments
 (0)