Browse Source

merge:

Former-commit-id: 62a3c124c58aab42c701b7ab9a5b8284afc5d611
Alec Jacobson 10 years ago
parent
commit
72c6004123
91 changed files with 1104 additions and 117 deletions
  1. 1 1
      README.md
  2. 7 0
      include/igl/WindingNumberMethod.h
  3. 117 0
      include/igl/biharmonic_coordinates.cpp
  4. 77 0
      include/igl/biharmonic_coordinates.h
  5. 7 0
      include/igl/bone_parents.cpp
  6. 7 1
      include/igl/boolean/MeshBooleanType.h
  7. 7 0
      include/igl/boolean/from_cork_mesh.cpp
  8. 7 0
      include/igl/boolean/from_cork_mesh.h
  9. 7 0
      include/igl/boolean/mesh_boolean.cpp
  10. 7 0
      include/igl/boolean/mesh_boolean.h
  11. 7 0
      include/igl/boolean/mesh_boolean_cork.cpp
  12. 7 0
      include/igl/boolean/mesh_boolean_cork.h
  13. 7 0
      include/igl/boolean/to_cork_mesh.cpp
  14. 7 0
      include/igl/boolean/to_cork_mesh.h
  15. 7 0
      include/igl/cgal/order_facets_around_edges.cpp
  16. 7 1
      include/igl/cgal/order_facets_around_edges.h
  17. 7 0
      include/igl/cgal/outer_hull.cpp
  18. 7 0
      include/igl/cgal/outer_hull.h
  19. 7 0
      include/igl/cgal/peel_outer_hull_layers.cpp
  20. 7 0
      include/igl/cgal/peel_outer_hull_layers.h
  21. 7 0
      include/igl/collapse_small_triangles.cpp
  22. 7 0
      include/igl/comiso/frame_field.cpp
  23. 7 0
      include/igl/compile_and_link_program.cpp
  24. 7 0
      include/igl/compile_and_link_program.h
  25. 7 0
      include/igl/compile_shader.cpp
  26. 7 0
      include/igl/compile_shader.h
  27. 0 1
      include/igl/cotmatrix.cpp
  28. 7 0
      include/igl/deform_skeleton.cpp
  29. 7 0
      include/igl/deform_skeleton.h
  30. 7 0
      include/igl/deprecated.h
  31. 7 0
      include/igl/directed_edge_orientations.cpp
  32. 7 0
      include/igl/directed_edge_parents.cpp
  33. 7 0
      include/igl/exterior_edges.cpp
  34. 7 0
      include/igl/exterior_edges.h
  35. 1 1
      include/igl/face_occurrences.cpp
  36. 7 0
      include/igl/facet_components.cpp
  37. 7 0
      include/igl/facet_components.h
  38. 7 0
      include/igl/frustum.cpp
  39. 7 0
      include/igl/in_element.cpp
  40. 7 0
      include/igl/init_render_to_texture.cpp
  41. 7 0
      include/igl/init_render_to_texture.h
  42. 7 0
      include/igl/is_vertex_manifold.cpp
  43. 7 0
      include/igl/look_at.cpp
  44. 7 0
      include/igl/matlab/parse_rhs.cpp
  45. 7 0
      include/igl/matlab/parse_rhs.h
  46. 7 0
      include/igl/matlab/prepare_lhs.cpp
  47. 7 0
      include/igl/matlab/prepare_lhs.h
  48. 26 0
      include/igl/min_quad_with_fixed.cpp
  49. 16 1
      include/igl/min_quad_with_fixed.h
  50. 74 32
      include/igl/nchoosek.cpp
  51. 39 6
      include/igl/nchoosek.h
  52. 113 0
      include/igl/normal_derivative.cpp
  53. 44 0
      include/igl/normal_derivative.h
  54. 80 34
      include/igl/on_boundary.cpp
  55. 4 3
      include/igl/on_boundary.h
  56. 7 0
      include/igl/ortho.cpp
  57. 7 0
      include/igl/outer_facet.cpp
  58. 7 0
      include/igl/outer_facet.h
  59. 7 0
      include/igl/parula.cpp
  60. 7 0
      include/igl/per_edge_normals.cpp
  61. 7 0
      include/igl/planarize_quad_mesh.cpp
  62. 7 0
      include/igl/planarize_quad_mesh.h
  63. 7 0
      include/igl/project_isometrically_to_plane.cpp
  64. 7 0
      include/igl/quad_planarity.cpp
  65. 7 0
      include/igl/quad_planarity.h
  66. 7 0
      include/igl/random_quaternion.cpp
  67. 7 0
      include/igl/random_quaternion.h
  68. 0 4
      include/igl/slice.cpp
  69. 7 0
      include/igl/slice_mask.cpp
  70. 1 0
      include/igl/slice_mask.h
  71. 7 0
      include/igl/slice_tets.cpp
  72. 7 0
      include/igl/sort_angles.cpp
  73. 7 0
      include/igl/sort_angles.h
  74. 7 0
      include/igl/tga.h
  75. 7 0
      include/igl/triangle_fan.cpp
  76. 7 0
      include/igl/triangle_fan.h
  77. 7 0
      include/igl/triangles_from_strip.cpp
  78. 7 0
      include/igl/unique_edge_map.cpp
  79. 7 0
      include/igl/unique_edge_map.h
  80. 1 0
      include/igl/viewer/Viewer.cpp
  81. 7 0
      include/igl/winding_number.cpp
  82. 7 0
      include/igl/winding_number.h
  83. 7 0
      include/igl/writeWRL.cpp
  84. 7 0
      include/igl/writeWRL.h
  85. 1 1
      index.html
  86. 1 1
      libigl-logo.ai.REMOVED.git-id
  87. BIN
      libigl-logo.jpg
  88. 28 26
      optional/index.html
  89. 3 3
      scripts/update_gh-pages.sh
  90. BIN
      tutorial/images/libigl-logo.jpg
  91. 1 1
      tutorial/tutorial.md.REMOVED.git-id

+ 1 - 1
README.md

