Commit 22f94396 authored by Mike Kremer's avatar Mike Kremer

Fixed genus function to detect possible non-manifold configurations.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@235 66977474-1d4b-4f09-8fe9-267525286df2
parent 0f899ced
......@@ -226,11 +226,18 @@ public:
/// Get number of cells in mesh
virtual unsigned int n_cells() const { return cells_.size(); }
unsigned int genus() const {
return (1 - (n_vertices() -
int genus() const {
int g = (1 - (n_vertices() -
n_edges() +
n_faces() -
n_cells())/2.0);
n_cells()));
if(g % 2 == 0) return (g / 2);
// An error occured
// The mesh might not be manifold
return -1;
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment