From 3330625ba6e84da8c6caf9f57406d27da6ca0e3e Mon Sep 17 00:00:00 2001 From: cignoni Date: Sat, 30 Jan 2016 23:05:51 +0000 Subject: [PATCH] Added a simple IsWaterTight method --- vcg/complex/algorithms/clean.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vcg/complex/algorithms/clean.h b/vcg/complex/algorithms/clean.h index 7d2e806c..2f1aee67 100644 --- a/vcg/complex/algorithms/clean.h +++ b/vcg/complex/algorithms/clean.h @@ -976,6 +976,19 @@ public: } return nonManifoldCnt; } + /// Very simple test of water tightness. No boundary and no non manifold edges. + /// Assume that it is orientable. + /// It could be debated if a closed non orientable surface is watertight or not. + /// + /// The rationale of not testing orientability here is that + /// it requires FFAdj while this test do not require any adjacency. + /// + static bool IsWaterTight(MeshType & m) + { + int edgeNum=0,edgeBorderNum=0,edgeNonManifNum=0; + CountEdgeNum(m, edgeNum, edgeBorderNum,edgeNonManifNum); + return (edgeBorderNum==0) && (edgeNonManifNum==0); + } static void CountEdgeNum( MeshType & m, int &total_e, int &boundary_e, int &non_manif_e ) {