@@ -19,7 +19,7 @@ header file contains a single function (e.g. `igl/cotmatrix.h` contains
 stored in an n-by-3 matrix of vertex positions V and an m-by-3 matrix of
 triangle indices F. 
 
-_Optionally_ the library may also be [pre-compiled](build/) into a statically
+_Optionally_ the library may also be [pre-compiled](optional/) into a statically
 linked library, for faster compile times with your projects. This only effects
 compile time (run-time performance and behavior is identical). If in doubt, use
 the header-only default mode: (i.e. just include the headers you want to use).

+ 7 - 0
include/igl/WindingNumberMethod.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_WINDINGNUMBERMETHOD_H
 #define IGL_WINDINGNUMBERMETHOD_H
 namespace igl

+ 117 - 0
include/igl/biharmonic_coordinates.cpp

@@ -0,0 +1,117 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#include "biharmonic_coordinates.h"
+#include "cotmatrix.h"
+#include "massmatrix.h"
+#include "min_quad_with_fixed.h"
+#include "normal_derivative.h"
+#include "on_boundary.h"
+#include <Eigen/Sparse>
+
+template <
+  typename DerivedV,
+  typename DerivedT,
+  typename SType,
+  typename DerivedW>
+IGL_INLINE bool igl::biharmonic_coordinates(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedT> & T,
+  const std::vector<std::vector<SType> > & S,
+  Eigen::PlainObjectBase<DerivedW> & W)
+{
+  using namespace Eigen;
+  using namespace std;
+  // This is not the most efficient way to build A, but follows "Linear
+  // Subspace Design for Real-Time Shape Deformation" [Wang et al. 2015]. 
+  SparseMatrix<double> A;
+  {
+    SparseMatrix<double> N,Z,L,K,M;
+    normal_derivative(V,T,N);
+    Array<bool,Dynamic,1> I;
+    Array<bool,Dynamic,Dynamic> C;
+    on_boundary(T,I,C);
+    {
+      std::vector<Triplet<double> >ZIJV;
+      for(int t =0;t<T.rows();t++)
+      {
+        for(int f =0;f<T.cols();f++)
+        {
+          if(C(t,f))
+          {
+            const int i = t+f*T.rows();
+            for(int c = 1;c<T.cols();c++)
+            {
+              ZIJV.emplace_back(T(t,(f+c)%T.cols()),i,1);
+            }
+          }
+        }
+      }
+      Z.resize(V.rows(),N.rows());
+      Z.setFromTriplets(ZIJV.begin(),ZIJV.end());
+      N = (Z*N).eval();
+    }
+    cotmatrix(V,T,L);
+    K = N+L;
+    massmatrix(V,T,MASSMATRIX_TYPE_DEFAULT,M);
+    DiagonalMatrix<double,Dynamic> Minv = 
+      ((VectorXd)M.diagonal().array().inverse()).asDiagonal();
+    A = K.transpose() * (Minv * K);
+  }
+  // Vertices in point handles
+  const size_t mp = 
+    count_if(S.begin(),S.end(),[](const vector<int> & h){return h.size()==1;});
+  // number of region handles
+  const size_t r = S.size()-mp;
+  // Vertices in region handles
+  size_t mr = 0;
+  for(const auto & h : S)
+  {
+    if(h.size() > 1)
+    {
+      mr += h.size();
+    }
+  }
+  const size_t dim = T.cols()-1;
+  // Might as well be dense... I think...
+  MatrixXd J = MatrixXd::Zero(mp+mr,mp+r*(dim+1));
+  VectorXi b(mp+mr);
+  MatrixXd H(mp+r*(dim+1),dim);
+  {
+    int v = 0;
+    int c = 0;
+    for(int h = 0;h<S.size();h++)
+    {
+      if(S[h].size()==1)
+      {
+        H.row(c) = V.block(S[h][0],0,1,dim);
+        J(v,c++) = 1;
+        b(v) = S[h][0];
+        v++;
+      }else
+      {
+        assert(S[h].size() >= dim+1);
+        for(int p = 0;p<S[h].size();p++)
+        {
+          for(int d = 0;d<dim;d++)
+          {
+            J(v,c+d) = V(S[h][p],d);
+          }
+          J(v,c+dim) = 1;
+          b(v) = S[h][p];
+          v++;
+        }
+        H.block(c,0,dim+1,dim).setIdentity();
+        c+=dim+1;
+      }
+    }
+  }
+  // minimize    ½ W' A W' 
+  // subject to  W(b,:) = J
+  return min_quad_with_fixed(
+    A,VectorXd::Zero(A.rows()).eval(),b,J,{},VectorXd(),true,W);
+}

+ 77 - 0
include/igl/biharmonic_coordinates.h

@@ -0,0 +1,77 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_BIHARMONIC_COORDINATES_H
+#define IGL_BIHARMONIC_COORDINATES_H
+#include "igl_inline.h"
+#include <Eigen/Dense>
+#include <vector>
+namespace igl
+{
+  // Compute "discrete biharmonic generalized barycentric coordinates" as
+  // described in "Linear Subspace Design for Real-Time Shape Deformation"
+  // [Wang et al. 2015]. Not to be confused with "Bounded Biharmonic Weights
+  // for Real-Time Deformation" [Jacobson et al. 2011] or "Biharmonic
+  // Coordinates" (2D complex barycentric coordinates) [Weber et al. 2012].
+  // These weights minimize a discrete version of the squared Laplacian energy
+  // subject to positional interpolation constraints at selected vertices
+  // (point handles) and transformation interpolation constraints at regions
+  // (region handles).
+  //
+  // Templates:
+  //   HType  should be a simple index type e.g. `int`,`size_t`
+  // Inputs:
+  //   V  #V by dim list of mesh vertex positions
+  //   T  #T by dim+1 list of / triangle indices into V      if dim=2
+  //                          \ tetrahedron indices into V   if dim=3
+  //   S  #point-handles+#region-handles list of lists of selected vertices for
+  //     each handle. Point handles should have singleton lists and region
+  //     handles should have lists of size at least dim+1 (and these points
+  //     should be in general position).
+  // Outputs:
+  //   W  #V by #points-handles+(#region-handles * dim+1) matrix of weights so
+  //     that columns correspond to each handles generalized barycentric
+  //     coordinates (for point-handles) or animation space weights (for region
+  //     handles).
+  // returns true only on success
+  //
+  // Example:
+  //
+  //     MatrixXd W;
+  //     igl::biharmonic_coordinates(V,F,S,W);
+  //     const size_t dim = T.cols()-1;
+  //     MatrixXd H(W.cols(),dim);
+  //     {
+  //       int c = 0;
+  //       for(int h = 0;h<S.size();h++)
+  //       {
+  //         if(S[h].size()==1)
+  //         {
+  //           H.row(c++) = V.block(S[h][0],0,1,dim);
+  //         }else
+  //         {
+  //           H.block(c,0,dim+1,dim).setIdentity();
+  //           c+=dim+1;
+  //         }
+  //       }
+  //     }
+  //     assert( (V-(W*H)).array().maxCoeff() < 1e-7 );
+  template <
+    typename DerivedV,
+    typename DerivedT,
+    typename SType,
+    typename DerivedW>
+  IGL_INLINE bool biharmonic_coordinates(
+    const Eigen::PlainObjectBase<DerivedV> & V,
+    const Eigen::PlainObjectBase<DerivedT> & T,
+    const std::vector<std::vector<SType> > & S,
+    Eigen::PlainObjectBase<DerivedW> & W);
+};
+#  ifndef IGL_STATIC_LIBRARY
+#    include "biharmonic_coordinates.cpp"
+#  endif
+#endif

+ 7 - 0
include/igl/bone_parents.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "bone_parents.h"
 
 template <typename DerivedBE, typename DerivedP>

+ 7 - 1
include/igl/boolean/MeshBooleanType.h

@@ -1,6 +1,12 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BOOLEAN_MESH_BOOLEAN_TYPE_H
 #define IGL_BOOLEAN_MESH_BOOLEAN_TYPE_H
-
 namespace igl
 {
   namespace boolean

+ 7 - 0
include/igl/boolean/from_cork_mesh.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_NO_CORK
 #include "from_cork_mesh.h"
 

+ 7 - 0
include/igl/boolean/from_cork_mesh.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BOOLEAN_FROM_CORK_MESH_H
 #define IGL_BOOLEAN_FROM_CORK_MESH_H
 #ifndef IGL_NO_CORK

+ 7 - 0
include/igl/boolean/mesh_boolean.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "mesh_boolean.h"
 #include <igl/per_face_normals.h>
 #include <igl/cgal/peel_outer_hull_layers.h>

+ 7 - 0
include/igl/boolean/mesh_boolean.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BOOLEAN_MESH_BOOLEAN_H
 #define IGL_BOOLEAN_MESH_BOOLEAN_H
 

+ 7 - 0
include/igl/boolean/mesh_boolean_cork.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_NO_CORK
 #include "mesh_boolean_cork.h"
 #include "to_cork_mesh.h"

+ 7 - 0
include/igl/boolean/mesh_boolean_cork.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BOOLEAN_MESH_BOOLEAN_CORK_H
 #define IGL_BOOLEAN_MESH_BOOLEAN_CORK_H
 #ifndef IGL_NO_CORK

+ 7 - 0
include/igl/boolean/to_cork_mesh.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_NO_CORK
 #include "to_cork_mesh.h"
 template <

+ 7 - 0
include/igl/boolean/to_cork_mesh.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BOOLEAN_TO_CORK_MESH_H
 #define IGL_BOOLEAN_TO_CORK_MESH_H
 #ifndef IGL_NO_CORK

+ 7 - 0
include/igl/cgal/order_facets_around_edges.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "order_facets_around_edges.h"
 #include "../sort_angles.h"
 #include <type_traits>

+ 7 - 1
include/igl/cgal/order_facets_around_edges.h

@@ -1,6 +1,12 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_CGAL_ORDER_FACETS_AROUND_EDGES_H
 #define IGL_CGAL_ORDER_FACETS_AROUND_EDGES_H
-
 #include "../igl_inline.h"
 #include <Eigen/Core>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>

+ 7 - 0
include/igl/cgal/outer_hull.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "outer_hull.h"
 #include "order_facets_around_edges.h"
 #include "../outer_facet.h"

+ 7 - 0
include/igl/cgal/outer_hull.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_CGAL_OUTER_HULL_H
 #define IGL_CGAL_OUTER_HULL_H
 #include "../igl_inline.h"

+ 7 - 0
include/igl/cgal/peel_outer_hull_layers.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "peel_outer_hull_layers.h"
 #include "../per_face_normals.h"
 #include "outer_hull.h"

+ 7 - 0
include/igl/cgal/peel_outer_hull_layers.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_CGAL_PEEL_OUTER_HULL_LAYERS_H
 #define IGL_CGAL_PEEL_OUTER_HULL_LAYERS_H
 #include "../igl_inline.h"

+ 7 - 0
include/igl/collapse_small_triangles.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "collapse_small_triangles.h"
 
 #include "bounding_box_diagonal.h"

+ 7 - 0
include/igl/comiso/frame_field.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "frame_field.h"
 
 #include <igl/triangle_triangle_adjacency.h>

+ 7 - 0
include/igl/compile_and_link_program.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "compile_and_link_program.h"
 #include "compile_shader.h"
 #include "report_gl_error.h"

+ 7 - 0
include/igl/compile_and_link_program.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_COMPILE_AND_LINK_PROGRAM_H
 #define IGL_COMPILE_AND_LINK_PROGRAM_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/compile_shader.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "compile_shader.h"
 #include "report_gl_error.h"
 #include <iostream>

+ 7 - 0
include/igl/compile_shader.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_COMPILE_SHADER_H
 #define IGL_COMPILE_SHADER_H
 #include "OpenGL_convenience.h"

+ 0 - 1
include/igl/cotmatrix.cpp

@@ -14,7 +14,6 @@
 
 // Bug in unsupported/Eigen/SparseExtra needs iostream first
 #include <iostream>
-#include <unsupported/Eigen/SparseExtra>
 
 template <typename DerivedV, typename DerivedF, typename Scalar>
 IGL_INLINE void igl::cotmatrix(

+ 7 - 0
include/igl/deform_skeleton.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "deform_skeleton.h"
 void igl::deform_skeleton(
   const Eigen::MatrixXd & C,

+ 7 - 0
include/igl/deform_skeleton.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_DEFORM_SKELETON_H
 #define IGL_DEFORM_SKELETON_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/deprecated.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_DEPRECATED_H
 #define IGL_DEPRECATED_H
 // Macro for marking a function as deprecated.

+ 7 - 0
include/igl/directed_edge_orientations.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "directed_edge_orientations.h"
 
 template <typename DerivedC, typename DerivedE>

+ 7 - 0
include/igl/directed_edge_parents.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "directed_edge_parents.h"
 #include "slice_into.h"
 #include "slice.h"

+ 7 - 0
include/igl/exterior_edges.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "exterior_edges.h"
 #include "all_edges.h"
 #include "sort.h"

+ 7 - 0
include/igl/exterior_edges.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_EXTERIOR_EDGES_H
 #define IGL_EXTERIOR_EDGES_H
 #include "igl_inline.h"

+ 1 - 1
include/igl/face_occurrences.cpp

@@ -36,7 +36,7 @@ IGL_INLINE void igl::face_occurrences(
     {
       // increment count
       counts[sortedF[i]]++;
-      assert(counts[sortedF[i]] == 2);
+      assert(counts[sortedF[i]] == 2 && "Input should be manifold");
     }
   }
 

+ 7 - 0
include/igl/facet_components.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "facet_components.h"
 #include <igl/triangle_triangle_adjacency.h>
 #include <vector>

+ 7 - 0
include/igl/facet_components.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef FACET_COMPONENTS_H
 #define FACET_COMPONENTS_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/frustum.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "frustum.h"
 template < typename DerivedP>
 IGL_INLINE void igl::frustum(

+ 7 - 0
include/igl/in_element.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "in_element.h"
 
 template <typename DerivedV, typename DerivedQ, int DIM>

+ 7 - 0
include/igl/init_render_to_texture.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "init_render_to_texture.h"
 #include <cassert>
 

+ 7 - 0
include/igl/init_render_to_texture.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_INIT_RENDER_TO_TEXTURE_H
 #define IGL_INIT_RENDER_TO_TEXTURE_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/is_vertex_manifold.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "is_vertex_manifold.h"
 #include "triangle_triangle_adjacency.h"
 #include "vertex_triangle_adjacency.h"

+ 7 - 0
include/igl/look_at.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "look_at.h"
 
 template <

+ 7 - 0
include/igl/matlab/parse_rhs.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "parse_rhs.h"
 #include <algorithm>
 

+ 7 - 0
include/igl/matlab/parse_rhs.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_MATLAB_PARSE_RHS_H
 #define IGL_MATLAB_PARSE_RHS_H
 #include <igl/igl_inline.h>

+ 7 - 0
include/igl/matlab/prepare_lhs.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "prepare_lhs.h"
 #include <algorithm>
 template <typename DerivedV>

+ 7 - 0
include/igl/matlab/prepare_lhs.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_MATLAB_PREPARE_LHS_H
 #define IGL_MATLAB_PREPARE_LHS_H
 #include <igl/igl_inline.h>

+ 26 - 0
include/igl/min_quad_with_fixed.cpp

@@ -64,6 +64,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
   assert((kr == 0 || known.maxCoeff() < n) && "known indices should be in [0,n)");
   assert(neq <= n && "Number of equality constraints should be less than DOFs");
 
+
   // cache known
   data.known = known;
   // get list of unknown indices
@@ -539,6 +540,31 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
   return min_quad_with_fixed_solve(data,B,Y,Beq,Z,sol);
 }
 
+template <
+  typename T,
+  typename Derivedknown,
+  typename DerivedB,
+  typename DerivedY,
+  typename DerivedBeq,
+  typename DerivedZ>
+IGL_INLINE bool igl::min_quad_with_fixed(
+  const Eigen::SparseMatrix<T>& A,
+  const Eigen::PlainObjectBase<DerivedB> & B,
+  const Eigen::PlainObjectBase<Derivedknown> & known,
+  const Eigen::PlainObjectBase<DerivedY> & Y,
+  const Eigen::SparseMatrix<T>& Aeq,
+  const Eigen::PlainObjectBase<DerivedBeq> & Beq,
+  const bool pd,
+  Eigen::PlainObjectBase<DerivedZ> & Z)
+{
+  min_quad_with_fixed_data<T> data;
+  if(!min_quad_with_fixed_precompute(A,known,Aeq,pd,data))
+  {
+    return false;
+  }
+  return min_quad_with_fixed_solve(data,B,Y,Beq,Z);
+}
+
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);

+ 16 - 1
include/igl/min_quad_with_fixed.h

@@ -100,7 +100,22 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedY> & Y,
     const Eigen::PlainObjectBase<DerivedBeq> & Beq,
     Eigen::PlainObjectBase<DerivedZ> & Z);
-
+  template <
+    typename T,
+    typename Derivedknown,
+    typename DerivedB,
+    typename DerivedY,
+    typename DerivedBeq,
+    typename DerivedZ>
+  IGL_INLINE bool min_quad_with_fixed(
+    const Eigen::SparseMatrix<T>& A,
+    const Eigen::PlainObjectBase<DerivedB> & B,
+    const Eigen::PlainObjectBase<Derivedknown> & known,
+    const Eigen::PlainObjectBase<DerivedY> & Y,
+    const Eigen::SparseMatrix<T>& Aeq,
+    const Eigen::PlainObjectBase<DerivedBeq> & Beq,
+    const bool pd,
+    Eigen::PlainObjectBase<DerivedZ> & Z);
 }
 
 template <typename T>

+ 74 - 32
include/igl/nchoosek.cpp

@@ -1,54 +1,96 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 //
-// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
+// Copyright (C) 2015 Olga Diamanti, Alec Jacobson
 //
 // 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/.
-
 #include "nchoosek.h"
+#include <cmath>
+#include <cassert>
 
-namespace igl {
-  class CombinationFinder
+IGL_INLINE double igl::nchoosek(const int n, const int k)
+{
+  if(k>n/2)
+  {
+    return nchoosek(n,n-k);
+  }else if(k==1)
   {
-  private:
-    std::vector<int> combinations;
-    void add(const std::vector<int>& v,
-             std::vector<std::vector<int> > &allCombs)
+    return n;
+  }else
+  {
+    double c = 1;
+    for(int i = 1;i<=k;i++)
     {
-      allCombs.push_back(v);
+      c *= (((double)n-k+i)/((double)i));
     }
+    return std::round(c);
+  }
+}
 
-  public:
-    void doCombs(int offset,
-                 int k,
-                 int N,
-                 std::vector<std::vector<int> > &allCombs)
+template < typename DerivedV, typename DerivedU>
+IGL_INLINE void igl::nchoosek(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const int k,
+  Eigen::PlainObjectBase<DerivedU> & U)
+{
+  using namespace Eigen;
+  if(V.size() == 0)
+  {
+    U.resize(0,k);
+    return;
+  }
+  assert((V.cols() == 1 || V.rows() == 1) && "V must be a vector");
+  U.resize(nchoosek(V.size(),k),k);
+  int running_i  = 0;
+  int running_j = 0;
+  Matrix<typename DerivedU::Scalar,1,Dynamic> running(1,k);
+  int N = V.size();
+  const std::function<void(int,int)> doCombs = 
+    [&running,&N,&doCombs,&running_i,&running_j,&U,&V](int offset, int k)
+  {
+    if(k==0)
     {
-      if (k == 0) {
-        add(combinations,allCombs);
-        return;
-      }
-      for (int i = offset; i <= N - k; ++i) {
-        combinations.push_back(i);
-        doCombs(i+1, k-1, N,allCombs);
-        combinations.pop_back();
-      }
+      U.row(running_i) = running;
+      running_i++;
+      return;
+    }
+    for (int i = offset; i <= N - k; ++i) 
+    {
+      running(running_j) = V(i);
+      running_j++;
+      doCombs(i+1,k-1);
+      running_j--;
     }
-
   };
-
-
+  doCombs(0,k);
 }
 
-IGL_INLINE void igl::nchoosek(int offset,
-                              int k,
-                              int N,
-                              std::vector<std::vector<int> > &allCombs)
+IGL_INLINE void igl::nchoosek(
+  int offset,
+  int k,
+  int N,
+  std::vector<std::vector<int> > &allCombs)
 {
-  CombinationFinder cmbf;
   allCombs.clear();
-  cmbf.doCombs(offset,k,N,allCombs);
+  std::vector<int> running;
+  const std::function<void(int,int)> doCombs = 
+    [&allCombs,&running,&N,&doCombs](int offset, int k)
+  {
+    if(k==0)
+    {
+      allCombs.push_back(running);
+      return;
+    }
+    for (int i = offset; i <= N - k; ++i) 
+    {
+      running.push_back(i);
+      doCombs(i+1,k-1);
+      running.pop_back();
+    }
+  };
+  doCombs(offset,k);
+
 }
 
 

+ 39 - 6
include/igl/nchoosek.h

@@ -1,6 +1,6 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 //
-// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
+// Copyright (C) 2015 Olga Diamanti, Alec Jacobson
 //
 // 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
@@ -9,15 +9,48 @@
 #ifndef IGL_NCHOOSEK
 #define IGL_NCHOOSEK
 #include "igl_inline.h"
+#include "deprecated.h"
 #include <vector>
 
 #include <Eigen/Core>
 
-namespace igl {
-  IGL_INLINE void nchoosek(int offset,
-                           int k,
-                           int N,
-                           std::vector<std::vector<int> > &allCombs);
+namespace igl 
+{
+  // NCHOOSEK  Like matlab's nchoosek.
+  //
+  // Inputs:
+  //   n  total number elements
+  //   k  size of sub-set to consider
+  // Returns number of k-size combinations out of the set [1,...,n]
+  IGL_INLINE double nchoosek(const int n, const int k);
+  // 
+  // Inputs:
+  //   V  n-long vector of elements
+  //   k  size of sub-set to consider
+  // Outputs:
+  //   U  nchoosek by k long matrix where each row is a unique k-size
+  //     combination
+  template < typename DerivedV, typename DerivedU>
+  IGL_INLINE void nchoosek(
+    const Eigen::PlainObjectBase<DerivedV> & V,
+    const int k,
+    Eigen::PlainObjectBase<DerivedU> & U);
+  // This version has a strange interface and confusing parameters. It seems to
+  // reproduce matlab's 
+  //
+  //     nchoosek(3:5,2) 
+  //
+  // Then one should use
+  //
+  //     igl::nchoosek(3,2,6,res);
+  //
+  IGL_INLINE 
+  IGL_DEPRECATED(
+  void nchoosek(
+    int offset,
+    int k,
+    int N,
+    std::vector<std::vector<int> > &allCombs));
 }
 
 

+ 113 - 0
include/igl/normal_derivative.cpp

@@ -0,0 +1,113 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#include "normal_derivative.h"
+#include "cotmatrix_entries.h"
+#include "slice.h"
+#include <cassert>
+
+template <
+  typename DerivedV, 
+  typename DerivedEle, 
+  typename Scalar>
+IGL_INLINE void igl::normal_derivative(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedEle> & Ele,
+  Eigen::SparseMatrix<Scalar>& DD)
+{
+  using namespace Eigen;
+  using namespace std;
+  // Element simplex-size 
+  const size_t ss = Ele.cols();
+  assert( ((ss==3) || (ss==4)) && "Only triangles or tets");
+  // cotangents
+  Matrix<Scalar,Dynamic,Dynamic> C;
+  cotmatrix_entries(V,Ele,C);
+  vector<Triplet<Scalar> > IJV;
+  // Number of elements
+  const size_t m = Ele.rows();
+  // Number of vertices
+  const size_t n = V.rows();
+  switch(ss)
+  {
+    default:
+      assert(false);
+      return;
+    case 4:
+    {
+      const MatrixXi DDJ = 
+        slice(
+          Ele,
+          (VectorXi(24)<<
+            1,0,2,0,3,0,2,1,3,1,0,1,3,2,0,2,1,2,0,3,1,3,2,3).finished(),
+          2);
+      MatrixXi DDI(m,24);
+      for(size_t f = 0;f<4;f++)
+      {
+        const auto & I = (VectorXi::LinSpaced(m,0,m-1).array()+f*m).eval();
+        for(size_t r = 0;r<6;r++)
+        {
+          DDI.col(f*6+r) = I;
+        }
+      }
+      const DiagonalMatrix<Scalar,24,24> S = 
+        (Matrix<Scalar,2,1>(1,-1).template replicate<12,1>()).asDiagonal();
+      Matrix<Scalar,Dynamic,Dynamic> DDV = 
+        slice(
+          C,
+          (VectorXi(24)<<
+            2,2,1,1,3,3,0,0,4,4,2,2,5,5,1,1,0,0,3,3,4,4,5,5).finished(),
+          2);
+      DDV *= S;
+
+      IJV.resize(DDV.size());
+      for(size_t f = 0;f<6*4;f++)
+      {
+        for(size_t e = 0;e<m;e++)
+        {
+          IJV.push_back(Triplet<Scalar>(DDI(e,f),DDJ(e,f),DDV(e,f)));
+        }
+      }
+      DD.resize(m*4,n);
+      DD.setFromTriplets(IJV.begin(),IJV.end());
+      break;
+    }
+    case 3:
+    {
+      const MatrixXi DDJ = 
+        slice(Ele,(VectorXi(12)<<2,0,1,0,0,1,2,1,1,2,0,2).finished(),2);
+      MatrixXi DDI(m,12);
+      for(size_t f = 0;f<3;f++)
+      {
+        const auto & I = (VectorXi::LinSpaced(m,0,m-1).array()+f*m).eval();
+        for(size_t r = 0;r<4;r++)
+        {
+          DDI.col(f*4+r) = I;
+        }
+      }
+      const DiagonalMatrix<Scalar,12,12> S = 
+        (Matrix<Scalar,2,1>(1,-1).template replicate<6,1>()).asDiagonal();
+      Matrix<Scalar,Dynamic,Dynamic> DDV = 
+        slice(C,(VectorXi(12)<<1,1,2,2,2,2,0,0,0,0,1,1).finished(),2);
+      DDV *= S;
+
+      IJV.resize(DDV.size());
+      for(size_t f = 0;f<12;f++)
+      {
+        for(size_t e = 0;e<m;e++)
+        {
+          IJV.push_back(Triplet<Scalar>(DDI(e,f),DDJ(e,f),DDV(e,f)));
+        }
+      }
+      DD.resize(m*3,n);
+      DD.setFromTriplets(IJV.begin(),IJV.end());
+      break;
+    }
+  }
+
+}
+

+ 44 - 0
include/igl/normal_derivative.h

@@ -0,0 +1,44 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_NORMAL_DERIVATIVE_H
+#define IGL_NORMAL_DERIVATIVE_H
+#include "igl_inline.h"
+
+#include <Eigen/Core>
+#include <Eigen/Sparse>
+namespace igl 
+{
+  // NORMAL_DERIVATIVE Computes the directional derivative **normal** to
+  // **all** (half-)edges of a triangle mesh (not just boundary edges). These
+  // are integrated along the edge: they're the per-face constant gradient dot
+  // the rotated edge vector (unit rotated edge vector for direction then
+  // magnitude for integration).
+  //
+  // Inputs:
+  //   V  #V by dim list of mesh vertex positions
+  //   F  #F by 3|4 list of triangle|tetrahedron indices into V
+  // Outputs:
+  //   DD  #F*3|4 by #V sparse matrix representing operator to compute
+  //     directional derivative with respect to each facet of each element.
+  //
+  template <
+    typename DerivedV, 
+    typename DerivedEle, 
+    typename Scalar>
+  IGL_INLINE void normal_derivative(
+    const Eigen::PlainObjectBase<DerivedV> & V,
+    const Eigen::PlainObjectBase<DerivedEle> & Ele,
+    Eigen::SparseMatrix<Scalar>& DD);
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "normal_derivative.cpp"
+#endif
+
+#endif
+

+ 80 - 34
include/igl/on_boundary.cpp

@@ -20,43 +20,89 @@ IGL_INLINE void igl::on_boundary(
   std::vector<std::vector<bool> > & C)
 {
   using namespace std;
-
-  // Get a list of all faces
-  vector<vector<IntegerT> > F(T.size()*4,vector<IntegerT>(3));
-  // Gather faces, loop over tets
-  for(int i = 0; i< (int)T.size();i++)
+  if(T.empty())
   {
-    assert(T[i].size() == 4);
-    // get face in correct order
-    F[i*4+0][0] = T[i][1];
-    F[i*4+0][1] = T[i][3];
-    F[i*4+0][2] = T[i][2];
-    // get face in correct order
-    F[i*4+1][0] = T[i][0];
-    F[i*4+1][1] = T[i][2];
-    F[i*4+1][2] = T[i][3];
-    // get face in correct order
-    F[i*4+2][0] = T[i][0];
-    F[i*4+2][1] = T[i][3];
-    F[i*4+2][2] = T[i][1];
-    // get face in correct order
-    F[i*4+3][0] = T[i][0];
-    F[i*4+3][1] = T[i][1];
-    F[i*4+3][2] = T[i][2];
+    I.clear();
+    C.clear();
+    return;
   }
-  // Counts
-  vector<int> FC;
-  face_occurrences(F,FC);
-  C.resize(T.size(),vector<bool>(4));
-  I.resize(T.size(),false);
-  for(int i = 0; i< (int)T.size();i++)
+
+  switch(T[0].size())
   {
-    for(int j = 0;j<4;j++)
+    case 3:
+    {
+      // Get a list of all faces
+      vector<vector<IntegerT> > F(T.size()*3,vector<IntegerT>(2));
+      // Gather faces, loop over tets
+      for(int i = 0; i< (int)T.size();i++)
+      {
+        assert(T[i].size() == 3);
+        // get face in correct order
+        F[i*3+0][0] = T[i][1];
+        F[i*3+0][1] = T[i][2];
+        F[i*3+1][0] = T[i][2];
+        F[i*3+1][1] = T[i][0];
+        F[i*3+2][0] = T[i][0];
+        F[i*3+2][1] = T[i][1];
+      }
+      // Counts
+      vector<int> FC;
+      face_occurrences(F,FC);
+      C.resize(T.size(),vector<bool>(3));
+      I.resize(T.size(),false);
+      for(int i = 0; i< (int)T.size();i++)
+      {
+        for(int j = 0;j<3;j++)
+        {
+          assert(FC[i*3+j] == 2 || FC[i*3+j] == 1);
+          C[i][j] = FC[i*3+j]==1;
+          // if any are on boundary set to true
+          I[i] = I[i] || C[i][j];
+        }
+      }
+      return;
+    }
+    case 4:
     {
-      assert(FC[i*4+j] == 2 || FC[i*4+j] == 1);
-      C[i][j] = FC[i*4+j]==1;
-      // if any are on boundary set to true
-      I[i] = I[i] || C[i][j];
+      // Get a list of all faces
+      vector<vector<IntegerT> > F(T.size()*4,vector<IntegerT>(3));
+      // Gather faces, loop over tets
+      for(int i = 0; i< (int)T.size();i++)
+      {
+        assert(T[i].size() == 4);
+        // get face in correct order
+        F[i*4+0][0] = T[i][1];
+        F[i*4+0][1] = T[i][3];
+        F[i*4+0][2] = T[i][2];
+        // get face in correct order
+        F[i*4+1][0] = T[i][0];
+        F[i*4+1][1] = T[i][2];
+        F[i*4+1][2] = T[i][3];
+        // get face in correct order
+        F[i*4+2][0] = T[i][0];
+        F[i*4+2][1] = T[i][3];
+        F[i*4+2][2] = T[i][1];
+        // get face in correct order
+        F[i*4+3][0] = T[i][0];
+        F[i*4+3][1] = T[i][1];
+        F[i*4+3][2] = T[i][2];
+      }
+      // Counts
+      vector<int> FC;
+      face_occurrences(F,FC);
+      C.resize(T.size(),vector<bool>(4));
+      I.resize(T.size(),false);
+      for(int i = 0; i< (int)T.size();i++)
+      {
+        for(int j = 0;j<4;j++)
+        {
+          assert(FC[i*4+j] == 2 || FC[i*4+j] == 1);
+          C[i][j] = FC[i*4+j]==1;
+          // if any are on boundary set to true
+          I[i] = I[i] || C[i][j];
+        }
+      }
+      return;
     }
   }
 
@@ -73,7 +119,7 @@ IGL_INLINE void igl::on_boundary(
   Eigen::PlainObjectBase<DerivedI>& I,
   Eigen::PlainObjectBase<DerivedC>& C)
 {
-  assert(T.cols() == 0 || T.cols() == 4);
+  assert(T.cols() == 0 || T.cols() == 4 || T.cols() == 3);
   using namespace std;
   using namespace Eigen;
   // Cop out: use vector of vectors version

+ 4 - 3
include/igl/on_boundary.h

@@ -17,16 +17,17 @@
 
 namespace igl
 {
-  // BOUNDARY_FACES Determine boundary faces of tetrahedra stored in T
+  // ON_BOUNDARY Determine boundary facets of mesh elements stored in T
   //
   // Templates:
   //   IntegerT  integer-value: i.e. int
   //   IntegerF  integer-value: i.e. int
   // Input:
-  //  T  tetrahedron index list, m by 4, where m is the number of tetrahedra
+  //  T  triangle|tetrahedron index list, m by 3|4, where m is the number of
+  //    elements
   // Output:
   //  I  m long list of bools whether tet is on boundary
-  //  C  m by 4 list of bools whether opposite face is on boundary
+  //  C  m by 3|4 list of bools whether opposite facet is on boundary
   //
   template <typename IntegerT>
   IGL_INLINE void on_boundary(

+ 7 - 0
include/igl/ortho.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "ortho.h"
 
 template < typename DerivedP>

+ 7 - 0
include/igl/outer_facet.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "outer_facet.h"
 #include "sort.h"
 #include "vertex_triangle_adjacency.h"

+ 7 - 0
include/igl/outer_facet.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_OUTER_FACET_H
 #define IGL_OUTER_FACET_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/parula.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "parula.h"
 
 

+ 7 - 0
include/igl/per_edge_normals.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "all_edges.h"
 #include "doublearea.h"
 #include "per_edge_normals.h"

+ 7 - 0
include/igl/planarize_quad_mesh.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "planarize_quad_mesh.h"
 #include "quad_planarity.h"
 #include <Eigen/Sparse>

+ 7 - 0
include/igl/planarize_quad_mesh.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_PLANARIZE_QUAD_MESH_H
 #define IGL_PLANARIZE_QUAD_MESH_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/project_isometrically_to_plane.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "project_isometrically_to_plane.h"
 #include "edge_lengths.h"
 

+ 7 - 0
include/igl/quad_planarity.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "quad_planarity.h"
 #include <Eigen/Geometry>
 

+ 7 - 0
include/igl/quad_planarity.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_QUAD_PLANARITY_H
 #define IGL_QUAD_PLANARITY_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/random_quaternion.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "random_quaternion.h"
 
 template <typename Scalar>

+ 7 - 0
include/igl/random_quaternion.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_RANDOM_QUATERNION_H
 #define IGL_RANDOM_QUATERNION_H
 #include "igl_inline.h"

+ 0 - 4
include/igl/slice.cpp

@@ -10,10 +10,6 @@
 
 #include <vector>
 
-// Bug in unsupported/Eigen/SparseExtra needs iostream first
-#include <iostream>
-#include <unsupported/Eigen/SparseExtra>
-
 template <typename T>
 IGL_INLINE void igl::slice(
   const Eigen::SparseMatrix<T>& X,

+ 7 - 0
include/igl/slice_mask.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "slice_mask.h"
 #include <cassert>
 

+ 1 - 0
include/igl/slice_mask.h

@@ -10,6 +10,7 @@
 #include "igl_inline.h"
 
 #include <Eigen/Sparse>
+#include <Eigen/Core>
 namespace igl
 {
   // Act like the matlab X(row_mask,col_mask) operator, where

+ 7 - 0
include/igl/slice_tets.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "slice_tets.h"
 #include <igl/sort.h>
 #include <igl/cat.h>

+ 7 - 0
include/igl/sort_angles.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "sort_angles.h"
 #include <algorithm>
 

+ 7 - 0
include/igl/sort_angles.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef SORT_ANGLES_H
 #define SORT_ANGLES_H
 

+ 7 - 0
include/igl/tga.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_TGA_H
 #define IGL_TGA_H
 #ifndef IGL_NO_OPENGL

+ 7 - 0
include/igl/triangle_fan.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "triangle_fan.h"
 #include "exterior_edges.h"
 #include "list_to_matrix.h"

+ 7 - 0
include/igl/triangle_fan.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_TRIANGLE_FAN_H
 #define IGL_TRIANGLE_FAN_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/triangles_from_strip.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "triangles_from_strip.h"
 #include <iostream>
 

+ 7 - 0
include/igl/unique_edge_map.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "unique_edge_map.h"
 #include "all_edges.h"
 #include "unique_simplices.h"

+ 7 - 0
include/igl/unique_edge_map.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_UNIQUE_EDGE_MAP_H
 #define IGL_UNIQUE_EDGE_MAP_H
 #include "igl_inline.h"

+ 1 - 0
include/igl/viewer/Viewer.cpp

@@ -34,6 +34,7 @@
 #include <Eigen/LU>
 
 #define GLFW_INCLUDE_GLU
+#define GLFW_INCLUDE_GLCOREARB
 #include <GLFW/glfw3.h>
 
 #include <cmath>

+ 7 - 0
include/igl/winding_number.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "winding_number.h"
 #include "WindingNumberAABB.h"
 

+ 7 - 0
include/igl/winding_number.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_WINDING_NUMBER_H
 #define IGL_WINDING_NUMBER_H
 #include "igl_inline.h"

+ 7 - 0
include/igl/writeWRL.cpp

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #include "writeWRL.h"
 #include <iostream>
 #include <fstream>

+ 7 - 0
include/igl/writeWRL.h

@@ -1,3 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2015 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_WRITE_WRL_H
 #define IGL_WRITE_WRL_H
 #include "igl_inline.h"

+ 1 - 1
index.html

@@ -35,7 +35,7 @@ header file contains a single function (e.g. <code>igl/cotmatrix.h</code> contai
 stored in an n-by&#8211;3 matrix of vertex positions V and an m-by&#8211;3 matrix of
 triangle indices F. </p>
 
-<p><em>Optionally</em> the library may also be <a href="build/">pre-compiled</a> into a statically
+<p><em>Optionally</em> the library may also be <a href="optional/">pre-compiled</a> into a statically
 linked library, for faster compile times with your projects. This only effects
 compile time (run-time performance and behavior is identical). If in doubt, use
 the header-only default mode: (i.e. just include the headers you want to use).</p>

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

@@ -1 +1 @@
-f91b6a376761d6f0a5cc97bd4066d17775ba61dc
+2e28a844cc4816cdb363bc90d54f37dfa1a0a9e0

BIN
libigl-logo.jpg


+ 28 - 26
optional/index.html

@@ -16,9 +16,9 @@
 
 <blockquote>
 <p>Warning: compiling libigl as a static library is considerably more difficult
-than using it as a header-only library (see <code>../README.md</code> instead). Do it
-only if you are experienced with C++ and you want to improve your compilation
-times.</p>
+than using it as a header-only library (see <a href="../">../README.md</a> instead). Do
+it only if you are experienced with C++, cmake and make, and you want to
+improve your compilation times.</p>
 </blockquote>
 
 <p>Libigl is developed most often on Mac OS X, though has current users in Linux
@@ -30,36 +30,32 @@ and Windows.</p>
 building a project with libigl, since when used as an header-only library can
 slow down compile times.</p>
 
-<p>To build the entire libigl library producing <code>lib/libigl.a</code>, issue:</p>
+<p>To build the entire libigl library producing at least <code>libigl/lib/libigl.a</code> and
+possible other (automatically detected) extras, e.g. <code>libigl/lib/libiglcgal.a</code>
+from <em>this current directory</em>: issue:</p>
 
-<pre><code>cd build
-make lib
-</code></pre>
-
-<p>You may need to edit <code>Makefile.conf</code> accordingly. Best to give yourself an
-<code>IGL_USERNAME</code> and add a custom install suite for yourself. Then you can enable
-appropriate extras.</p>
-
-<h4 id="extras">Extras</h4>
-
-<p>Once you&#8217;ve set up an <code>IGL_USERNAME</code> and enabled extras within Makefile.conf.
-You can build the extra libraries (into <code>lib/ligiglpng.a</code>, <code>lib/libiglmatlab.a</code>,
-<code>lib/libigltetgen.a</code>, <code>lib/libiglmosek.a</code>, etc.) by issuing:</p>
-
-<pre><code>cd build
-make extras
+<pre><code>mkdir -p ../lib
+cd ../lib
+cmake -DCMAKE_BUILD_TYPE=Release ..
+make
 </code></pre>
 
 <h4 id="examples">Examples</h4>
 
 <p>You can make a slew of examples by issuing:</p>
 
-<pre><code>cd build
-make examples
+<pre><code>cd ../examples
+make
 </code></pre>
 
 <h4 id="external">External</h4>
 
+<blockquote>
+<p><strong>Deprecation notice</strong> All external libraries will be absorbed by libigl or
+moved to separate git sub-repositories in the near future. The following
+instructions are subject to immediate change.</p>
+</blockquote>
+
 <p>Finally there are a number of external libraries that we include in
 <code>./external/</code> because they are either difficult to obtain or they have been
 patched for easier use with libigl. Please see the respective readmes in those
@@ -67,7 +63,7 @@ directories.</p>
 
 <h5 id="installinganttweakbar">Installing AntTweakBar</h5>
 
-<p>To build the a static AntTweakBar library on Mac OS X issue:</p>
+<p>To build a static AntTweakBar library on Mac OS X issue:</p>
 
 <pre><code>cd external/AntTweakBar/src
 make -f Makefile.osx.igl
@@ -132,6 +128,11 @@ installed at <code>/usr/X11/lib</code>.</p>
 
 <h3 id="windowsexperimental">Windows (Experimental)</h3>
 
+<blockquote>
+<p><strong>Deprecation notice</strong> Windows users should run cmake on the <code>CMakeLists.txt</code>
+file in the current directory.</p>
+</blockquote>
+
 <p>To build a static library (.lib) on windows, open Visual Studio 2010.</p>
 
 <ul>
@@ -391,9 +392,10 @@ exposing templated functions.</li>
  <code>AntTweakBar</code>, <code>BLAS</code>). However, because all
  depencies other than Eigen should be encapsulated between
  <code>#ifndef</code> guards (e.g. <code>#ifndef IGL_NO_OPENGL</code>, it
- is possible to ignore certain functions that have such dependencies.</li>
- <li><strong>Long compile:</strong> Compiling <code>igl.cpp</code> takes a long time and isn&#8217;t easily parallelized (no <code>make -j12</code> equivalent).</li>
- </ul></p></li>
+ is possible to ignore certain functions that have such dependencies.</p></li>
+<li><p><strong>Long compile</strong>:
+ Compiling <code>igl.cpp</code> takes a long time and isn&#8217;t easily parallelized (no <code>make
+  -j12</code> equivalent).</p></li>
 </ul>
 
 <p>Here&#8217;s a tiny test example using <code>igl.h</code> and <code>igl.cpp</code>. Save the following in <code>test.cpp</code>:</p>

+ 3 - 3
scripts/update_gh-pages.sh

@@ -32,8 +32,8 @@ echo "$HEADER" \
   git commit -m "update google-soc/index.html to match google-soc/google-soc.md" google-soc/google-soc.md google-soc/index.html 
 
 echo "$HEADER" \
-  | cat - build/README.md | multimarkdown -o build/index.html && \
-  git commit -m "update index.html to match README.md" build/README.md \
-  build/index.html
+  | cat - optional/README.md | multimarkdown -o optional/index.html && \
+  git commit -m "update index.html to match README.md" optional/README.md \
+  optional/index.html
 
 git push origin gh-pages && git checkout master && git merge gh-pages && git push

BIN
tutorial/images/libigl-logo.jpg


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

@@ -1 +1 @@
-628b770ce18ce0b59a429488ecab9c9363b5be76
+c2c64bc4dca6502cf13e254fa512d9f9feca182f