Bläddra i källkod

cleanup

Former-commit-id: 0723040a06922673cfb7a51f56a1b6597fea08bc
Daniele Panozzo 11 år sedan
förälder
incheckning
e421bba4f7
2 ändrade filer med 43 tillägg och 50 borttagningar
  1. 11 11
      include/igl/add_barycenter.h
  2. 32 39
      include/igl/pos.h

+ 11 - 11
include/igl/add_barycenter.h

@@ -1,32 +1,32 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 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 
+//
+// 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
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DUAL_MESH_LIST_H
-#define IGL_DUAL_MESH_LIST_H
+#ifndef IGL_ADD_BARYCENTER_H
+#define IGL_ADD_BARYCENTER_H
 #include "igl_inline.h"
 
 #include <Eigen/Dense>
 
-namespace igl 
+namespace igl
 {
   // Refine the mesh by adding the barycenter of each face
   // Inputs:
   //   V       #V by 3 coordinates of the vertices
   //   F       #F by 3 list of mesh faces (must be triangles)
-  // Outputs: 
+  // Outputs:
   //   VD      #V + #F by 3 coordinate of the vertices of the dual mesh
   //           The added vertices are added at the end of VD
   //   FD      #F*3 by 3 faces of the dual mesh
   //
   template <typename Scalar, typename Index>
   IGL_INLINE void add_barycenter(
-    const Eigen::PlainObjectBase<Scalar> & V, 
-    const Eigen::PlainObjectBase<Index> & F, 
-    Eigen::PlainObjectBase<Scalar> & VD, 
+    const Eigen::PlainObjectBase<Scalar> & V,
+    const Eigen::PlainObjectBase<Index> & F,
+    Eigen::PlainObjectBase<Scalar> & VD,
     Eigen::PlainObjectBase<Index> & FD);
 
 }

+ 32 - 39
include/igl/pos.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 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 
+//
+// Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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
 // obtain one at http://mozilla.org/MPL/2.0/.
 
 #ifndef IGL_POS_H
@@ -13,19 +13,15 @@
 
 #include <vector>
 
-namespace igl 
+namespace igl
 {
-  // Pos - Fake halfedge for fast and easy navigation on triangle meshes with VT and TT adj
-//template <typename S>
+  // Pos - Fake halfedge for fast and easy navigation on triangle meshes with VT and TT adjacency
   template <typename DerivedF>
   class Pos
   {
   public:
     // Init the pos by specifying Face,Edge Index and Orientation
-    Pos(
-//        const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* F,
-//        Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FF, 
-//        Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FFi, 
+    IGL_INLINE Pos(
         const Eigen::PlainObjectBase<DerivedF>* F,
         const Eigen::PlainObjectBase<DerivedF>* FF,
         const Eigen::PlainObjectBase<DerivedF>* FFi,
@@ -35,24 +31,24 @@ namespace igl
         )
     : F(F), FF(FF), FFi(FFi), fi(fi), ei(ei), reverse(reverse)
     {}
-    
+
     // Change Face
-    void flipF()
+    IGL_INLINE void flipF()
     {
       if (isBorder())
         return;
-      
+
       int fin = (*FF)(fi,ei);
       int ein = (*FFi)(fi,ei);
       int reversen = !reverse;
-      
+
       fi = fin;
       ei = ein;
       reverse = reversen;
     }
-    
+
     // Change Edge
-    void flipE()
+    IGL_INLINE void flipE()
     {
       if (!reverse)
         ei = (ei+2)%3; // ei-1
@@ -61,18 +57,18 @@ namespace igl
 
       reverse = !reverse;
     }
-    
+
     // Change Vertex
-    void flipV()
+    IGL_INLINE void flipV()
     {
       reverse = !reverse;
     }
-    
-    bool isBorder()
+
+    IGL_INLINE bool isBorder()
     {
       return (*FF)(fi,ei) == -1;
     }
-    
+
     /*!
      * Returns the next edge skipping the border
      *      _________
@@ -84,7 +80,7 @@ namespace igl
      * In this example, if a and d are of-border and the pos is iterating counterclockwise, this method iterate through the faces incident on vertex v,
      * producing the sequence a, b, c, d, a, b, c, ...
      */
-    bool NextFE()
+    IGL_INLINE bool NextFE()
     {
       if ( isBorder() ) // we are on a border
       {
@@ -103,37 +99,37 @@ namespace igl
         return true;
       }
     }
-    
+
     // Get vertex index
-    int Vi()
+    IGL_INLINE int Vi()
     {
       assert(fi >= 0);
       assert(fi < F->rows());
       assert(ei >= 0);
       assert(ei <= 2);
-      
+
       if (!reverse)
         return (*F)(fi,ei);
       else
         return (*F)(fi,(ei+1)%3);
     }
-    
+
     // Get face index
-    int Fi()
+    IGL_INLINE int Fi()
     {
       return fi;
     }
 
     // Get edge index
-    int Ei()
+    IGL_INLINE int Ei()
     {
       return ei;
     }
 
-    
-    bool operator==(Pos& p2)
+
+    IGL_INLINE bool operator==(Pos& p2)
     {
-      return 
+      return
       (
        (fi == p2.fi) &&
        (ei == p2.ei) &&
@@ -143,20 +139,17 @@ namespace igl
        (FFi == p2.FFi)
        );
     }
-    
+
   private:
     int fi;
     int ei;
     bool reverse;
-    
+
     const Eigen::PlainObjectBase<DerivedF>* F;
     const Eigen::PlainObjectBase<DerivedF>* FF;
     const Eigen::PlainObjectBase<DerivedF>* FFi;
-//    const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>*     F;
-//    const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>*     FF;
-//    const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>*     FFi;
   };
-  
+
 }
 
 #endif