diff --git a/modules/odm_25dmeshing/src/PlyInterpreter.cpp b/modules/odm_25dmeshing/src/PlyInterpreter.cpp index 888360f7..c8e7fc55 100644 --- a/modules/odm_25dmeshing/src/PlyInterpreter.cpp +++ b/modules/odm_25dmeshing/src/PlyInterpreter.cpp @@ -25,7 +25,11 @@ void PlyInterpreter::process_line(CGAL::Ply_reader& reader) { Point3 p(x, y, z); Vector3 n(nx, ny, nz); - zNormalsDirectionCount += nz >= 0 ? 1 : -1; + if (nz >= 0 && zNormalsDirectionCount < std::numeric_limits::max()){ + zNormalsDirectionCount++; + }else if (nz < 0 && zNormalsDirectionCount > std::numeric_limits::min()){ + zNormalsDirectionCount--; + } points.push_back(std::make_pair(p, n)); } diff --git a/modules/odm_25dmeshing/src/PlyInterpreter.hpp b/modules/odm_25dmeshing/src/PlyInterpreter.hpp index 79716fcc..f7b78478 100644 --- a/modules/odm_25dmeshing/src/PlyInterpreter.hpp +++ b/modules/odm_25dmeshing/src/PlyInterpreter.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,7 @@ typedef std::pair Pwn; class PlyInterpreter { std::vector& points; - int zNormalsDirectionCount; + long zNormalsDirectionCount; public: PlyInterpreter (std::vector& points)