diff --git a/pytorch3d/csrc/marching_cubes/marching_cubes_cpu.cpp b/pytorch3d/csrc/marching_cubes/marching_cubes_cpu.cpp index 3c801001..fb846618 100644 --- a/pytorch3d/csrc/marching_cubes/marching_cubes_cpu.cpp +++ b/pytorch3d/csrc/marching_cubes/marching_cubes_cpu.cpp @@ -86,8 +86,8 @@ std::tuple MarchingCubesCpu( } tri.clear(); ps.clear(); - } - } // endif + } // endif + } // endfor edge enumeration } // endfor x } // endfor y } // endfor z diff --git a/pytorch3d/csrc/marching_cubes/marching_cubes_utils.h b/pytorch3d/csrc/marching_cubes/marching_cubes_utils.h index 7d417a3a..7a952b07 100644 --- a/pytorch3d/csrc/marching_cubes/marching_cubes_utils.h +++ b/pytorch3d/csrc/marching_cubes/marching_cubes_utils.h @@ -310,13 +310,16 @@ struct Vertex { Vertex operator+(const Vertex& xyz) const { return Vertex(x + xyz.x, y + xyz.y, z + xyz.z); } - // The == operator overrides is used for checking degenerate triangles + // The =/!= operator overrides is used for checking degenerate triangles bool operator==(const Vertex& xyz) const { - if (std::abs(x - xyz.x) < EPS && std::abs(y - xyz.y) < EPS && - std::abs(z - xyz.z) < EPS) { - return true; - } - return false; + return ( + std::abs(x - xyz.x) < EPS && std::abs(y - xyz.y) < EPS && + std::abs(z - xyz.z) < EPS); + } + bool operator!=(const Vertex& xyz) const { + return ( + std::abs(x - xyz.x) >= EPS || std::abs(y - xyz.y) >= EPS || + std::abs(z - xyz.z) >= EPS); } // vertex position float x, y, z;