Răsfoiți Sursa

clean up some headers, auto doc and todos

Former-commit-id: 884d25f8467c84bb4caa47e0fb1a5d33a3d3c792
Alec Jacobson (jalec 12 ani în urmă
părinte
comite
166a191467

+ 4 - 1
include/igl/ReAntTweakBar.h

@@ -48,7 +48,10 @@
 namespace igl
 {
 
-  TwType ReTwDefineEnum(const char *name, const TwEnumVal *enumValues, unsigned int nbValues);
+  TwType ReTwDefineEnum(
+    const char *name, 
+    const TwEnumVal *enumValues, 
+    unsigned int nbValues);
   
   struct ReTwRWItem
   {

+ 30 - 18
include/igl/Timer.h

@@ -20,7 +20,8 @@ namespace igl
   class Timer
   {
   public:
-    Timer()                                     // default constructor
+    // default constructor
+    Timer()                       
     {
 #ifdef WIN32
       QueryPerformanceFrequency(&frequency);
@@ -36,7 +37,8 @@ namespace igl
       
       stopped = 0;
     }
-    ~Timer()                                   // default destructor
+    // default destructor
+    ~Timer()                     
     {
       
     }
@@ -62,7 +64,8 @@ namespace igl
     }
 #endif
     
-    void   start()                             // start timer
+    // start timer
+    void   start()               
     {
       stopped = 0; // reset stop flag
 #ifdef WIN32
@@ -75,7 +78,8 @@ namespace igl
       
     }
     
-    void   stop()                              // stop the timer
+    // stop the timer
+    void   stop()                
     {
       stopped = 1; // set timer stopped flag
       
@@ -88,20 +92,24 @@ namespace igl
 #endif
       
     }
-    double getElapsedTime()                    // get elapsed time in second
+    // get elapsed time in second
+    double getElapsedTime()      
     {
       return this->getElapsedTimeInSec();
     }
-    double getElapsedTimeInSec()               // get elapsed time in second (same as getElapsedTime)
+    // get elapsed time in second (same as getElapsedTime)
+    double getElapsedTimeInSec() 
     {
       return this->getElapsedTimeInMicroSec() * 0.000001;
     }
     
-    double getElapsedTimeInMilliSec()          // get elapsed time in milli-second
+    // get elapsed time in milli-second
+    double getElapsedTimeInMilliSec()
     {
       return this->getElapsedTimeInMicroSec() * 0.001;
     }
-    double getElapsedTimeInMicroSec()          // get elapsed time in micro-second
+    // get elapsed time in micro-second
+    double getElapsedTimeInMicroSec()          
     {
       double startTimeInMicroSec = 0;
       double endTimeInMicroSec = 0;
@@ -110,7 +118,8 @@ namespace igl
       if(!stopped)
         QueryPerformanceCounter(&endCount);
       
-      startTimeInMicroSec = startCount.QuadPart * (1000000.0 / frequency.QuadPart);
+      startTimeInMicroSec = 
+        startCount.QuadPart * (1000000.0 / frequency.QuadPart);
       endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
 #elif __APPLE__
       if (!stopped)
@@ -121,7 +130,8 @@ namespace igl
       if(!stopped)
         gettimeofday(&endCount, NULL);
       
-      startTimeInMicroSec = (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
+      startTimeInMicroSec = 
+        (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
       endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
 #endif
       
@@ -133,17 +143,19 @@ namespace igl
     
     
   private:
-    int    stopped;                             // stop flag 
+    // stop flag 
+    int    stopped;               
 #ifdef WIN32
-    LARGE_INTEGER frequency;                    // ticks per second
-    LARGE_INTEGER startCount;                   //
-    LARGE_INTEGER endCount;                     //
+    // ticks per second
+    LARGE_INTEGER frequency;      
+    LARGE_INTEGER startCount;     
+    LARGE_INTEGER endCount;       
 #elif __APPLE__
-    uint64_t startCount;                         //
-    uint64_t endCount;                           //
+    uint64_t startCount;           
+    uint64_t endCount;             
 #else
-    timeval startCount;                         //
-    timeval endCount;                           //
+    timeval startCount;           
+    timeval endCount;             
 #endif
   };
 }

+ 6 - 14
include/igl/grad.h

@@ -1,11 +1,3 @@
-//
-//  grad.h
-//  Preview3D
-//
-//  Created by Olga Diamanti on 11/11/11.
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
-//
-
 #ifndef IGL_GRAD_H
 #define IGL_GRAD_H
 #include "igl_inline.h"
@@ -27,14 +19,14 @@ namespace igl {
   //
   
   // Gradient of a scalar function defined on piecewise linear elements (mesh)
-  // is constant on each triangle i,j,k:
-  // grad(Xijk) = (Xj-Xi) * (Vi - Vk)^R90 / 2A + (Xk-Xi) * (Vj - Vi)^R90 / 2A
-  // where Xi is the scalar value at vertex i, Vi is the 3D position of vertex
-  // i, and A is the area of triangle (i,j,k). ^R90 represent a rotation of 
-  // 90 degrees
+  // is constant on each triangle i,j,k: grad(Xijk) = (Xj-Xi) * (Vi - Vk)^R90 /
+  // 2A + (Xk-Xi) * (Vj - Vi)^R90 / 2A where Xi is the scalar value at vertex
+  // i, Vi is the 3D position of vertex i, and A is the area of triangle
+  // (i,j,k). ^R90 represent a rotation of 90 degrees
   //
   template <typename T, typename S>
-  IGL_INLINE void grad(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
+  IGL_INLINE void grad(
+    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
     const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic> &F,
     const Eigen::Matrix<T, Eigen::Dynamic, 1>&X,
     Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &G );

+ 13 - 2
include/igl/is_border_vertex.h

@@ -12,9 +12,20 @@
 
 namespace igl 
 {
+  // Determine vertices on open boundary of a (manifold) mesh with triangle
+  // faces F
+  //
+  // Inputs:
+  //   V  #V by dim list of vertex positions 
+  //   F  #F by 3 list of triangle indices
+  // Returns vector of indices of vertices on open boundary of F
+  //
+  // Known Bugs: does not depend on V
+  // 
   template <typename DerivedV, typename DerivedF>
-  IGL_INLINE std::vector<bool> is_border_vertex(const Eigen::PlainObjectBase<DerivedV> &V,
-                                                const Eigen::PlainObjectBase<DerivedF> &F);
+  IGL_INLINE std::vector<bool> is_border_vertex(
+   const Eigen::PlainObjectBase<DerivedV> &V,
+   const Eigen::PlainObjectBase<DerivedF> &F);
 }
 
 #ifdef IGL_HEADER_ONLY

+ 3 - 1
include/igl/list_to_matrix.h

@@ -16,7 +16,9 @@ namespace igl
   //   M  an m by n matrix
   // Returns true on success, false on errors
   template <typename T, class Mat>
-  IGL_INLINE bool list_to_matrix(const std::vector<std::vector<T > > & V,Mat & M);
+  IGL_INLINE bool list_to_matrix(
+    const std::vector<std::vector<T > > & V,
+    Mat & M);
   // Vector wrapper
   template <typename T, class Mat>
   IGL_INLINE bool list_to_matrix(const std::vector<T > & V,Mat & M);

+ 26 - 27
include/igl/marching_cubes.h

@@ -1,8 +1,3 @@
-//
-//  marching_cubes.h
-//
-//  Created by Olga Diamanti on 05/03/12.
-
 #ifndef IGL_MARCHINGCUBES_H
 #define IGL_MARCHINGCUBES_H
 #include "igl_inline.h"
@@ -11,32 +6,36 @@
 namespace igl 
 {
   // marching_cubes( values, points, x_res, y_res, z_res, vertices, faces )
-  // performs marching cubes reconstruction on the grid defined by values, and points, and generates vertices and faces
+  //
+  // performs marching cubes reconstruction on the grid defined by values, and
+  // points, and generates vertices and faces
   //
   // Input:
-  //  xres, yres, zres: resolutions of the grid in x,y,z dimensions
-  //  
-  //  values: #number_of_grid_points x 1 array -- the scalar values of an implicit function defined on the grid points (<0 in the inside of the surface, 0 on the border, >0 outside)
-  //  
-  //  points: #number_of_grid_points x 3 array -- 3-D positions of the grid points, ordered in x,y,z order:
-  //  points[index] = the point at (x,y,z) where :
-  //  x = (index % (xres -1), 
-  //  y = (index / (xres-1)) %(yres-1),
-  //  z = index / (xres -1) / (yres -1) ).
-  //  where x,y,z index x, y, z dimensions
-  //  i.e. index = x + y*xres + z*xres*yres
-  //  
+  //  xres, yres, zres  resolutions of the grid in x,y,z dimensions
+  //  values  #number_of_grid_points x 1 array -- the scalar values of an
+  //    implicit function defined on the grid points (<0 in the inside of the
+  //    surface, 0 on the border, >0 outside)
+  //  points  #number_of_grid_points x 3 array -- 3-D positions of the grid
+  //    points, ordered in x,y,z order:
+  //      points[index] = the point at (x,y,z) where :
+  //      x = (index % (xres -1), 
+  //      y = (index / (xres-1)) %(yres-1),
+  //      z = index / (xres -1) / (yres -1) ).
+  //      where x,y,z index x, y, z dimensions
+  //      i.e. index = x + y*xres + z*xres*yres
   // Output:
-  // vertices,faces: mesh description (vertices and faces)
-  
+  //   vertices  #V by 3 list of mesh vertex positions
+  //   faces  #F by 3 list of mesh triangle indices
+  //
   template <typename DerivedV, typename DerivedF>
-  IGL_INLINE void marching_cubes(const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &values,
-                                 const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 3> &points,
-                                 const unsigned x_res,
-                                 const unsigned y_res,
-                                 const unsigned z_res,
-                                 Eigen::PlainObjectBase<DerivedV> &vertices,
-                                 Eigen::PlainObjectBase<DerivedF> &faces);
+  IGL_INLINE void marching_cubes(
+    const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &values,
+    const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 3> &points,
+    const unsigned x_res,
+    const unsigned y_res,
+    const unsigned z_res,
+    Eigen::PlainObjectBase<DerivedV> &vertices,
+    Eigen::PlainObjectBase<DerivedF> &faces);
 }
 
 #ifdef IGL_HEADER_ONLY

+ 5 - 12
include/igl/moveFV.h

@@ -1,11 +1,3 @@
-//
-//  moveFV.h
-//  Preview3D
-//
-//  Created by Olga Diamanti on 11/11/11.
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
-//
-
 #ifndef IGL_MOVEFV_H
 #define IGL_MOVEFV_H
 #include "igl_inline.h"
@@ -23,10 +15,11 @@ namespace igl
   // Output:
   // SV: scalar field defined on vertices
   template <typename T, typename I>
-  IGL_INLINE void moveFV(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
-              const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
-              const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
-              Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SV);
+  IGL_INLINE void moveFV(
+    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
+    const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
+    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
+    Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SV);
 }
 
 #ifdef IGL_HEADER_ONLY

+ 22 - 203
include/igl/mvc.h

@@ -1,214 +1,33 @@
-//
-//  mvc.h
-//
-//  Created by Olga Diamanti on 9/11/11.
-//  Copyright (c) 2011 ETH Zurich. All rights reserved.
-//
-
 #ifndef IGL_MVC_H
 #define IGL_MVC_H
 
-#include <Eigen/Core>
+#include "igl_inline.h"
+#include <Eigen/Dense>
 
 namespace igl 
 {
-//   MVC - MEAN VALUE COORDINATES
-//  
-//   mvc(V,C,W)
-//  
-//   Inputs:
-//    V  #V x dim list of vertex positions (dim = 2 or dim = 3)
-//    C  #C x dim list of polygon vertex positions in counter-clockwise order  (dim = 2 or dim = 3)
-//  
-//   Outputs:
-//    W  weights, #V by #C matrix of weights
-//  
-    
-  inline void mvc(const Eigen::MatrixXd &V, const Eigen::MatrixXd &C, Eigen::MatrixXd &W);
+  //   MVC - MEAN VALUE COORDINATES
+  //  
+  //   mvc(V,C,W)
+  //  
+  //   Inputs:
+  //    V  #V x dim list of vertex positions (dim = 2 or dim = 3)
+  //    C  #C x dim list of polygon vertex positions in counter-clockwise order
+  //      (dim = 2 or dim = 3)
+  //  
+  //   Outputs:
+  //    W  weights, #V by #C matrix of weights
+  //  
+  //  Known Bugs: implementation is listed as "Broken"
+  IGL_INLINE void mvc(
+    const Eigen::MatrixXd &V, 
+    const Eigen::MatrixXd &C, 
+    Eigen::MatrixXd &W);
   
 }
 
-// Broken Implementation
-inline void igl::mvc(const Eigen::MatrixXd &V, const Eigen::MatrixXd &C, Eigen::MatrixXd &W)
-{
-  
-  // at least three control points
-  assert(C.rows()>2);
-  
-  // dimension of points
-  assert(C.cols() == 3 || C.cols() == 2);
-  assert(V.cols() == 3 || V.cols() == 2);
-  
-  // number of polygon points
-  int num = C.rows();
-  
-  Eigen::MatrixXd V1,C1;
-  int i_prev, i_next;
-  
-  // check if either are 3D but really all z's are 0
-  bool V_flat = (V.cols() == 3) && (std::sqrt( (V.col(3)).dot(V.col(3)) ) < 1e-10);
-  bool C_flat = (C.cols() == 3) && (std::sqrt( (C.col(3)).dot(C.col(3)) ) < 1e-10);
-
-  // if both are essentially 2D then ignore z-coords
-  if((C.cols() == 2 || C_flat) && (V.cols() == 2 || V_flat))
-  {
-    // ignore z coordinate
-    V1 = V.block(0,0,V.rows(),2);
-    C1 = C.block(0,0,C.rows(),2);
-  }
-  else
-  {
-    // give dummy z coordinate to either mesh or poly
-    if(V.rows() == 2)
-    {
-      V1 = Eigen::MatrixXd(V.rows(),3);
-      V1.block(0,0,V.rows(),2) = V;
-    }
-    else
-      V1 = V;
-
-    if(C.rows() == 2)
-    {
-      C1 = Eigen::MatrixXd(C.rows(),3);
-      C1.block(0,0,C.rows(),2) = C;
-    }
-    else
-      C1 = C;
-
-    // check that C is planar
-    // average normal around poly corners
-
-    Eigen::Vector3d n = Eigen::Vector3d::Zero();
-    // take centroid as point on plane
-    Eigen::Vector3d p = Eigen::Vector3d::Zero();
-    for (int i = 0; i<num; ++i)
-    {
-      i_prev = (i>0)?(i-1):(num-1);
-      i_next = (i<num-1)?(i+1):0;
-      Eigen::Vector3d vnext = (C1.row(i_next) - C1.row(i)).transpose();
-      Eigen::Vector3d vprev = (C1.row(i_prev) - C1.row(i)).transpose();
-      n += vnext.cross(vprev);
-      p += C1.row(i);
-    }
-    p/=num;
-    n/=num;
-    // normalize n
-    n /= std::sqrt(n.dot(n));
-    
-    // check that poly is really coplanar
-    for (int i = 0; i<num; ++i)
-    {
-      double dist_to_plane_C = std::abs((C1.row(i)-p.transpose()).dot(n));
-      assert(dist_to_plane_C<1e-10);
-    }
-    
-    // check that poly is really coplanar
-    for (int i = 0; i<V1.rows(); ++i)
-    {
-      double dist_to_plane_V = std::abs((V1.row(i)-p.transpose()).dot(n));
-      if(dist_to_plane_V>1e-10)
-        std::cerr<<"Distance from V to plane of C is large..."<<std::endl;
-    }
-    
-    // change of basis
-    Eigen::Vector3d b1 = C1.row(1)-C1.row(0);
-    Eigen::Vector3d b2 = n.cross(b1);
-    // normalize basis rows
-    b1 /= std::sqrt(b1.dot(b1));
-    b2 /= std::sqrt(b2.dot(b2));
-    n /= std::sqrt(n.dot(n));
-    
-    //transpose of the basis matrix in the m-file
-    Eigen::Matrix3d basis = Eigen::Matrix3d::Zero();
-    basis.col(0) = b1;
-    basis.col(1) = b2;
-    basis.col(2) = n;
-    
-    // change basis of rows vectors by right multiplying with inverse of matrix
-    // with basis vectors as rows
-    Eigen::ColPivHouseholderQR<Eigen::Matrix3d> solver = basis.colPivHouseholderQr();
-    // Throw away coordinates in normal direction
-    V1 = solver.solve(V1.transpose()).transpose().block(0,0,V1.rows(),2);
-    C1 = solver.solve(C1.transpose()).transpose().block(0,0,C1.rows(),2);
-    
-  }
-  
-  // vectors from V to every C, where CmV(i,j,:) is the vector from domain
-  // vertex j to handle i
-  double EPSILON = 1e-10;
-  Eigen::MatrixXd WW = Eigen::MatrixXd(C1.rows(), V1.rows());
-  Eigen::MatrixXd dist_C_V (C1.rows(), V1.rows());
-  std::vector< std::pair<int,int> > on_corner(0);
-  std::vector< std::pair<int,int> > on_segment(0);
-  for (int i = 0; i<C1.rows(); ++i)
-  {
-    i_prev = (i>0)?(i-1):(num-1);
-    i_next = (i<num-1)?(i+1):0;
-    // distance from each corner in C to the next corner so that edge_length(i) 
-    // is the distance from C(i,:) to C(i+1,:) defined cyclically
-    double edge_length = std::sqrt((C1.row(i) - C1.row(i_next)).dot(C1.row(i) - C1.row(i_next)));
-    for (int j = 0; j<V1.rows(); ++j)
-    {
-      Eigen::VectorXd v = C1.row(i) - V1.row(j);
-      Eigen::VectorXd vnext = C1.row(i_next) - V1.row(j);
-      Eigen::VectorXd vprev = C1.row(i_prev) - V1.row(j);
-      // distance from V to every C, where dist_C_V(i,j) is the distance from domain
-      // vertex j to handle i
-      dist_C_V(i,j) = std::sqrt(v.dot(v));
-      double dist_C_V_next = std::sqrt(vnext.dot(vnext));
-      double a_prev = std::atan2(vprev[1],vprev[0]) - std::atan2(v[1],v[0]);
-      double a_next = std::atan2(v[1],v[0]) - std::atan2(vnext[1],vnext[0]);
-      // mean value coordinates
-      WW(i,j) = (std::tan(a_prev/2.0) + std::tan(a_next/2.0)) / dist_C_V(i,j);
-      
-      if (dist_C_V(i,j) < EPSILON)
-        on_corner.push_back(std::make_pair(j,i));
-      else
-        // only in case of no-corner (no need for checking for multiple segments afterwards --
-        // should only be on one segment (otherwise must be on a corner and we already
-        // handled that)
-        // domain vertex j is on the segment from i to i+1 if the distances from vj to
-        // pi and pi+1 are about 
-        if(abs((dist_C_V(i,j) + dist_C_V_next) / edge_length - 1) < EPSILON)
-          on_segment.push_back(std::make_pair(j,i));
-      
-    }
-  }
-  
-  // handle degenerate cases
-  // snap vertices close to corners
-  for (unsigned i = 0; i<on_corner.size(); ++i)
-  {
-    int vi = on_corner[i].first;
-    int ci = on_corner[i].second;
-    for (int ii = 0; ii<C.rows(); ++ii)
-      WW(ii,vi) = (ii==ci)?1:0;
-  }
-  
-  // snap vertices close to segments
-  for (unsigned i = 0; i<on_segment.size(); ++i)
-  {
-    int vi = on_segment[i].first;
-    int ci = on_segment[i].second;
-    int ci_next = (ci<num-1)?(ci+1):0;
-    for (int ii = 0; ii<C.rows(); ++ii)
-      if (ii == ci)
-        WW(ii,vi) = dist_C_V(ci_next,vi);
-      else
-      {
-        if ( ii == ci_next)
-          WW(ii,vi)  = dist_C_V(ci,vi);
-        else
-          WW(ii,vi) = 0;
-      }
-  }
-  
-  // normalize W
-  for (int i = 0; i<V.rows(); ++i)
-    WW.col(i) /= WW.col(i).sum();
-  
-  // we've made W transpose
-  W = WW.transpose();
-}
+#ifdef IGL_HEADER_ONLY
+#  include "mvc.cpp"
+#endif
 
 #endif

+ 26 - 45
include/igl/orth.h

@@ -1,55 +1,36 @@
-//
-//  orth.h
-//
-//  Created by Olga Diamanti on 9/11/11.
-//  Copyright (c) 2011 ETH Zurich. All rights reserved.
-//
-
 #ifndef IGL_ORTH_H
 #define IGL_ORTH_H
 
-#include <Eigen/Core>
+#include "igl_inline.h"
+#include <Eigen/Dense>
 
 namespace igl
 {
-//  ORTH   Orthogonalization.
-//     ORTH(A,Q) produces Q as an orthonormal basis for the range of A.
-//     That is, Q'*Q = I, the columns of Q span the same space as 
-//     the columns of A, and the number of columns of Q is the 
-//     rank of A.
-//  
-//  
-//   The algorithm  uses singular value decomposition, SVD, instead of orthogonal
-//   factorization, QR.  This doubles the computation time, but
-//   provides more reliable and consistent rank determination.
-//   Closely follows MATLAB implementation in orth.m
-//  
-  inline void orth(const Eigen::MatrixXd &A, Eigen::MatrixXd &Q);
+  //  ORTH   Orthogonalization.
+  //     ORTH(A,Q) produces Q as an orthonormal basis for the range of A.
+  //     That is, Q'*Q = I, the columns of Q span the same space as 
+  //     the columns of A, and the number of columns of Q is the 
+  //     rank of A.
+  //  
+  //  
+  //   The algorithm  uses singular value decomposition, SVD, instead of orthogonal
+  //   factorization, QR.  This doubles the computation time, but
+  //   provides more reliable and consistent rank determination.
+  //   Closely follows MATLAB implementation in orth.m
+  //
+  // Inputs:
+  //   A  m by n matrix 
+  // Outputs:
+  //   Q  m by n matrix with orthonormal columns spanning same column space as
+  //     A
+  //  
+  // Known bugs: Implementation listed as "Broken"
+  IGL_INLINE void orth(const Eigen::MatrixXd &A, Eigen::MatrixXd &Q);
 }
 
-// Broken Implementation
-inline void igl::orth(const Eigen::MatrixXd &A, Eigen::MatrixXd &Q)
-{
-
-  //perform svd on A = U*S*V' (V is not computed and only the thin U is computed)
-  Eigen::JacobiSVD<Eigen::MatrixXd> svd(A, Eigen::ComputeThinU );
-  Eigen::MatrixXd U = svd.matrixU();
-  const Eigen::VectorXd S = svd.singularValues();
-  
-  //get rank of A
-  int m = A.rows();
-  int n = A.cols();
-  double tol = std::max(m,n) * S.maxCoeff() *  2.2204e-16;
-  int r = 0;
-  for (int i = 0; i < S.rows(); ++r,++i)
-  {
-    if (S[i] < tol)
-      break;
-  }
-  
-  //keep r first columns of U
-  Q = U.block(0,0,U.rows(),r);
-  
-}
 
+#ifdef IGL_HEADER_ONLY
+#  include "orth.cpp"
+#endif
 #endif
+

+ 5 - 1
include/igl/per_corner_normals.h

@@ -22,7 +22,11 @@ namespace igl
     Eigen::PlainObjectBase<DerivedV> & CN);
   // Other Inputs:
   //   FN  #F by 3 eigen Matrix of face normals
-  template <typename DerivedV, typename DerivedF, typename DerivedFN, typename DerivedCN>
+  template <
+    typename DerivedV, 
+    typename DerivedF, 
+    typename DerivedFN, 
+    typename DerivedCN>
   IGL_INLINE void per_corner_normals(
     const Eigen::PlainObjectBase<DerivedV>& V,
     const Eigen::PlainObjectBase<DerivedF>& F,

+ 1 - 1
include/igl/plot_vector.h

@@ -12,7 +12,7 @@ namespace igl
   template <typename T>
   IGL_INLINE void plot_vector( std::vector< std::vector<T> >& v);
   template <typename T>
-  IGL_INLINE void plot_vector( std::vector< std::vector< std::vector<T> > >& v);
+  IGL_INLINE void plot_vector(std::vector< std::vector< std::vector<T> > >& v);
 }
 
 #ifdef IGL_HEADER_ONLY

+ 12 - 8
include/igl/readOBJ.h

@@ -86,15 +86,19 @@ namespace igl
   //
   // KNOWN BUG: The order of the attributes is different than the vector
   // version above
-  template <typename DerivedV, typename DerivedF, typename DerivedT, typename Index>
+  template <
+    typename DerivedV, 
+    typename DerivedF, 
+    typename DerivedT, 
+    typename Index>
   IGL_INLINE bool readOBJPoly(
-                          const std::string str,
-                          Eigen::PlainObjectBase<DerivedV>& V,
-                          std::vector<std::vector<Index> >& F,
-                          Eigen::PlainObjectBase<DerivedV>& CN,
-                          Eigen::PlainObjectBase<DerivedF>& FN,
-                          Eigen::PlainObjectBase<DerivedT>& TC,
-                          Eigen::PlainObjectBase<DerivedF>& FTC);
+    const std::string str,
+    Eigen::PlainObjectBase<DerivedV>& V,
+    std::vector<std::vector<Index> >& F,
+    Eigen::PlainObjectBase<DerivedV>& CN,
+    Eigen::PlainObjectBase<DerivedF>& FN,
+    Eigen::PlainObjectBase<DerivedT>& TC,
+    Eigen::PlainObjectBase<DerivedF>& FTC);
   
   //! Read a mesh from an ascii obj file
   // Inputs:

+ 1 - 0
include/igl/tga.h

@@ -1,5 +1,6 @@
 #ifndef IGL_TGA_H
 #define IGL_TGA_H
+// See license in tga.cpp
 
 /* tga.h - interface for TrueVision (TGA) image file loader */
 

+ 1 - 1
libigl-logo.ai.REMOVED.git-id

@@ -1 +1 @@
-5597d8f66455987af8aa792c6ee59337d39334e6
+5c9b812fab266e0514ca0792d6a071e38ab6907c

+ 3 - 2
readme.txt

@@ -1,5 +1,7 @@
 libigl - A simple c++ geometry processing library
 
+http://igl.ethz.ch/projects/libigl/
+
 Copyright 2013 - Alec Jacobson, Daniele Panozzo, Olga Diamanti, Kenshi
 Takayama, Leo Sacht, Interactive Geometry Lab - ETH Zurich
 
@@ -99,7 +101,7 @@ To get started, we advise that you take a look at a few examples:
   ./examples/ReAntTweakBar/
 
 = Development =
-Further documentation is listed for developers in tutorial.html,
+Further documentation for developers is listed in tutorial.html,
 style_guidelines.html
 
 = License =
@@ -113,7 +115,6 @@ Zip this directory without .hg litter using:
 make clean
 zip -9 -r --exclude=*.hg*  libigl.zip ../libigl
 
-
 = Contact =
 libigl is a group endeavor led by Alec Jacobson and Daniele Panozzo. Please
 contact alecjacobson@gmail.com if you have questions or comments. We are happy

+ 24 - 15
scripts/doc.sh

@@ -6,11 +6,14 @@
 
 echo "<html>"
 echo "  <head>"
-echo "    <title>IGL LIB documentation</title>"
+echo "    <title>libigl auto-documentation</title>"
 echo '    <link href="./style.css" rel="stylesheet" type="text/css">'
 echo "  </head>"
-echo "  <body>"
-echo "    <h1>IGL LIB</h1>"
+echo "  <body class=article_body>"
+echo "  <div class=article>"
+echo "    <a href=.><img src=libigl-logo.jpg alt='igl logo' class=center></a>"
+echo "    <h1>libigl</h1>"
+echo "    Automatically generated documentation for <a href=.>libigl</a>."
 echo "    <h2>Headers:</h2>"
 echo "    <table>"
 echo "      <tr><th>.h file</th><th>Functions</th></tr>"
@@ -19,22 +22,28 @@ odd="0"
 for h in include/igl/*.h;
 do
   b=`basename $h`
-  if [ -e $h ]
+  # only consider files that exist as proper .h/.cpp files (Those that don't
+  # are mostly utilitarian or poorly written)
+  if [ -e "${h%.h}.cpp" ]
   then
     printf "      <tr id='$b' class=d$odd><td>$b</td>"
+    # portion of file inside namespace 
+    html_nsp=`cat $h | \
+      perl -ne 'BEGIN{$p = 0} $o=$p;$p ^= $_=~"[{}]";print if $o && $p;' | \
+      sed -e "s/</\&lt;/g" | sed -e "s/>/\&gt;/g" | sed -e "s/%/%%/g" | \
+      sed -e "s/^\( *[^ \/].*\)$/<pre><code>\1<\/code><\/pre>/g" |  \
+      sed -e ':a' -e 'N' -e '$!ba' -e 's/<\/code><\/pre>\n<pre><code>/\\\n/g' | \
+      sed -e "s/^\(.*[^ ].*\)$/\1<br>/g"`;
+    printf "<td>$html_nsp</td>"
+    # Try to find functions and corresponding comments
+    echo "</tr>"
+    odd=`echo "($odd+1)%2" | bc`
   fi
-  # portion of file inside namespace 
-  html_nsp=`cat $h | \
-    perl -ne 'BEGIN{$p = 0} $o=$p;$p ^= $_=~"[{}]";print if $o && $p;' | \
-    sed -e "s/</\&lt;/g" | sed -e "s/>/\&gt;/g" | sed -e "s/%/%%/g" | \
-    sed -e "s/^\( *[^ \/].*\)$/<pre><code>\1<\/code><\/pre>/g" |  \
-    sed -e ':a' -e 'N' -e '$!ba' -e 's/<\/code><\/pre>\n<pre><code>/\\\n/g' | \
-    sed -e "s/^\(.*[^ ].*\)$/\1<br>/g"`;
-  printf "<td>$html_nsp</td>"
-  # Try to find functions and corresponding comments
-  echo "</tr>"
-  odd=`echo "($odd+1)%2" | bc`
 done
 
+echo "    </table>"
+echo "    <p>See also: <a href=tutorial.html>tutorial</a>, <a href=style_guidelines.html>style guidelines</a></p>"
+echo "    <p>Automatically generated on `date` by scripts/doc.sh.</p>"
+echo "  </div>"
 echo "  </body>"
 echo "</html>"

+ 20 - 0
style.css

@@ -119,3 +119,23 @@ img.center
   margin-left: auto;
   margin-right: auto;
 }
+
+.article_body
+{
+  margin: 0px;
+  padding: 0px;
+  text-align: center;
+  background-color: #bbb;
+}
+
+.article
+{
+  font-size: 14pt;
+  background-color: #fff;
+  margin:0px auto;
+  padding: 20px;
+  border-left: 1px solid #888;
+  border-right: 1px solid #888;
+  width: 960px;
+  text-align: left;
+}

+ 8 - 7
style_guidelines.html

@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
   <head>
-    <title>IGL LIB - Style Guidelines</title>
+    <title>libigl - Style Guidelines</title>
     <link href="./style.css" rel="stylesheet" type="text/css">
-  <body>
-    <img src=http://igl.ethz.ch/includes/images/logo-igl.gif alt="igl logo"
-    class=center>
-    <h1>igl_lib Style Guidelines</h1>
+  <body class=article_body>
+  <div class=article>
+    <a href=.><img src=libigl-logo.jpg alt="igl logo" class=center></a>
+    <h1>libigl Style Guidelines</h1>
     <p>
 This library is shared by many people. This document highlights some style
-guidelines for <i>developers</i> of the igl library.
+guidelines for <i>developers</i> of the <a href=.>libigl</a> library.
    </p>
    <p>
 Each function prototype should be well documented.  Write a summary of what
@@ -185,6 +185,7 @@ and outputs.
       </tr>
     </table>
 
-    <p>See also: <a href=tutorial.html>tutorial</a></p>
+    <p>See also: <a href=tutorial.html>tutorial</a>, <a href=doc.html>auto-documentation</a></p>
+  </div>
   </body>
 </html>

+ 10 - 2
todos.txt

@@ -1,6 +1,7 @@
 - compile on Linux, Mac OS X, Windows
 - unit tests for all functions
-- standardize name of library: IGL LIB, igl_lib, igl lib, IGL Library, etc.
+- standardize name of library "libigl", purge IGL LIB, igl_lib, igl lib, IGL
+    Library, etc.
 - clean up examples
 - standardize use of string/char *, add to style conventions
 - standardize Eigen Templates, add to style conventions
@@ -9,7 +10,14 @@
 + standardize igl includes #include "cotangent.h" or #include <cotangent.h>
 - implement an IGL_NO_OPENGL and IGL_NO_GLUT compiler option
 - clean up edgetopology.h
-- clean up mvc.h
++ clean up mvc.h
 - clean up orth.h
+- clean up and rename pos.h
 - fix bugs in examples/Core/example2.cpp
 - replace generic names read.h/write.h with something like read_poly_mesh.h
+- create libigltga extra
+- rename moveFV.h
+- is_border_vertex.h should not require V
+- consistent checks/asserts for: manifoldness, closedness, triangles-only
+    e.g. check_mesh(V,F,MANIFOLD | CLOSED | TRIANGLES_ONLY)
+- clean up Timer.h

+ 8 - 7
tutorial.html

@@ -1,14 +1,14 @@
 <html>
   <head>
-    <title>igl_lib tutorial</title>
+    <title>libigl developer tutorial</title>
     <link href="./style.css" rel="stylesheet" type="text/css">
   </head>
-  <body>
-    <img src=http://igl.ethz.ch/includes/images/logo-igl.gif alt="igl logo"
-    class=center>
-    <h1>Using the IGL library</h1>
+  <body class=article_body>
+    <div class=article>
+    <a href=.><img src=libigl-logo.jpg alt="igl logo" class=center></a>
+    <h1>Using the libigl library</h1>
     <p>
-      The igl lib is a collection of useful/reusable/sharable C++ functions
+      The <a href=.>libigl</a> library is a collection of useful/reusable/sharable C++ functions
       with very few external <a href="#dependencies">dependencies</a>. The
       library may be used as a <a href="#header_library">"headers only"
       library</a> or a <a href=#static_library>statically linked library</a>.
@@ -244,6 +244,7 @@ make
         href="matlab-to-eigen.html">Our own translation table</a> shows a list
         of common matlab functions and their igl-eigen equivalents.  
       </p>
-      <p>See also: <a href=style_guidelines.html>style guidlines</a></p>
+      <p>See also: <a href=style_guidelines.html>style guidlines</a>, <a href=doc.html>auto-documentation</a></p>
+  </div>
   </body>
 </html>