Browse Source

Merge branch 'master' of https://github.com/olkido/libigl

Former-commit-id: 2b462e15589409a15355a81d978fa2a2cf1ca73b
Olga Diamanti 11 years ago
parent
commit
e262e0d718

+ 30 - 26
include/igl/is_edge_manifold.cpp

@@ -12,36 +12,40 @@
 template <typename DerivedV, typename DerivedF>
 IGL_INLINE bool igl::is_edge_manifold(const Eigen::PlainObjectBase<DerivedV>& /*V*/,
                                  const Eigen::PlainObjectBase<DerivedF>& F)
+{
+  // List of edges (i,j,f,c) where edge i<j is associated with corner i of face
+  // f
+  std::vector<std::vector<int> > TTT;
+  for(int f=0;f<F.rows();++f)
+    for (int i=0;i<3;++i)
+    {
+      // v1 v2 f ei 
+      int v1 = F(f,i);
+      int v2 = F(f,(i+1)%3);
+      if (v1 > v2) std::swap(v1,v2);
+      std::vector<int> r(4);
+      r[0] = v1; r[1] = v2;
+      r[2] = f;  r[3] = i;
+      TTT.push_back(r);
+    }
+  // Sort lexicographically
+  std::sort(TTT.begin(),TTT.end());
+  
+  for(int i=2;i<(int)TTT.size();++i)
   {
-    std::vector<std::vector<int> > TTT;
-    for(int f=0;f<F.rows();++f)
-      for (int i=0;i<3;++i)
-      {
-        // v1 v2 f ei 
-        int v1 = F(f,i);
-        int v2 = F(f,(i+1)%3);
-        if (v1 > v2) std::swap(v1,v2);
-        std::vector<int> r(4);
-        r[0] = v1; r[1] = v2;
-        r[2] = f;  r[3] = i;
-        TTT.push_back(r);
-      }
-    std::sort(TTT.begin(),TTT.end());
-    
-    for(int i=2;i<(int)TTT.size();++i)
+    // Check any edges occur 3 times
+    std::vector<int>& r1 = TTT[i-2];
+    std::vector<int>& r2 = TTT[i-1];
+    std::vector<int>& r3 = TTT[i];
+    if ( (r1[0] == r2[0] && r2[0] == r3[0]) 
+        && 
+        (r1[1] == r2[1] && r2[1] == r3[1]) )
     {
-      std::vector<int>& r1 = TTT[i-2];
-      std::vector<int>& r2 = TTT[i-1];
-      std::vector<int>& r3 = TTT[i];
-      if ( (r1[0] == r2[0] && r2[0] == r3[0]) 
-          && 
-          (r1[1] == r2[1] && r2[1] == r3[1]) )
-      {
-        return false;
-      }
+      return false;
     }
-    return true;
   }
+  return true;
+}
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization

+ 10 - 4
include/igl/is_edge_manifold.h

@@ -1,6 +1,6 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
 // 
 // This Source Code Form is subject to the terms of the Mozilla Public License 
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
@@ -16,13 +16,19 @@ namespace igl
 {
   // check if the mesh is edge-manifold
   //
-  // Not clear whether this returns true or false if the mesh is disc topology
+  // Inputs:
+  //   V  #V by dim list of mesh vertex positions **unneeded**
+  //   F  #F by 3 list of triangle indices
+  // Returns whether mesh is edge manifold.
   //
   // Known Bugs:
   //  Does not check for non-manifold vertices
+  //
+  // See also: is_vertex_manifold
   template <typename DerivedV, typename DerivedF>
-  IGL_INLINE bool is_edge_manifold(const Eigen::PlainObjectBase<DerivedV>& V,
-                              const Eigen::PlainObjectBase<DerivedF>& F);
+  IGL_INLINE bool is_edge_manifold(
+    const Eigen::PlainObjectBase<DerivedV>& V,
+    const Eigen::PlainObjectBase<DerivedF>& F);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 1
tutorial/104_Colors/main.cpp

@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
   igl::Viewer viewer;
   viewer.data.set_mesh(V, F);
 
-  // Use the x coordinate as a scalar field over the surface
+  // Use the z coordinate as a scalar field over the surface
   Eigen::VectorXd Z = V.col(2);
 
   // Compute per-vertex colors

+ 1 - 1
tutorial/205_Laplacian/main.cpp

@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
     // Send new positions, update normals, recenter
     viewer.data.set_vertices(U);
     viewer.data.compute_normals();
-    viewer.core.align_camera_center(V,F);
+    viewer.core.align_camera_center(U,F);
     return true;
   };
 

+ 1 - 1
tutorial/tutorial.html.REMOVED.git-id

@@ -1 +1 @@
-20f3975c0976fa57c0738e4480fec3c8ebc5e76e
+7c2e6ed8a0789197fdaae35c8a1cbd5f502f3c53

+ 1 - 1
tutorial/tutorial.md.REMOVED.git-id

@@ -1 +1 @@
-5f61531817bab4818c62fbfa4488937e8404c2fb
+42ca9d25da0463896cb835b63fd76d862ebe0e48