title: Using assimp to load meshes, and detect boundary and non-manifold edges in them
body: <p>I'm trying to use assimp to load meshes in order to detect Non-Manifold and open (boundary) edges. I'm using the vertex indices that I get out of assimp in order to set up the relationships between vertices, edges, and faces. i have a face class that looks like this</p>
  
  <pre><code>#include "Face2.h"
  
  Face2::Face2()
  {
  }
  
  Face2::Face2(std::vector&lt;unsigned int&gt; indices)
  {
      m_indices = indices;
  }
  
  bool Face2::containsEdge(const Edge2 &amp;edge)
  {
  //    for(unsigned int i = 0; i &lt; m_indices.size(); i++)
  //    {
  //        if(edge.getStartIndex() == m_indices[i]){
  //            for(unsigned int i = 0; i &lt; m_indices.size(); i++)
  //            {
  //                edge.getEndIndex() == m_indices[i]
  //            }
  
  //        }
  //    }
      for(unsigned int i = 0; i &lt; m_indices.size(); i++)
      {
          if(edge.getStartIndex() == m_indices[i])
          {
              for(unsigned int j = 0; j &lt; m_indices.size(); j++)
              {
                  if(edge.getEndIndex() == m_indices[j]) return true;
              }
          }
      }
      return false;
  }
  
  std::vector&lt;unsigned int&gt; Face2::getIndices() const
  {
      return m_indices;
  }
  
  void Face2::setIndices(const std::vector&lt;unsigned int&gt; &amp;indices)
  {
      m_indices = indices;
  }
  </code></pre>
  
  <p>my edge class is basically just a data structure that holds the edge's start index and end index. 
  My mesh class contains a std::vector of faces and std::vector of edges that get populated like this:</p>
  
  <pre><code>for(unsigned int i = 0; i &lt; m_indices.size()-1; i+=2)
      {
          m_edges2.push_back(Edge2(m_indices[i], m_indices[i]));
      }
  
      for(unsigned int i = 0; i &lt; m_indices.size()-1; i+=3)
      {
          std::vector&lt;unsigned int&gt; faceData;
          faceData.push_back(m_indices[i]);
          faceData.push_back(m_indices[i+1]);
          faceData.push_back(m_indices[i+2]);
          m_faces2.push_back(Face2(faceData));
     }
  </code></pre>
  
  <p>my main function has this code:</p>
  
  <pre><code>    std::cout &lt;&lt; "Number of edges2: " &lt;&lt; m-&gt;getEdges2().size() &lt;&lt; std::endl;
      std::cout &lt;&lt; "Number of faces2: " &lt;&lt; m-&gt;getFaces2().size() &lt;&lt; std::endl;
      std::cout &lt;&lt; "finished " &lt;&lt; std::endl;
  
      unsigned int nonManif = 0;
      unsigned int boundary = 0;
  
      for(unsigned int i = 0; i &lt; m-&gt;getEdges2().size(); i++)
      {
          unsigned int edgeCount = 0;
          for(unsigned int j = 0; j &lt; m-&gt;getFaces2().size(); j++)
          {
              if(m-&gt;getFaces2().at(j).containsEdge(m-&gt;getEdges2().at(i)))
              {
                  edgeCount++;
              }
          }
  
          std::cout &lt;&lt; "Edge#" &lt;&lt; i &lt;&lt; " occurences: " &lt;&lt; edgeCount &lt;&lt; std::endl;
          if(edgeCount &gt; 2) nonManif++;
          else if(edgeCount &lt; 2) boundary++;
      }
  
      std::cout &lt;&lt; "Non-Manifold: " &lt;&lt; nonManif &lt;&lt; std::endl;
      std::cout &lt;&lt; "Boundary: " &lt;&lt; boundary &lt;&lt; std::endl;
  </code></pre>
  
  <p>I get the right number of edges and faces out of this.
  How ever the number of boundary edges varies a lot from what I get from meshlab for the same model. and the number of non manifold edges is always 0.</p>
  
  <p>Is their something wrong I'm doing, or is their a better way?</p>