Browse Source

Merge branch 'master' of github.com:libigl/libigl into gh-pages

Former-commit-id: 16fef5880076ab5408b2b0439c61c294185862c4
Alec Jacobson 9 years ago
parent
commit
fdb5fc0a77
100 changed files with 957 additions and 885 deletions
  1. 3 1
      .appveyor.yml
  2. 18 0
      .gitmodules
  3. 17 2
      .travis.yml
  4. 2 2
      README.md
  5. 3 0
      include/igl/AABB.h
  6. 23 0
      include/igl/MeshBooleanType.h
  7. 6 5
      include/igl/WindingNumberTree.h
  8. 1 0
      include/igl/adjacency_matrix.cpp
  9. 35 19
      include/igl/ambient_occlusion.cpp
  10. 11 13
      include/igl/bbw/bbw.cpp
  11. 17 16
      include/igl/bbw/bbw.h
  12. 2 0
      include/igl/cat.cpp
  13. 0 29
      include/igl/copyleft/boolean/MeshBooleanType.h
  14. 6 6
      include/igl/copyleft/cgal/BinaryWindingNumberOperations.h
  15. 4 4
      include/igl/copyleft/cgal/CSGTree.h
  16. 1 1
      include/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h
  17. 3 1
      include/igl/copyleft/cgal/assign_scalar.cpp
  18. 1 0
      include/igl/copyleft/cgal/extract_cells.cpp
  19. 28 28
      include/igl/copyleft/cgal/mesh_boolean.cpp
  20. 4 4
      include/igl/copyleft/cgal/mesh_boolean.h
  21. 4 4
      include/igl/copyleft/cgal/minkowski_sum.cpp
  22. 1 1
      include/igl/copyleft/cgal/minkowski_sum.h
  23. 3 0
      include/igl/copyleft/cgal/outer_hull.cpp
  24. 2 1
      include/igl/copyleft/cgal/points_inside_component.h
  25. 5 3
      include/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp
  26. 4 4
      include/igl/copyleft/cgal/string_to_mesh_boolean_type.h
  27. 6 3
      include/igl/copyleft/comiso/frame_field.cpp
  28. 3 0
      include/igl/copyleft/comiso/frame_field.h
  29. 44 42
      include/igl/copyleft/comiso/miq.cpp
  30. 3 0
      include/igl/copyleft/comiso/miq.h
  31. 29 25
      include/igl/copyleft/comiso/nrosy.cpp
  32. 3 0
      include/igl/copyleft/comiso/nrosy.h
  33. 3 6
      include/igl/copyleft/cork/from_cork_mesh.cpp
  34. 3 5
      include/igl/copyleft/cork/from_cork_mesh.h
  35. 4 6
      include/igl/copyleft/cork/mesh_boolean.cpp
  36. 6 8
      include/igl/copyleft/cork/mesh_boolean.h
  37. 4 6
      include/igl/copyleft/cork/to_cork_mesh.cpp
  38. 3 5
      include/igl/copyleft/cork/to_cork_mesh.h
  39. 5 5
      include/igl/cross_field_missmatch.cpp
  40. 2 2
      include/igl/cross_field_missmatch.h
  41. 0 1
      include/igl/eigs.cpp
  42. 1 0
      include/igl/embree/reorient_facets_raycast.cpp
  43. 2 6
      include/igl/find_cross_field_singularities.cpp
  44. 5 0
      include/igl/in_element.cpp
  45. 3 1
      include/igl/jet.cpp
  46. 1 0
      include/igl/massmatrix.cpp
  47. 2 0
      include/igl/matlab/parse_rhs.cpp
  48. 39 0
      include/igl/matlab/prepare_lhs.cpp
  49. 6 0
      include/igl/matlab/prepare_lhs.h
  50. 1 1
      include/igl/mosek/mosek_quadprog.h
  51. 2 1
      include/igl/per_vertex_normals.cpp
  52. 8 18
      include/igl/png/render_to_png.cpp
  53. 15 29
      include/igl/png/render_to_png_async.cpp
  54. 4 5
      include/igl/png/texture_from_file.cpp
  55. 30 22
      include/igl/png/texture_from_png.cpp
  56. 0 7
      include/igl/png/texture_from_png.h
  57. 1 1
      include/igl/point_simplex_squared_distance.h
  58. 3 0
      include/igl/polar_svd.cpp
  59. 21 0
      include/igl/project.cpp
  60. 14 0
      include/igl/project.h
  61. 1 0
      include/igl/project_to_line.cpp
  62. 1 1
      include/igl/quat_to_axis_angle.cpp
  63. 56 17
      include/igl/readSTL.cpp
  64. 14 1
      include/igl/read_triangle_mesh.cpp
  65. 2 0
      include/igl/slice.cpp
  66. 1 0
      include/igl/triangle_triangle_adjacency.cpp
  67. 0 15
      include/igl/viewer/OpenGL_shader.cpp
  68. 4 2
      include/igl/viewer/Viewer.cpp
  69. 1 0
      include/igl/winding_number.cpp
  70. 138 0
      include/igl/xml/writeDAE.cpp
  71. 38 0
      include/igl/xml/writeDAE.h
  72. 33 0
      include/igl/xml/write_triangle_mesh.cpp
  73. 45 0
      include/igl/xml/write_triangle_mesh.h
  74. 41 323
      optional/CMakeLists.txt
  75. 1 9
      optional/README.md
  76. 69 135
      python/CMakeLists.txt
  77. 2 2
      python/README.md
  78. 5 5
      python/copyleft/py_igl_comiso.cpp
  79. 1 1
      python/iglhelpers.py
  80. 1 1
      python/py_igl.cpp
  81. 2 2
      python/py_igl/copyleft/comiso/py_miq.cpp
  82. 2 2
      python/py_igl/copyleft/comiso/py_nrosy.cpp
  83. 1 2
      python/py_igl_viewer.cpp
  84. 1 1
      python/py_vector.cpp
  85. 3 3
      python/python_shared.cpp
  86. 0 0
      python/python_shared.h
  87. 1 1
      python/tcpviewer.py
  88. 1 1
      python/tutorial/101_FileIO.py
  89. 1 1
      python/tutorial/102_DrawMesh.py
  90. 1 1
      python/tutorial/102_DrawMesh_TCP.py
  91. 1 1
      python/tutorial/103_Events.py
  92. 1 1
      python/tutorial/104_Colors.py
  93. 1 1
      python/tutorial/105_Overlays.py
  94. 1 1
      python/tutorial/201_Normals.py
  95. 1 1
      python/tutorial/202_GaussianCurvature.py
  96. 1 1
      python/tutorial/203_CurvatureDirections.py
  97. 1 1
      python/tutorial/204_Gradient.py
  98. 1 1
      python/tutorial/205_Laplacian.py
  99. 1 1
      python/tutorial/301_Slice.py
  100. 1 1
      python/tutorial/302_Sort.py

+ 3 - 1
.appveyor.yml

@@ -14,6 +14,8 @@ build_script:
   - mkdir build
   - cd build
   - cmake -D "LIBIGL_USE_STATIC_LIBRARY=ON" -G "Visual Studio 14 2015 Win64" ../
+#  - cmake -G "Visual Studio 14 2015 Win64" ../
   - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
-  - set MSBuildOptions=/v:m /p:Configuration=Release /logger:%MSBuildLogger%
+#  - set MSBuildOptions=/v:m /p:Configuration=Release /logger:%MSBuildLogger%
+  - set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
   - msbuild %MSBuildOptions% libigl_tutorials.sln

+ 18 - 0
.gitmodules

@@ -9,3 +9,21 @@ url=https://github.com/libigl/nanogui.git
 [submodule "external/pybind11"]
 	path = external/pybind11
 	url = https://github.com/wjakob/pybind11.git
+[submodule "external/cgal"]
+	path = external/cgal
+	url = https://github.com/CGAL/cgal.git
+[submodule "external/tetgen"]
+	path = external/tetgen
+	url = https://github.com/libigl/tetgen.git
+[submodule "external/triangle"]
+	path = external/triangle
+	url = https://github.com/libigl/triangle.git
+[submodule "external/tinyxml2"]
+	path = external/tinyxml2
+	url = https://github.com/leethomason/tinyxml2.git
+[submodule "external/CoMISo"]
+	path = external/CoMISo
+	url = https://github.com/libigl/CoMISo.git
+[submodule "external/cork"]
+	path = external/cork
+	url = https://github.com/libigl/cork.git

+ 17 - 2
.travis.yml

@@ -8,21 +8,30 @@ matrix:
         - git submodule update --init --recursive
         - mkdir external/nanogui/ext/glfw/include/GL
         - wget -P external/nanogui/ext/glfw/include/GL http://www.opengl.org/registry/api/GL/glcorearb.h
+        - cd python
+        - mkdir build
+        - cd build
+        - cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF ../
+        - make -j 2
+        - cd ../../
         - cd tutorial
         - mkdir build
         - cd build
-        - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -DCMAKE_CXX_COMPILER=g++-4.8 ../
+        - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF ../
         - make -j 2
       addons:
         apt:
           sources:
             - ubuntu-toolchain-r-test
-            - kalakris-cmake
+            - george-edison55-precise-backports
           packages:
             - xorg-dev
             - libglu1-mesa-dev
             - g++-4.8
             - cmake
+            - cmake-data
+            - libblas-dev
+            - liblapack-dev
     #         - binutils
     #         - libx11-dev
     #         - mesa-common-dev
@@ -40,6 +49,12 @@ matrix:
         - brew upgrade cmake
         - brew upgrade cgal
         - git submodule update --init --recursive
+        - cd python
+        - mkdir build
+        - cd build
+        - cmake ../
+        - make -j 2
+        - cd ../../
         - cd tutorial
         - mkdir build
         - cd build

+ 2 - 2
README.md

@@ -94,7 +94,7 @@ libigl depends only on the [Eigen](http://eigen.tuxfamily.org) library.
 
 For more information see our [tutorial](tutorial/tutorial.html).
 
-### Optional dependencies ###
+### Optional dependencies
 
 Libigl compartmentalizes its **optional** dependences via its directory
 organization in the `include/` folder. All header files located _directly_ in
@@ -155,7 +155,7 @@ subrepos:
 
 ```bash
 git pull
-git submodule update -- recursive
+git submodule update --recursive
 ```
 
 ## Unit testing

+ 3 - 0
include/igl/AABB.h

@@ -322,6 +322,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
 {
   using namespace std;
   using namespace Eigen;
+  deinit();
   if(bb_mins.size() > 0)
   {
     assert(bb_mins.rows() == bb_maxs.rows() && "Serial tree arrays must match");
@@ -380,6 +381,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
     const Eigen::MatrixXi & Ele)
 {
   using namespace Eigen;
+  // deinit will be immediately called...
   return init(V,Ele,MatrixXDIMS(),MatrixXDIMS(),VectorXi(),0);
 }
 
@@ -392,6 +394,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
 {
   using namespace Eigen;
   using namespace std;
+  deinit();
   if(V.size() == 0 || Ele.size() == 0 || I.size() == 0)
   {
     return;

+ 23 - 0
include/igl/MeshBooleanType.h

@@ -0,0 +1,23 @@
+// 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_MESH_BOOLEAN_TYPE_H
+#define IGL_MESH_BOOLEAN_TYPE_H
+namespace igl
+{
+  enum MeshBooleanType
+  {
+    MESH_BOOLEAN_TYPE_UNION = 0,
+    MESH_BOOLEAN_TYPE_INTERSECT = 1,
+    MESH_BOOLEAN_TYPE_MINUS = 2,
+    MESH_BOOLEAN_TYPE_XOR = 3,
+    MESH_BOOLEAN_TYPE_RESOLVE = 4,
+    NUM_MESH_BOOLEAN_TYPES = 5
+  };
+};
+
+#endif

+ 6 - 5
include/igl/WindingNumberTree.h

@@ -434,7 +434,8 @@ inline double igl::WindingNumberTree<Point>::cached_winding_number(
   const Point & p) const
 {
   using namespace std;
-  // Simple metric for "far".
+  // Simple metric for `is_far`
+  //
   //   this             that
   //                   --------
   //   -----          /   |    \ .
@@ -450,17 +451,17 @@ inline double igl::WindingNumberTree<Point>::cached_winding_number(
   // a = atan2(R-r,d), where d is the distance between centers
 
   // That should be bigger (what about parent? what about sister?)
-  bool far = this->radius<that.radius;
-  if(far)
+  bool is_far = this->radius<that.radius;
+  if(is_far)
   {
     double a = atan2(
       that.radius - this->radius,
       (that.center - this->center).norm());
     assert(a>0);
-    far = (a<PI/8.0);
+    is_far = (a<PI/8.0);
   }
 
-  if(far)
+  if(is_far)
   {
     // Not implemented yet
     pair<const WindingNumberTree*,const WindingNumberTree*> this_that(this,&that);

+ 1 - 0
include/igl/adjacency_matrix.cpp

@@ -67,4 +67,5 @@ IGL_INLINE void igl::adjacency_matrix(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
+template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<int, 0, int>&);
 #endif

+ 35 - 19
include/igl/ambient_occlusion.cpp

@@ -10,6 +10,10 @@
 #include "ray_mesh_intersect.h"
 #include "EPS.h"
 #include "Hit.h"
+#include <thread>
+#include <functional>
+#include <vector>
+#include <algorithm>
 
 template <
   typename DerivedP,
@@ -33,29 +37,41 @@ IGL_INLINE void igl::ambient_occlusion(
   VectorXi hits = VectorXi::Zero(n,1);
   // Embree seems to be parallel when constructing but not when tracing rays
   const MatrixXf D = random_dir_stratified(num_samples).cast<float>();
-  // loop over mesh vertices
-#pragma omp parallel for
-  for(int p = 0;p<n;p++)
+
+  const size_t nthreads = n<1000?1:std::thread::hardware_concurrency();
   {
-    const Vector3f origin = P.row(p).template cast<float>();
-    const Vector3f normal = N.row(p).template cast<float>();
-    int num_hits = 0;
-    for(int s = 0;s<num_samples;s++)
+    std::vector<std::thread> threads(nthreads);
+    for(int t = 0;t<nthreads;t++)
     {
-//      //Vector3d d = random_dir();
-      Vector3f d = D.row(s);
-      if(d.dot(normal) < 0)
-      {
-        // reverse ray
-        d *= -1;
-      }
-      if(shoot_ray(origin,d))
-      {
-        num_hits++;
-      }
+      threads[t] = std::thread(std::bind(
+        [&P,&N,&shoot_ray,&S,&num_samples,&D](const int bi, const int ei, const int t)
+        {
+          // loop over mesh vertices in this chunk
+          for(int p = bi;p<ei;p++)
+          {
+            const Vector3f origin = P.row(p).template cast<float>();
+            const Vector3f normal = N.row(p).template cast<float>();
+            int num_hits = 0;
+            for(int s = 0;s<num_samples;s++)
+            {
+              Vector3f d = D.row(s);
+              if(d.dot(normal) < 0)
+              {
+                // reverse ray
+                d *= -1;
+              }
+              if(shoot_ray(origin,d))
+              {
+                num_hits++;
+              }
+            }
+            S(p) = (double)num_hits/(double)num_samples;
+          }
+        },t*n/nthreads,(t+1)==nthreads?n:(t+1)*n/nthreads,t));
     }
-    S(p) = (double)num_hits/(double)num_samples;
+    std::for_each(threads.begin(),threads.end(),[](std::thread& x){x.join();});
   }
+
 }
 
 template <

+ 11 - 13
include/igl/bbw/bbw.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// 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 "bbw.h"
 
@@ -14,13 +14,11 @@
 #include <igl/slice_into.h>
 #include <igl/min_quad_with_fixed.h>
 
-#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
 #include <Eigen/Sparse>
 
 #include <iostream>
 #include <cstdio>
 
-
 igl::bbw::BBWData::BBWData():
   partition_unity(false),
   W0(),
@@ -45,16 +43,16 @@ void igl::bbw::BBWData::print()
 
 
 template <
-  typename DerivedV, 
-  typename DerivedEle, 
+  typename DerivedV,
+  typename DerivedEle,
   typename Derivedb,
-  typename Derivedbc, 
+  typename Derivedbc,
   typename DerivedW>
 IGL_INLINE bool igl::bbw::bbw(
-  const Eigen::PlainObjectBase<DerivedV> & V, 
-  const Eigen::PlainObjectBase<DerivedEle> & Ele, 
-  const Eigen::PlainObjectBase<Derivedb> & b, 
-  const Eigen::PlainObjectBase<Derivedbc> & bc, 
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedEle> & Ele,
+  const Eigen::PlainObjectBase<Derivedb> & b,
+  const Eigen::PlainObjectBase<Derivedbc> & bc,
   igl::bbw::BBWData & data,
   Eigen::PlainObjectBase<DerivedW> & W
   )

+ 17 - 16
include/igl/bbw/bbw.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// 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_BBW_BBW_H
 #define IGL_BBW_BBW_H
@@ -51,9 +51,10 @@ namespace igl
         // 2: louder
         int verbosity;
       public:
-        BBWData();
+        IGL_INLINE BBWData();
+
         // Print current state of object
-        void print();
+        IGL_INLINE void print();
     };
 
     // Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
@@ -72,25 +73,25 @@ namespace igl
     //   bc #b by #W list of boundary values
     //   data  object containing options, intial guess --> solution and results
     // Outputs:
-    //   W  #V by #W list of *unnormalized* weights to normalize use 
-    //    igl::normalize_row_sums(W,W); 
+    //   W  #V by #W list of *unnormalized* weights to normalize use
+    //    igl::normalize_row_sums(W,W);
     // Returns true on success, false on failure
     template <
-      typename DerivedV, 
-               typename DerivedEle, 
+      typename DerivedV,
+               typename DerivedEle,
                typename Derivedb,
-               typename Derivedbc, 
+               typename Derivedbc,
                typename DerivedW>
                  IGL_INLINE bool bbw(
-                     const Eigen::PlainObjectBase<DerivedV> & V, 
-                     const Eigen::PlainObjectBase<DerivedEle> & Ele, 
-                     const Eigen::PlainObjectBase<Derivedb> & b, 
-                     const Eigen::PlainObjectBase<Derivedbc> & bc, 
+                     const Eigen::PlainObjectBase<DerivedV> & V,
+                     const Eigen::PlainObjectBase<DerivedEle> & Ele,
+                     const Eigen::PlainObjectBase<Derivedb> & b,
+                     const Eigen::PlainObjectBase<Derivedbc> & bc,
                      BBWData & data,
                      Eigen::PlainObjectBase<DerivedW> & W);
   }
 }
-  
+
 #ifndef IGL_STATIC_LIBRARY
 #  include "bbw.cpp"
 #endif

+ 2 - 0
include/igl/cat.cpp

@@ -155,4 +155,6 @@ template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::cat<Eigen::Matrix<int, -1, -
 template void igl::cat<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(int, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&);
 template Eigen::Matrix<int, -1, 1, 0, -1, 1> igl::cat<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
 template Eigen::Matrix<double, -1, 1, 0, -1, 1> igl::cat<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(int, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&);
+template void igl::cat<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(int, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
+template void igl::cat<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(int, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
 #endif

+ 0 - 29
include/igl/copyleft/boolean/MeshBooleanType.h

@@ -1,29 +0,0 @@
-// 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_COPYLEFT_BOOLEAN_MESH_BOOLEAN_TYPE_H
-#define IGL_COPYLEFT_BOOLEAN_MESH_BOOLEAN_TYPE_H
-namespace igl
-{
-  namespace copyleft
-  {
-    namespace boolean
-    {
-      enum MeshBooleanType
-      {
-        MESH_BOOLEAN_TYPE_UNION = 0,
-        MESH_BOOLEAN_TYPE_INTERSECT = 1,
-        MESH_BOOLEAN_TYPE_MINUS = 2,
-        MESH_BOOLEAN_TYPE_XOR = 3,
-        MESH_BOOLEAN_TYPE_RESOLVE = 4,
-        NUM_MESH_BOOLEAN_TYPES = 5
-      };
-    }
-  }
-};
-
-#endif

+ 6 - 6
include/igl/copyleft/boolean/BinaryWindingNumberOperations.h → include/igl/copyleft/cgal/BinaryWindingNumberOperations.h

@@ -6,21 +6,21 @@
 // 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_COPYLEFT_BOOLEAN_BINARY_WINDING_NUMBER_OPERATIONS_H
-#define IGL_COPYLEFT_BOOLEAN_BINARY_WINDING_NUMBER_OPERATIONS_H
+#ifndef IGL_COPYLEFT_CGAL_BINARY_WINDING_NUMBER_OPERATIONS_H
+#define IGL_COPYLEFT_CGAL_BINARY_WINDING_NUMBER_OPERATIONS_H
 
 #include <stdexcept>
 #include "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <Eigen/Core>
 
 namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cgal
     {
-      template <igl::copyleft::boolean::MeshBooleanType Op>
+      template <igl::MeshBooleanType Op>
       class BinaryWindingNumberOperations {
         public:
           template<typename DerivedW>
@@ -72,7 +72,7 @@ namespace igl
       };
 
       template <>
-      class BinaryWindingNumberOperations<igl::copyleft::boolean::MESH_BOOLEAN_TYPE_RESOLVE> {
+      class BinaryWindingNumberOperations<MESH_BOOLEAN_TYPE_RESOLVE> {
         public:
           template<typename DerivedW>
             typename DerivedW::Scalar operator()(

+ 4 - 4
include/igl/copyleft/boolean/CSGTree.h → include/igl/copyleft/cgal/CSGTree.h

@@ -5,11 +5,11 @@
 // 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_COPYLEFT_BOOLEAN_CSG_TREE_H
-#define IGL_COPYLEFT_BOOLEAN_CSG_TREE_H
+#ifndef IGL_COPYLEFT_CGAL_CSG_TREE_H
+#define IGL_COPYLEFT_CGAL_CSG_TREE_H
 
+#include "../../MeshBooleanType.h"
 #include "string_to_mesh_boolean_type.h"
-#include "MeshBooleanType.h"
 #include "mesh_boolean.h"
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/number_utils.h>
@@ -18,7 +18,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cgal
     {
       // Class for defining and computing a constructive solid geometry result
       // out of a tree of boolean operations on "solid" triangle meshes.

+ 1 - 1
include/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h

@@ -21,7 +21,7 @@ namespace igl
         bool detect_only;
         bool first_only;
         bool stitch_all;
-        RemeshSelfIntersectionsParam(
+        inline RemeshSelfIntersectionsParam(
           bool _detect_only=false, 
           bool _first_only=false,
           bool _stitch_all=false):

+ 3 - 1
include/igl/copyleft/cgal/assign_scalar.cpp

@@ -15,9 +15,11 @@ IGL_INLINE void igl::copyleft::cgal::assign_scalar(
 }
 
 IGL_INLINE void igl::copyleft::cgal::assign_scalar(
-  const typename CGAL::Epeck::FT & cgal,
+  const typename CGAL::Epeck::FT & _cgal,
   double & d)
 {
+  // FORCE evaluation of the exact type otherwise interval might be huge.
+  const typename CGAL::Epeck::FT cgal = _cgal.exact();
   const auto interval = CGAL::to_interval(cgal);
   d = interval.first;
   do {

+ 1 - 0
include/igl/copyleft/cgal/extract_cells.cpp

@@ -525,4 +525,5 @@ IGL_INLINE size_t igl::copyleft::cgal::extract_cells_single_component(
 #ifdef IGL_STATIC_LIBRARY
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 28 - 28
include/igl/copyleft/boolean/mesh_boolean.cpp → include/igl/copyleft/cgal/mesh_boolean.cpp

@@ -9,11 +9,11 @@
 //
 #include "mesh_boolean.h"
 #include "BinaryWindingNumberOperations.h"
-#include "../cgal/assign_scalar.h"
-#include "../cgal/propagate_winding_numbers.h"
-#include "../cgal/remesh_self_intersections.h"
-#include "../cgal/relabel_small_immersed_cells.h"
-#include "../cgal/extract_cells.h"
+#include "assign_scalar.h"
+#include "propagate_winding_numbers.h"
+#include "remesh_self_intersections.h"
+#include "relabel_small_immersed_cells.h"
+#include "extract_cells.h"
 #include "../../extract_manifold_patches.h"
 #include "../../remove_unreferenced.h"
 #include "../../unique_simplices.h"
@@ -40,7 +40,7 @@ template <
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedJ>
-IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
+IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
     const Eigen::PlainObjectBase<DerivedVA> & VA,
     const Eigen::PlainObjectBase<DerivedFA> & FA,
     const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -265,7 +265,7 @@ template <
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedJ>
-IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
+IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
     const Eigen::PlainObjectBase<DerivedVA > & VA,
     const Eigen::PlainObjectBase<DerivedFA > & FA,
     const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -279,26 +279,26 @@ IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
   switch (type) 
   {
     case MESH_BOOLEAN_TYPE_UNION:
-      return igl::copyleft::boolean::mesh_boolean(
-          VA, FA, VB, FB, igl::copyleft::boolean::BinaryUnion(),
-          igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
+      return igl::copyleft::cgal::mesh_boolean(
+          VA, FA, VB, FB, igl::copyleft::cgal::BinaryUnion(),
+          igl::copyleft::cgal::KeepInside(), resolve_func, VC, FC, J);
     case MESH_BOOLEAN_TYPE_INTERSECT:
-      return igl::copyleft::boolean::mesh_boolean(
-          VA, FA, VB, FB, igl::copyleft::boolean::BinaryIntersect(),
-          igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
+      return igl::copyleft::cgal::mesh_boolean(
+          VA, FA, VB, FB, igl::copyleft::cgal::BinaryIntersect(),
+          igl::copyleft::cgal::KeepInside(), resolve_func, VC, FC, J);
     case MESH_BOOLEAN_TYPE_MINUS:
-      return igl::copyleft::boolean::mesh_boolean(
-          VA, FA, VB, FB, igl::copyleft::boolean::BinaryMinus(),
-          igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
+      return igl::copyleft::cgal::mesh_boolean(
+          VA, FA, VB, FB, igl::copyleft::cgal::BinaryMinus(),
+          igl::copyleft::cgal::KeepInside(), resolve_func, VC, FC, J);
     case MESH_BOOLEAN_TYPE_XOR:
-      return igl::copyleft::boolean::mesh_boolean(
-          VA, FA, VB, FB, igl::copyleft::boolean::BinaryXor(),
-          igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
+      return igl::copyleft::cgal::mesh_boolean(
+          VA, FA, VB, FB, igl::copyleft::cgal::BinaryXor(),
+          igl::copyleft::cgal::KeepInside(), resolve_func, VC, FC, J);
     case MESH_BOOLEAN_TYPE_RESOLVE:
       //op = binary_resolve();
-      return igl::copyleft::boolean::mesh_boolean(
-          VA, FA, VB, FB, igl::copyleft::boolean::BinaryResolve(),
-          igl::copyleft::boolean::KeepAll(), resolve_func, VC, FC, J);
+      return igl::copyleft::cgal::mesh_boolean(
+          VA, FA, VB, FB, igl::copyleft::cgal::BinaryResolve(),
+          igl::copyleft::cgal::KeepAll(), resolve_func, VC, FC, J);
     default:
       assert(false && "Unsupported boolean type.");
       return false;
@@ -313,7 +313,7 @@ template <
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedJ>
-IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
+IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
   const Eigen::PlainObjectBase<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -371,7 +371,7 @@ template <
   typename DerivedFB,
   typename DerivedVC,
   typename DerivedFC>
-IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
+IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
   const Eigen::PlainObjectBase<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -381,14 +381,14 @@ IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
   Eigen::PlainObjectBase<DerivedFC > & FC) 
 {
   Eigen::Matrix<typename DerivedFC::Index, Eigen::Dynamic,1> J;
-  return igl::copyleft::boolean::mesh_boolean(VA,FA,VB,FB,type,VC,FC,J);
+  return igl::copyleft::cgal::mesh_boolean(VA,FA,VB,FB,type,VC,FC,J);
 }
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template bool igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
-template bool igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
+template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #undef IGL_STATIC_LIBRARY
 #include "../../remove_unreferenced.cpp"
 template void igl::remove_unreferenced<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);

+ 4 - 4
include/igl/copyleft/boolean/mesh_boolean.h → include/igl/copyleft/cgal/mesh_boolean.h

@@ -7,11 +7,11 @@
 // 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_COPYLEFT_BOOLEAN_MESH_BOOLEAN_H
-#define IGL_COPYLEFT_BOOLEAN_MESH_BOOLEAN_H
+#ifndef IGL_COPYLEFT_CGAL_MESH_BOOLEAN_H
+#define IGL_COPYLEFT_CGAL_MESH_BOOLEAN_H
 
 #include "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <Eigen/Core>
 #include <functional>
 
@@ -19,7 +19,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cgal
     {
       //  MESH_BOOLEAN Compute boolean csg operations on "solid", consistently
       //  oriented meshes.

+ 4 - 4
include/igl/copyleft/boolean/minkowski_sum.cpp → include/igl/copyleft/cgal/minkowski_sum.cpp

@@ -12,7 +12,7 @@
 #include "../../unique.h"
 #include "../../get_seconds.h"
 #include "../../edges.h"
-#include "../cgal/assign_scalar.h"
+#include "assign_scalar.h"
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <cassert>
 #include <vector>
@@ -24,7 +24,7 @@ template <
   typename DerivedW,
   typename DerivedG,
   typename DerivedJ>
-IGL_INLINE void igl::copyleft::boolean::minkowski_sum(
+IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   const Eigen::PlainObjectBase<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -149,7 +149,7 @@ template <
   typename DerivedW,
   typename DerivedG,
   typename DerivedJ>
-IGL_INLINE void igl::copyleft::boolean::minkowski_sum(
+IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   const Eigen::PlainObjectBase<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::Matrix<sType,1,sCols,sOptions> & s,
@@ -354,7 +354,7 @@ template <
   typename DerivedW,
   typename DerivedG,
   typename DerivedJ>
-IGL_INLINE void igl::copyleft::boolean::minkowski_sum(
+IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
   const Eigen::PlainObjectBase<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::Matrix<sType,1,sCols,sOptions> & s,

+ 1 - 1
include/igl/copyleft/boolean/minkowski_sum.h → include/igl/copyleft/cgal/minkowski_sum.h

@@ -15,7 +15,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cgal
     {
       // Compute the Minkowski sum of a closed triangle mesh (V,F) and a
       // set of simplices in 3D.

+ 3 - 0
include/igl/copyleft/cgal/outer_hull.cpp

@@ -8,6 +8,7 @@
 #include "outer_hull.h"
 #include "extract_cells.h"
 #include "remesh_self_intersections.h"
+#include "assign_scalar.h"
 #include "../../remove_unreferenced.h"
 
 #include <CGAL/AABB_tree.h>
@@ -532,4 +533,6 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
+template void igl::copyleft::cgal::outer_hull<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::copyleft::cgal::outer_hull_legacy< Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &);
 #endif

+ 2 - 1
include/igl/copyleft/cgal/points_inside_component.h

@@ -12,7 +12,8 @@
 #include <Eigen/Core>
 #include <vector>
 
-namespace igl {
+namespace igl 
+{
   namespace copyleft
   {
     namespace cgal {

+ 5 - 3
include/igl/copyleft/boolean/string_to_mesh_boolean_type.cpp → include/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp

@@ -3,7 +3,7 @@
 #include <cassert>
 #include <vector>
 
-IGL_INLINE bool igl::copyleft::boolean::string_to_mesh_boolean_type( 
+IGL_INLINE bool igl::copyleft::cgal::string_to_mesh_boolean_type( 
   const std::string & s,
   MeshBooleanType & type)
 {
@@ -22,7 +22,8 @@ IGL_INLINE bool igl::copyleft::boolean::string_to_mesh_boolean_type(
   {
     type = MESH_BOOLEAN_TYPE_INTERSECT;
   }else if(
-    find_any({"minus","subtract","difference","relative complement","m","\\"},eff_s))
+    find_any(
+      {"minus","subtract","difference","relative complement","m","\\"},eff_s))
   {
     type = MESH_BOOLEAN_TYPE_MINUS;
   }else if(find_any({"xor","symmetric difference","x","∆"},eff_s))
@@ -38,7 +39,8 @@ IGL_INLINE bool igl::copyleft::boolean::string_to_mesh_boolean_type(
   return true;
 }
 
-IGL_INLINE igl::copyleft::boolean::MeshBooleanType igl::copyleft::boolean::string_to_mesh_boolean_type( 
+IGL_INLINE igl::MeshBooleanType 
+igl::copyleft::cgal::string_to_mesh_boolean_type( 
   const std::string & s)
 {
   MeshBooleanType type;

+ 4 - 4
include/igl/copyleft/boolean/string_to_mesh_boolean_type.h → include/igl/copyleft/cgal/string_to_mesh_boolean_type.h

@@ -5,18 +5,18 @@
 // 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_COPYLEFT_BOOLEAN_STRING_TO_MESH_BOOLEAN_H
-#define IGL_COPYLEFT_BOOLEAN_STRING_TO_MESH_BOOLEAN_H
+#ifndef IGL_COPYLEFT_CGAL_STRING_TO_MESH_BOOLEAN_H
+#define IGL_COPYLEFT_CGAL_STRING_TO_MESH_BOOLEAN_H
 
 #include "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <string>
 
 namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cgal
     {
       // Convert string to boolean type
       //

+ 6 - 3
include/igl/comiso/frame_field.cpp → include/igl/copyleft/comiso/frame_field.cpp

@@ -10,11 +10,13 @@
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/edge_topology.h>
 #include <igl/per_face_normals.h>
-#include <igl/comiso/nrosy.h>
+#include <igl/copyleft/comiso/nrosy.h>
 #include <iostream>
 
 namespace igl
 {
+namespace copyleft
+{
 namespace comiso
 {
 
@@ -229,7 +231,7 @@ void FrameInterpolator::interpolateCross()
   b.conservativeResize(num,Eigen::NoChange);
   bc.conservativeResize(num,Eigen::NoChange);
 
-  igl::comiso::nrosy(V, F, b, bc, 4, R, S);
+  igl::copyleft::comiso::nrosy(V, F, b, bc, 4, R, S);
   //olga:end
   assert(R.rows() == F.rows());
 
@@ -647,10 +649,11 @@ Eigen::MatrixXd FrameInterpolator::getFieldPerFace()
   P = svd.matrixV() * svd.singularValues().asDiagonal() * svd.matrixV().transpose();
 }
 
+}
 }
 }
 
-IGL_INLINE void igl::comiso::frame_field(
+IGL_INLINE void igl::copyleft::comiso::frame_field(
                                  const Eigen::MatrixXd& V,
                                  const Eigen::MatrixXi& F,
                                  const Eigen::VectorXi& b,

+ 3 - 0
include/igl/comiso/frame_field.h → include/igl/copyleft/comiso/frame_field.h

@@ -14,6 +14,8 @@
 
 namespace igl
 {
+namespace copyleft
+{
 namespace comiso
 {
 // Generate a piecewise-constant frame-field field from a sparse set of constraints on faces
@@ -45,6 +47,7 @@ IGL_INLINE void frame_field(
   );
 }
 }
+}
 
 #ifndef IGL_STATIC_LIBRARY
 #  include "frame_field.cpp"

+ 44 - 42
include/igl/comiso/miq.cpp → include/igl/copyleft/comiso/miq.cpp

@@ -6,7 +6,7 @@
 // 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 <igl/comiso/miq.h>
+#include <igl/copyleft/comiso/miq.h>
 #include <igl/local_basis.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/cut_mesh.h>
@@ -45,6 +45,7 @@
 
 
 namespace igl {
+namespace copyleft {
 namespace comiso {
   struct SeamInfo
   {
@@ -350,9 +351,10 @@ namespace comiso {
 
   };
 };
+};
 }
 
-IGL_INLINE igl::comiso::SeamInfo::SeamInfo(int _v0,
+IGL_INLINE igl::copyleft::comiso::SeamInfo::SeamInfo(int _v0,
                                    int _v0p,
                                    int _MMatch,
                                    int _integerVar)
@@ -363,7 +365,7 @@ IGL_INLINE igl::comiso::SeamInfo::SeamInfo(int _v0,
   MMatch=_MMatch;
 }
 
-IGL_INLINE igl::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
+IGL_INLINE igl::copyleft::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
 {
   v0=S1.v0;
   v0p=S1.v0p;
@@ -373,7 +375,7 @@ IGL_INLINE igl::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
 
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE igl::comiso::VertexIndexing<DerivedV, DerivedF>::VertexIndexing(const Eigen::PlainObjectBase<DerivedV> &_V,
+IGL_INLINE igl::copyleft::comiso::VertexIndexing<DerivedV, DerivedF>::VertexIndexing(const Eigen::PlainObjectBase<DerivedV> &_V,
                                                                    const Eigen::PlainObjectBase<DerivedF> &_F,
                                                                    const Eigen::PlainObjectBase<DerivedV> &_Vcut,
                                                                    const Eigen::PlainObjectBase<DerivedF> &_Fcut,
@@ -402,7 +404,7 @@ Handle_Seams(_Handle_Seams)
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::GetSeamInfo(const int f0,
+IGL_INLINE void igl::copyleft::comiso::VertexIndexing<DerivedV, DerivedF>::GetSeamInfo(const int f0,
                                                                      const int f1,
                                                                      const int indexE,
                                                                      int &v0,int &v1,
@@ -424,7 +426,7 @@ IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::GetSeamInfo(con
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE std::vector<std::vector<typename igl::comiso::VertexIndexing<DerivedV, DerivedF>::VertexInfo> > igl::comiso::VertexIndexing<DerivedV, DerivedF>::GetVerticesPerSeam()
+IGL_INLINE std::vector<std::vector<typename igl::copyleft::comiso::VertexIndexing<DerivedV, DerivedF>::VertexInfo> > igl::copyleft::comiso::VertexIndexing<DerivedV, DerivedF>::GetVerticesPerSeam()
 {
   // Return value
   std::vector<std::vector<VertexInfo> >verticesPerSeam;
@@ -524,7 +526,7 @@ IGL_INLINE std::vector<std::vector<typename igl::comiso::VertexIndexing<DerivedV
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::InitSeamInfo()
+IGL_INLINE void igl::copyleft::comiso::VertexIndexing<DerivedV, DerivedF>::InitSeamInfo()
 {
   auto verticesPerSeam = GetVerticesPerSeam();
   Handle_SystemInfo.EdgeSeamInfo.clear();
@@ -590,7 +592,7 @@ IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::InitSeamInfo()
 
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::SolvePoisson(Eigen::VectorXd Stiffness,
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::SolvePoisson(Eigen::VectorXd Stiffness,
                                                                      double vector_field_scale,
                                                                      double grid_res,
                                                                      bool direct_round,
@@ -662,7 +664,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::SolvePoisson(Eig
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE igl::comiso::PoissonSolver<DerivedV, DerivedF>
+IGL_INLINE igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>
 ::PoissonSolver(const Eigen::PlainObjectBase<DerivedV> &_V,
                 const Eigen::PlainObjectBase<DerivedF> &_F,
                 const Eigen::PlainObjectBase<DerivedV> &_Vcut,
@@ -695,7 +697,7 @@ Handle_SystemInfo(_Handle_SystemInfo)
 ///return the complex encoding the rotation
 ///for a given missmatch interval
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE std::complex<double> igl::comiso::PoissonSolver<DerivedV, DerivedF>::GetRotationComplex(int interval)
+IGL_INLINE std::complex<double> igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::GetRotationComplex(int interval)
 {
   assert((interval>=0)&&(interval<4));
 
@@ -713,7 +715,7 @@ IGL_INLINE std::complex<double> igl::comiso::PoissonSolver<DerivedV, DerivedF>::
 ///START FIXING VERTICES
 ///set a given vertex as fixed
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddFixedVertex(int v)
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::AddFixedVertex(int v)
 {
   n_fixed_vars++;
   Hard_constraints.push_back(v);
@@ -722,7 +724,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddFixedVertex(i
 ///find vertex to fix in case we're using
 ///a vector field NB: multiple components not handled
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVertField()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVertField()
 {
   Hard_constraints.clear();
 
@@ -747,21 +749,21 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVertFie
 ///find hard constraint depending if using or not
 ///a vector field
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVert()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVert()
 {
   Hard_constraints.clear();
   FindFixedVertField();
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE int igl::comiso::PoissonSolver<DerivedV, DerivedF>::GetFirstVertexIndex(int v)
+IGL_INLINE int igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::GetFirstVertexIndex(int v)
 {
   return Fcut(VF[v][0],VFi[v][0]);
 }
 
 ///fix the vertices which are flagged as fixed
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FixBlockedVertex()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::FixBlockedVertex()
 {
   int offset_row = num_cut_constraint*2;
 
@@ -798,7 +800,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FixBlockedVertex
 ///HANDLING SINGULARITY
 //set the singularity round to integer location
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddSingularityRound()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::AddSingularityRound()
 {
   for (unsigned int v=0;v<V.rows();v++)
   {
@@ -812,7 +814,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddSingularityRo
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddToRoundVertices(std::vector<int> ids)
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::AddToRoundVertices(std::vector<int> ids)
 {
   for (size_t i = 0; i < ids.size(); ++i)
   {
@@ -826,7 +828,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AddToRoundVertic
 
 ///START GENERIC SYSTEM FUNCTIONS
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildLaplacianMatrix(double vfscale)
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::BuildLaplacianMatrix(double vfscale)
 {
   Eigen::VectorXi idx  = Eigen::VectorXi::LinSpaced(Vcut.rows(), 0, 2*Vcut.rows()-2);
   Eigen::VectorXi idx2 = Eigen::VectorXi::LinSpaced(Vcut.rows(), 1, 2*Vcut.rows()-1);
@@ -863,7 +865,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildLaplacianMa
 
 ///find different sized of the system
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindSizes()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::FindSizes()
 {
   ///find the vertex that need to be fixed
   FindFixedVert();
@@ -902,7 +904,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindSizes()
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AllocateSystem()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::AllocateSystem()
 {
   Lhs.resize(n_vert_vars * 2, n_vert_vars * 2);
   Constraints.resize(num_constraint_equations, num_total_vars);
@@ -917,7 +919,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::AllocateSystem()
 
 ///intitialize the whole matrix
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::InitMatrix()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::InitMatrix()
 {
   FindSizes();
   AllocateSystem();
@@ -926,7 +928,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::InitMatrix()
 ///map back coordinates after that
 ///the system has been solved
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::MapCoords()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::MapCoords()
 {
   ///map coords to faces
   for (unsigned int f=0;f<Fcut.rows();f++)
@@ -956,7 +958,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::MapCoords()
 
 ///set the constraints for the inter-range cuts
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildSeamConstraintsExplicitTranslation()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::BuildSeamConstraintsExplicitTranslation()
 {
   ///current constraint row
   int constr_row = 0;
@@ -1006,7 +1008,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildSeamConstra
 
 ///set the constraints for the inter-range cuts
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildUserDefinedConstraints()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::BuildUserDefinedConstraints()
 {
   /// the user defined constraints are at the end
   int offset_row = num_cut_constraint*2 + n_fixed_vars*2;
@@ -1030,7 +1032,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::BuildUserDefined
 
 ///call of the mixed integer solver
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::MixedIntegerSolve(double cone_grid_res,
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::MixedIntegerSolve(double cone_grid_res,
                                                                           bool direct_round,
                                                                           int localIter)
 {
@@ -1120,14 +1122,14 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::MixedIntegerSolv
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::clearUserConstraint()
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::clearUserConstraint()
 {
   num_userdefined_constraint = 0;
   userdefined_constraints.clear();
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::addSharpEdgeConstraint(int fid, int vid)
+IGL_INLINE void igl::copyleft::comiso::PoissonSolver<DerivedV, DerivedF>::addSharpEdgeConstraint(int fid, int vid)
 {
   // prepare constraint
   std::vector<int> c(Handle_SystemInfo.num_vert_variables*2 + 1);
@@ -1167,7 +1169,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::addSharpEdgeCons
 
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::MIQ_class(const Eigen::PlainObjectBase<DerivedV> &V_,
+IGL_INLINE igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::MIQ_class(const Eigen::PlainObjectBase<DerivedV> &V_,
                                                                    const Eigen::PlainObjectBase<DerivedF> &F_,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD1_combed,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD2_combed,
@@ -1237,7 +1239,7 @@ F(F_)
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE void igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::extractUV(Eigen::PlainObjectBase<DerivedU> &UV_out,
+IGL_INLINE void igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::extractUV(Eigen::PlainObjectBase<DerivedU> &UV_out,
                                                                         Eigen::PlainObjectBase<DerivedF> &FUV_out)
 {
   UV_out = this->UV_out;
@@ -1245,7 +1247,7 @@ IGL_INLINE void igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::extractUV(
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE int igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::NumFlips(const Eigen::MatrixXd& WUV)
+IGL_INLINE int igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::NumFlips(const Eigen::MatrixXd& WUV)
 {
   int numFl=0;
   for (unsigned int i=0;i<F.rows();i++)
@@ -1257,7 +1259,7 @@ IGL_INLINE int igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::NumFlips(co
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE double igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::Distortion(int f, double h, const Eigen::MatrixXd& WUV)
+IGL_INLINE double igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::Distortion(int f, double h, const Eigen::MatrixXd& WUV)
 {
   assert(h > 0);
 
@@ -1345,7 +1347,7 @@ IGL_INLINE double igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::Distorti
 //  @return     distortion laplacian for f
 ///////////////////////////////////////////////////////////////////////////
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE double igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::LaplaceDistortion(const int f, double h, const Eigen::MatrixXd& WUV)
+IGL_INLINE double igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::LaplaceDistortion(const int f, double h, const Eigen::MatrixXd& WUV)
 {
   double mydist = Distortion(f, h, WUV);
   double lapl=0;
@@ -1358,7 +1360,7 @@ IGL_INLINE double igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::LaplaceD
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::updateStiffeningJacobianDistorsion(double grad_size, const Eigen::MatrixXd& WUV)
+IGL_INLINE bool igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::updateStiffeningJacobianDistorsion(double grad_size, const Eigen::MatrixXd& WUV)
 {
   bool flipped = NumFlips(WUV)>0;
 
@@ -1394,7 +1396,7 @@ IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::updateStif
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(const Eigen::Vector2d &uv0,
+IGL_INLINE bool igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(const Eigen::Vector2d &uv0,
                                                                         const Eigen::Vector2d &uv1,
                                                                         const Eigen::Vector2d &uv2)
 {
@@ -1406,7 +1408,7 @@ IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(
+IGL_INLINE bool igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(
   const int i, const Eigen::MatrixXd& WUV)
 {
   Eigen::Vector2d uv0,uv1,uv2;
@@ -1421,7 +1423,7 @@ IGL_INLINE bool igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::IsFlipped(
 
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE void igl::comiso::miq(
+IGL_INLINE void igl::copyleft::comiso::miq(
   const Eigen::PlainObjectBase<DerivedV> &V,
   const Eigen::PlainObjectBase<DerivedF> &F,
   const Eigen::PlainObjectBase<DerivedV> &PD1_combed,
@@ -1443,7 +1445,7 @@ IGL_INLINE void igl::comiso::miq(
 {
   GradientSize = GradientSize/(V.colwise().maxCoeff()-V.colwise().minCoeff()).norm();
 
-  igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU> miq(V,
+  igl::copyleft::comiso::MIQ_class<DerivedV, DerivedF, DerivedU> miq(V,
     F,
     PD1_combed,
     PD2_combed,
@@ -1466,7 +1468,7 @@ IGL_INLINE void igl::comiso::miq(
 }
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
-IGL_INLINE void igl::comiso::miq(
+IGL_INLINE void igl::copyleft::comiso::miq(
     const Eigen::PlainObjectBase<DerivedV> &V,
     const Eigen::PlainObjectBase<DerivedF> &F,
     const Eigen::PlainObjectBase<DerivedV> &PD1,
@@ -1502,7 +1504,7 @@ IGL_INLINE void igl::comiso::miq(
   Eigen::PlainObjectBase<DerivedV> PD1_combed, PD2_combed;
   igl::comb_frame_field(V, F, PD1, PD2, BIS1_combed, BIS2_combed, PD1_combed, PD2_combed);
 
-  igl::comiso::miq(V,
+  igl::copyleft::comiso::miq(V,
            F,
            PD1_combed,
            PD2_combed,
@@ -1525,7 +1527,7 @@ IGL_INLINE void igl::comiso::miq(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::comiso::miq<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
-template void igl::comiso::miq<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -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::Matrix<int, -1, 3, 0, -1, 3> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 3, 0, -1, 3> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
-template void igl::comiso::miq<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
+template void igl::copyleft::comiso::miq<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
+template void igl::copyleft::comiso::miq<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -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::Matrix<int, -1, 3, 0, -1, 3> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 3, 0, -1, 3> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
+template void igl::copyleft::comiso::miq<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -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> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, double, double, bool, int, int, bool, bool, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >);
 #endif

+ 3 - 0
include/igl/comiso/miq.h → include/igl/copyleft/comiso/miq.h

@@ -13,6 +13,8 @@
 
 namespace igl
 {
+  namespace copyleft
+  {
   namespace comiso
   {
   // Global seamless parametrization aligned with a given per-face jacobian (PD1,PD2).
@@ -89,6 +91,7 @@ namespace igl
       std::vector<std::vector<int> > hardFeatures = std::vector<std::vector<int> >());
   };
 };
+};
 #ifndef IGL_STATIC_LIBRARY
 #include "miq.cpp"
 #endif

+ 29 - 25
include/igl/comiso/nrosy.cpp → include/igl/copyleft/comiso/nrosy.cpp

@@ -8,7 +8,7 @@
 
 #include "nrosy.h"
 
-#include <igl/comiso/nrosy.h>
+#include <igl/copyleft/comiso/nrosy.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/edge_topology.h>
 #include <igl/per_face_normals.h>
@@ -27,6 +27,9 @@
 
 namespace igl
 {
+namespace copyleft
+{
+
 namespace comiso
 {
 class NRosyField
@@ -150,9 +153,10 @@ private:
 };
 
 } // NAMESPACE COMISO
+} // NAMESPACE COPYLEFT
 } // NAMESPACE IGL
 
-igl::comiso::NRosyField::NRosyField(const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
+igl::copyleft::comiso::NRosyField::NRosyField(const Eigen::MatrixXd& _V, const Eigen::MatrixXi& _F)
 {
   using namespace std;
   using namespace Eigen;
@@ -207,14 +211,14 @@ igl::comiso::NRosyField::NRosyField(const Eigen::MatrixXd& _V, const Eigen::Matr
   softAlpha = 0.5;
 }
 
-void igl::comiso::NRosyField::setSoftAlpha(double alpha)
+void igl::copyleft::comiso::NRosyField::setSoftAlpha(double alpha)
 {
   assert(alpha >= 0 && alpha < 1);
   softAlpha = alpha;
 }
 
 
-void igl::comiso::NRosyField::prepareSystemMatrix(const int N)
+void igl::copyleft::comiso::NRosyField::prepareSystemMatrix(const int N)
 {
   using namespace std;
   using namespace Eigen;
@@ -395,7 +399,7 @@ void igl::comiso::NRosyField::prepareSystemMatrix(const int N)
 //  s2.close();
 }
 
-void igl::comiso::NRosyField::solveNoRoundings()
+void igl::copyleft::comiso::NRosyField::solveNoRoundings()
 {
   using namespace std;
   using namespace Eigen;
@@ -417,7 +421,7 @@ void igl::comiso::NRosyField::solveNoRoundings()
       p[i] = roundl(x[tag_p[i]]);
 }
 
-void igl::comiso::NRosyField::solveRoundings()
+void igl::copyleft::comiso::NRosyField::solveRoundings()
 {
   using namespace std;
   using namespace Eigen;
@@ -471,13 +475,13 @@ void igl::comiso::NRosyField::solveRoundings()
 }
 
 
-void igl::comiso::NRosyField::roundAndFix()
+void igl::copyleft::comiso::NRosyField::roundAndFix()
 {
   for(unsigned i=0; i<p.rows(); ++i)
     pFixed[i] = true;
 }
 
-void igl::comiso::NRosyField::roundAndFixToZero()
+void igl::copyleft::comiso::NRosyField::roundAndFixToZero()
 {
   for(unsigned i=0; i<p.rows(); ++i)
   {
@@ -486,7 +490,7 @@ void igl::comiso::NRosyField::roundAndFixToZero()
   }
 }
 
-void igl::comiso::NRosyField::solve(const int N)
+void igl::copyleft::comiso::NRosyField::solve(const int N)
 {
   // Reduce the search space by fixing matchings
   reduceSpace();
@@ -514,19 +518,19 @@ void igl::comiso::NRosyField::solve(const int N)
   findCones(N);
 }
 
-void igl::comiso::NRosyField::setConstraintHard(const int fid, const Eigen::Vector3d& v)
+void igl::copyleft::comiso::NRosyField::setConstraintHard(const int fid, const Eigen::Vector3d& v)
 {
   isHard[fid] = true;
   hard(fid) = convert3DtoLocal(fid, v);
 }
 
-void igl::comiso::NRosyField::setConstraintSoft(const int fid, const double w, const Eigen::Vector3d& v)
+void igl::copyleft::comiso::NRosyField::setConstraintSoft(const int fid, const double w, const Eigen::Vector3d& v)
 {
   wSoft(fid) = w;
   soft(fid) = convert3DtoLocal(fid, v);
 }
 
-void igl::comiso::NRosyField::resetConstraints()
+void igl::copyleft::comiso::NRosyField::resetConstraints()
 {
   using namespace std;
   using namespace Eigen;
@@ -540,7 +544,7 @@ void igl::comiso::NRosyField::resetConstraints()
   soft   = VectorXd::Zero(F.rows());
 }
 
-Eigen::MatrixXd igl::comiso::NRosyField::getFieldPerFace()
+Eigen::MatrixXd igl::copyleft::comiso::NRosyField::getFieldPerFace()
 {
   using namespace std;
   using namespace Eigen;
@@ -551,7 +555,7 @@ Eigen::MatrixXd igl::comiso::NRosyField::getFieldPerFace()
   return result;
 }
 
-Eigen::MatrixXd igl::comiso::NRosyField::getFFieldPerFace()
+Eigen::MatrixXd igl::copyleft::comiso::NRosyField::getFFieldPerFace()
 {
   using namespace std;
   using namespace Eigen;
@@ -572,7 +576,7 @@ Eigen::MatrixXd igl::comiso::NRosyField::getFFieldPerFace()
 }
 
 
-void igl::comiso::NRosyField::computek()
+void igl::copyleft::comiso::NRosyField::computek()
 {
   using namespace std;
   using namespace Eigen;
@@ -671,7 +675,7 @@ void igl::comiso::NRosyField::computek()
 
 }
 
-void igl::comiso::NRosyField::reduceSpace()
+void igl::copyleft::comiso::NRosyField::reduceSpace()
 {
   using namespace std;
   using namespace Eigen;
@@ -768,7 +772,7 @@ void igl::comiso::NRosyField::reduceSpace()
 
 }
 
-double igl::comiso::NRosyField::convert3DtoLocal(unsigned fid, const Eigen::Vector3d& v)
+double igl::copyleft::comiso::NRosyField::convert3DtoLocal(unsigned fid, const Eigen::Vector3d& v)
 {
   using namespace std;
   using namespace Eigen;
@@ -780,7 +784,7 @@ double igl::comiso::NRosyField::convert3DtoLocal(unsigned fid, const Eigen::Vect
   return atan2(vp(1),vp(0));
 }
 
-Eigen::Vector3d igl::comiso::NRosyField::convertLocalto3D(unsigned fid, double a)
+Eigen::Vector3d igl::copyleft::comiso::NRosyField::convertLocalto3D(unsigned fid, double a)
 {
   using namespace std;
   using namespace Eigen;
@@ -789,7 +793,7 @@ Eigen::Vector3d igl::comiso::NRosyField::convertLocalto3D(unsigned fid, double a
   return vp.transpose() * TPs[fid];
 }
 
-Eigen::VectorXd igl::comiso::NRosyField::angleDefect()
+Eigen::VectorXd igl::copyleft::comiso::NRosyField::angleDefect()
 {
   Eigen::VectorXd A = Eigen::VectorXd::Constant(V.rows(),-2*M_PI);
 
@@ -808,7 +812,7 @@ Eigen::VectorXd igl::comiso::NRosyField::angleDefect()
   return A;
 }
 
-void igl::comiso::NRosyField::findCones(int N)
+void igl::copyleft::comiso::NRosyField::findCones(int N)
 {
   // Compute I0, see http://www.graphics.rwth-aachen.de/media/papers/bommes_zimmer_2009_siggraph_011.pdf for details
 
@@ -865,12 +869,12 @@ void igl::comiso::NRosyField::findCones(int N)
   singularityIndex = I;
 }
 
-Eigen::VectorXd igl::comiso::NRosyField::getSingularityIndexPerVertex()
+Eigen::VectorXd igl::copyleft::comiso::NRosyField::getSingularityIndexPerVertex()
 {
   return singularityIndex;
 }
 
-IGL_INLINE void igl::comiso::nrosy(
+IGL_INLINE void igl::copyleft::comiso::nrosy(
   const Eigen::MatrixXd& V,
   const Eigen::MatrixXi& F,
   const Eigen::VectorXi& b,
@@ -885,7 +889,7 @@ IGL_INLINE void igl::comiso::nrosy(
   )
 {
   // Init solver
-  igl::comiso::NRosyField solver(V,F);
+  igl::copyleft::comiso::NRosyField solver(V,F);
 
   // Add hard constraints
   for (unsigned i=0; i<b.size();++i)
@@ -909,7 +913,7 @@ IGL_INLINE void igl::comiso::nrosy(
 }
 
 
-IGL_INLINE void igl::comiso::nrosy(
+IGL_INLINE void igl::copyleft::comiso::nrosy(
                            const Eigen::MatrixXd& V,
                            const Eigen::MatrixXi& F,
                            const Eigen::VectorXi& b,
@@ -920,7 +924,7 @@ IGL_INLINE void igl::comiso::nrosy(
                            )
 {
   // Init solver
-  igl::comiso::NRosyField solver(V,F);
+  igl::copyleft::comiso::NRosyField solver(V,F);
 
   // Add hard constraints
   for (unsigned i=0; i<b.size();++i)

+ 3 - 0
include/igl/comiso/nrosy.h → include/igl/copyleft/comiso/nrosy.h

@@ -16,6 +16,8 @@
 
 namespace igl
 {
+  namespace copyleft
+  {
   namespace comiso
   {
     // Generate a N-RoSy field from a sparse set of constraints
@@ -61,6 +63,7 @@ namespace igl
 
   }
 }
+}
 
 #ifndef IGL_STATIC_LIBRARY
 #  include "nrosy.cpp"

+ 3 - 6
include/igl/copyleft/boolean/from_cork_mesh.cpp → include/igl/copyleft/cork/from_cork_mesh.cpp

@@ -5,13 +5,12 @@
 // 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"
 
 template <
   typename DerivedV,
   typename DerivedF>
-IGL_INLINE void igl::copyleft::boolean::from_cork_mesh(
+IGL_INLINE void igl::copyleft::cork::from_cork_mesh(
   const CorkTriMesh & mesh,
   Eigen::PlainObjectBase<DerivedV > & V,
   Eigen::PlainObjectBase<DerivedF > & F)
@@ -37,8 +36,6 @@ IGL_INLINE void igl::copyleft::boolean::from_cork_mesh(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::copyleft::boolean::from_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::boolean::from_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
-#endif
-
+template void igl::copyleft::cork::from_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cork::from_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
 #endif

+ 3 - 5
include/igl/copyleft/boolean/from_cork_mesh.h → include/igl/copyleft/cork/from_cork_mesh.h

@@ -5,9 +5,8 @@
 // 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_COPYLEFT_BOOLEAN_FROM_CORK_MESH_H
-#define IGL_COPYLEFT_BOOLEAN_FROM_CORK_MESH_H
-#ifndef IGL_NO_CORK
+#ifndef IGL_COPYLEFT_CORK_FROM_CORK_MESH_H
+#define IGL_COPYLEFT_CORK_FROM_CORK_MESH_H
 #include "../../igl_inline.h"
 #include <cork.h>
 #include <Eigen/Core>
@@ -15,7 +14,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cork
     {
       // Convert cork's triangle mesh representation to a (V,F) mesh.
       //
@@ -38,4 +37,3 @@ namespace igl
 #  include "from_cork_mesh.cpp"
 #endif
 #endif
-#endif

+ 4 - 6
include/igl/copyleft/boolean/mesh_boolean_cork.cpp → include/igl/copyleft/cork/mesh_boolean.cpp

@@ -5,8 +5,7 @@
 // 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 "mesh_boolean.h"
 #include "to_cork_mesh.h"
 #include "from_cork_mesh.h"
 
@@ -17,7 +16,7 @@ template <
   typename DerivedFB,
   typename DerivedVC,
   typename DerivedFC>
-IGL_INLINE void igl::copyleft::boolean::mesh_boolean_cork(
+IGL_INLINE void igl::copyleft::cork::mesh_boolean(
   const Eigen::PlainObjectBase<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -94,8 +93,7 @@ IGL_INLINE void igl::copyleft::boolean::mesh_boolean_cork(
 }
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::copyleft::boolean::mesh_boolean_cork<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template void igl::copyleft::boolean::mesh_boolean_cork<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
+template void igl::copyleft::cork::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cork::mesh_boolean<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
 #endif
 
-#endif

+ 6 - 8
include/igl/copyleft/boolean/mesh_boolean_cork.h → include/igl/copyleft/cork/mesh_boolean.h

@@ -5,10 +5,9 @@
 // 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_COPYLEFT_BOOLEAN_MESH_BOOLEAN_CORK_H
-#define IGL_COPYLEFT_BOOLEAN_MESH_BOOLEAN_CORK_H
-#ifndef IGL_NO_CORK
-#include "MeshBooleanType.h"
+#ifndef IGL_COPYLEFT_CORK_MESH_BOOLEAN_H
+#define IGL_COPYLEFT_CORK_MESH_BOOLEAN_H
+#include "../../MeshBooleanType.h"
 #include "../../igl_inline.h"
 #include <Eigen/Core>
 #include <cork.h> // for consistent uint
@@ -17,7 +16,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cork
     {
       // Compute a boolean operation on two input meshes using the cork library.
       //
@@ -37,7 +36,7 @@ namespace igl
         typename DerivedFB,
         typename DerivedVC,
         typename DerivedFC>
-      IGL_INLINE void mesh_boolean_cork(
+      IGL_INLINE void mesh_boolean(
         const Eigen::PlainObjectBase<DerivedVA > & VA,
         const Eigen::PlainObjectBase<DerivedFA > & FA,
         const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -50,8 +49,7 @@ namespace igl
 }
 
 #ifndef IGL_STATIC_LIBRARY
-#  include "mesh_boolean_cork.cpp"
-#endif
+#  include "mesh_boolean.cpp"
 #endif
 
 #endif

+ 4 - 6
include/igl/copyleft/boolean/to_cork_mesh.cpp → include/igl/copyleft/cork/to_cork_mesh.cpp

@@ -5,12 +5,11 @@
 // 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 <
   typename DerivedV,
   typename DerivedF>
-IGL_INLINE void igl::copyleft::boolean::to_cork_mesh(
+IGL_INLINE void igl::copyleft::cork::to_cork_mesh(
   const Eigen::PlainObjectBase<DerivedV > & V,
   const Eigen::PlainObjectBase<DerivedF > & F,
   CorkTriMesh & mesh)
@@ -20,7 +19,7 @@ IGL_INLINE void igl::copyleft::boolean::to_cork_mesh(
   assert((V.cols() == 0 || V.cols() == 3) && "Vertices should be in 3D.");
   mesh.n_triangles = F.rows();
   mesh.n_vertices = V.rows();
-  mesh.vertices = new double[mesh.n_vertices*3];
+  mesh.vertices = new float[mesh.n_vertices*3];
   mesh.triangles = new uint[mesh.n_triangles*3];
   for(size_t v = 0;v<mesh.n_vertices;v++)
   {
@@ -39,7 +38,6 @@ IGL_INLINE void igl::copyleft::boolean::to_cork_mesh(
 }
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::copyleft::boolean::to_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CorkTriMesh&);
-template void igl::copyleft::boolean::to_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, CorkTriMesh&);
-#endif
+template void igl::copyleft::cork::to_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, CorkTriMesh&);
+template void igl::copyleft::cork::to_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, CorkTriMesh&);
 #endif

+ 3 - 5
include/igl/copyleft/boolean/to_cork_mesh.h → include/igl/copyleft/cork/to_cork_mesh.h

@@ -5,9 +5,8 @@
 // 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_COPYLEFT_BOOLEAN_TO_CORK_MESH_H
-#define IGL_COPYLEFT_BOOLEAN_TO_CORK_MESH_H
-#ifndef IGL_NO_CORK
+#ifndef IGL_COPYLEFT_CORK_TO_CORK_MESH_H
+#define IGL_COPYLEFT_CORK_TO_CORK_MESH_H
 #include "../../igl_inline.h"
 #include <cork.h>
 #include <Eigen/Core>
@@ -15,7 +14,7 @@ namespace igl
 {
   namespace copyleft
   {
-    namespace boolean
+    namespace cork
     {
       // Convert a (V,F) mesh to a cork's triangle mesh representation.
       //
@@ -38,4 +37,3 @@ namespace igl
 #  include "to_cork_mesh.cpp"
 #endif
 #endif
-#endif

+ 5 - 5
include/igl/cross_field_missmatch.cpp

@@ -19,7 +19,7 @@
 #include <igl/rotation_matrix_from_directions.h>
 
 namespace igl {
-  template <typename DerivedV, typename DerivedF>
+  template <typename DerivedV, typename DerivedF, typename DerivedM>
   class MissMatchCalculator
   {
   public:
@@ -93,7 +93,7 @@ public:
     igl::triangle_triangle_adjacency(F,TT,TTi);
   }
 
-  inline void calculateMissmatch(Eigen::PlainObjectBase<DerivedF> &Handle_MMatch)
+  inline void calculateMissmatch(Eigen::PlainObjectBase<DerivedM> &Handle_MMatch)
   {
     Handle_MMatch.setConstant(F.rows(),3,-1);
     for (size_t i=0;i<F.rows();i++)
@@ -110,13 +110,13 @@ public:
 
 };
 }
-template <typename DerivedV, typename DerivedF>
+template <typename DerivedV, typename DerivedF, typename DerivedM>
 IGL_INLINE void igl::cross_field_missmatch(const Eigen::PlainObjectBase<DerivedV> &V,
                                            const Eigen::PlainObjectBase<DerivedF> &F,
                                            const Eigen::PlainObjectBase<DerivedV> &PD1,
                                            const Eigen::PlainObjectBase<DerivedV> &PD2,
                                            const bool isCombed,
-                                           Eigen::PlainObjectBase<DerivedF> &missmatch)
+                                           Eigen::PlainObjectBase<DerivedM> &missmatch)
 {
   DerivedV PD1_combed;
   DerivedV PD2_combed;
@@ -128,7 +128,7 @@ IGL_INLINE void igl::cross_field_missmatch(const Eigen::PlainObjectBase<DerivedV
     PD1_combed = PD1;
     PD2_combed = PD2;
   }
-  igl::MissMatchCalculator<DerivedV, DerivedF> sf(V, F, PD1_combed, PD2_combed);
+  igl::MissMatchCalculator<DerivedV, DerivedF, DerivedM> sf(V, F, PD1_combed, PD2_combed);
   sf.calculateMissmatch(missmatch);
 }
 

+ 2 - 2
include/igl/cross_field_missmatch.h

@@ -28,13 +28,13 @@ namespace igl
   //                    across all face edges
   //
 
-  template <typename DerivedV, typename DerivedF>
+  template <typename DerivedV, typename DerivedF, typename DerivedM>
   IGL_INLINE void cross_field_missmatch(const Eigen::PlainObjectBase<DerivedV> &V,
                                         const Eigen::PlainObjectBase<DerivedF> &F,
                                         const Eigen::PlainObjectBase<DerivedV> &PD1,
                                         const Eigen::PlainObjectBase<DerivedV> &PD2,
                                         const bool isCombed,
-                                        Eigen::PlainObjectBase<DerivedF> &missmatch);
+                                        Eigen::PlainObjectBase<DerivedM> &missmatch);
 }
 #ifndef IGL_STATIC_LIBRARY
 #include "cross_field_missmatch.cpp"

+ 0 - 1
include/igl/eigs.cpp

@@ -1,6 +1,5 @@
 #include "eigs.h"
 
-#include "read_triangle_mesh.h"
 #include "cotmatrix.h"
 #include "sort.h"
 #include "slice.h"

+ 1 - 0
include/igl/embree/reorient_facets_raycast.cpp

@@ -254,4 +254,5 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::embree::reorient_facets_raycast<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::embree::reorient_facets_raycast<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<bool, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, int, bool, bool, bool, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 2 - 6
include/igl/find_cross_field_singularities.cpp

@@ -68,13 +68,9 @@ IGL_INLINE void igl::find_cross_field_singularities(const Eigen::PlainObjectBase
                                                     Eigen::PlainObjectBase<DerivedO> &singularityIndex,
                                                     bool isCombed)
 {
-  // Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > Handle_MMatch;
-  // Eigen::PlainObjectBase<Eigen::Matrix<int,  Eigen::Dynamic, 3> > Handle_MMatch;
-  // Eigen::Matrix<int, Eigen::Dynamic, 3> Handle_MMatch;
   Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
-  // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
-  // Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> Handle_MMatch;
-  igl::cross_field_missmatch<DerivedV, DerivedF>(V, F, PD1, PD2, isCombed, Handle_MMatch);
+
+  igl::cross_field_missmatch(V, F, PD1, PD2, isCombed, Handle_MMatch);
   igl::find_cross_field_singularities(V, F, Handle_MMatch, isSingularity, singularityIndex);
 }
 

+ 5 - 0
include/igl/in_element.cpp

@@ -58,3 +58,8 @@ IGL_INLINE void igl::in_element(
   I.resize(Qr,Ele.rows());
   I.setFromTriplets(IJV.begin(),IJV.end());
 }
+
+#ifdef IGL_STATIC_LIBRARY
+template void igl::in_element<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
+template void igl::in_element<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
+#endif

+ 3 - 1
include/igl/jet.cpp

@@ -124,7 +124,7 @@ IGL_INLINE void igl::jet(
   }
 }
 
-#ifndef IGL_NO_HEADER
+#ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // generated by autoexplicit.sh
 template void igl::jet<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
@@ -136,4 +136,6 @@ template void igl::jet<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double
 template void igl::jet<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::jet<float>(float, float&, float&, float&);
 template void igl::jet<Eigen::Matrix<float, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> > const&, double, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::jet<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, double, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+
 #endif

+ 1 - 0
include/igl/massmatrix.cpp

@@ -158,5 +158,6 @@ IGL_INLINE void igl::massmatrix(
 template void igl::massmatrix<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 4, 0, -1, 4>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 4, 0, -1, 4> > const&, igl::MassMatrixType, Eigen::SparseMatrix<double, 0, int>&);
 // generated by autoexplicit.sh
 template void igl::massmatrix<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, igl::MassMatrixType, Eigen::SparseMatrix<double, 0, int>&);
+template void igl::massmatrix<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, igl::MassMatrixType, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::massmatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MassMatrixType, Eigen::SparseMatrix<double, 0, int>&);
 #endif

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

@@ -53,4 +53,6 @@ IGL_INLINE void igl::matlab::parse_rhs_index(
 template void igl::matlab::parse_rhs_index<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(mxArray_tag const**, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 template void igl::matlab::parse_rhs_index<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(mxArray_tag const**, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::matlab::parse_rhs_double<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(mxArray_tag const**, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::matlab::parse_rhs_index<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(mxArray_tag const**, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
+template void igl::matlab::parse_rhs_double<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(mxArray_tag const**, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&);
 #endif

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

@@ -57,6 +57,42 @@ IGL_INLINE void igl::matlab::prepare_lhs_index(
   return prepare_lhs_double(Vd,plhs);
 }
 
+template <typename Vtype>
+IGL_INLINE void igl::matlab::prepare_lhs_double(
+  const Eigen::SparseMatrix<Vtype> & M,
+  mxArray *plhs[])
+{
+  using namespace std;
+  const int m = M.rows();
+  const int n = M.cols();
+  // THIS WILL NOT WORK FOR ROW-MAJOR
+  assert(n==M.outerSize());
+  const int nzmax = M.nonZeros();
+  plhs[0] = mxCreateSparse(m, n, nzmax, mxREAL);
+  mxArray * mx_data = plhs[0];
+  // Copy data immediately
+  double * pr = mxGetPr(mx_data);
+  mwIndex * ir = mxGetIr(mx_data);
+  mwIndex * jc = mxGetJc(mx_data);
+
+  // Iterate over outside
+  int k = 0;
+  for(int j=0; j<M.outerSize();j++)
+  {
+    jc[j] = k;
+    // Iterate over inside
+    for(typename Eigen::SparseMatrix<Vtype>::InnerIterator it (M,j); it; ++it)
+    {
+      // copy (cast to double)
+      pr[k] = it.value();
+      ir[k] = it.row();
+      k++;
+    }
+  }
+  jc[M.outerSize()] = k;
+
+}
+
 #ifdef IGL_STATIC_LIBRARY
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
@@ -64,4 +100,7 @@ template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, -1, 0, -
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_logical<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
+template void igl::matlab::prepare_lhs_logical<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
+template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, mxArray_tag**);
+template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, mxArray_tag**);
 #endif

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

@@ -10,6 +10,7 @@
 #include <igl/igl_inline.h>
 #include <mex.h>
 #include <Eigen/Dense>
+#include <Eigen/Sparse>
 namespace igl
 {
   namespace matlab
@@ -34,6 +35,11 @@ namespace igl
     IGL_INLINE void prepare_lhs_index(
       const Eigen::PlainObjectBase<DerivedV> & V,
       mxArray *plhs[]);
+    // SparseMatrix
+    template <typename Vtype>
+    IGL_INLINE void prepare_lhs_double(
+      const Eigen::SparseMatrix<Vtype> & V,
+      mxArray *plhs[]);
   };
 }
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 1
include/igl/mosek/mosek_quadprog.h

@@ -28,7 +28,7 @@ namespace igl
       // Double parameters
       std::map<MSKdparame,double> douparam;
       // Default values
-      MosekData();
+      IGL_INLINE MosekData();
     };
     // Solve a convex quadratic optimization problem with linear and constant
     // bounds, that is:

+ 2 - 1
include/igl/per_vertex_normals.cpp

@@ -45,7 +45,7 @@ IGL_INLINE void igl::per_vertex_normals(
   // Resize for output
   N.setZero(V.rows(),3);
 
-  Eigen::Matrix<typename DerivedN::Scalar,DerivedF::RowsAtCompileTime,3> 
+  Eigen::Matrix<typename DerivedN::Scalar,DerivedF::RowsAtCompileTime,3>
     W(F.rows(),3);
   switch(weighting)
   {
@@ -108,4 +108,5 @@ template void igl::per_vertex_normals<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Ei
 template void igl::per_vertex_normals<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_vertex_normals<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::per_vertex_normals<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&);
+template void igl::per_vertex_normals<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::PerVertexNormalsWeightingType, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 8 - 18
include/igl/png/render_to_png.cpp

@@ -6,18 +6,9 @@
 // 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 "render_to_png.h"
-#include <YImage.hpp>
+#include <stb_image_write.h>
 
-#ifdef __APPLE__
-#  include <OpenGL/gl.h>
-#else
-#  ifdef _WIN32
-#    define NOMINMAX
-#    include <Windows.h>
-#    undef NOMINMAX
-#  endif
-#  include <GL/gl.h>
-#endif
+#include "../opengl/OpenGL_convenience.h"
 
 IGL_INLINE bool igl::png::render_to_png(
   const std::string png_file,
@@ -26,8 +17,7 @@ IGL_INLINE bool igl::png::render_to_png(
   const bool alpha,
   const bool fast)
 {
-  YImage *img = new YImage();
-  img->resize(width,height);
+  unsigned char * data = new unsigned char[width*height];
   glReadPixels(
     0,
     0,
@@ -35,18 +25,18 @@ IGL_INLINE bool igl::png::render_to_png(
     height,
     GL_RGBA,
     GL_UNSIGNED_BYTE,
-    img->data());
-  img->flip();
+    data);
+  //img->flip();
   if(!alpha)
   {
     for(int i = 0;i<width;i++)
     for(int j = 0;j<height;j++)
     {
-      img->at(i,j).a = 255;
+      data[4*(i+j*width)+3] = 255;
     }
   }
-  bool ret = img->save(png_file.c_str(),fast);
-  delete img;
+  bool ret = stbi_write_png(png_file.c_str(), width, height, 4, data, width*sizeof(unsigned char));
+  delete [] data;
   return ret;
 }
 

+ 15 - 29
include/igl/png/render_to_png_async.cpp

@@ -1,46 +1,33 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "render_to_png_async.h"
-#include <YImage.hpp>
+#include <stb_image_write.h>
 
-#ifdef __APPLE__
-#  include <OpenGL/gl.h>
-#else
-#  ifdef _WIN32
-#    define NOMINMAX
-#    include <Windows.h>
-#    undef NOMINMAX
-#  endif
-#  include <GL/gl.h>
-#endif
+#include "../opengl/OpenGL_convenience.h"
 
-  
 static IGL_INLINE bool render_to_png_async_helper(
-  YImage * img,
+  unsigned char * img, int width, int height,
   const std::string png_file,
   const bool alpha,
   const bool fast)
 {
-
-  img->flip();
-  const int width = img->width();
-  const int height = img->height();
+  //img->flip();
   if(!alpha)
   {
     for(int i = 0;i<width;i++)
     for(int j = 0;j<height;j++)
     {
-      img->at(i,j).a = 255;
+      img[4*(i+j*width)+3] = 255;
     }
   }
 
-  bool ret = img->save(png_file.c_str(),fast);
-  delete img;
+  bool ret = stbi_write_png(png_file.c_str(), width, height, 4, img, width*sizeof(unsigned char));
+  delete [] img;
   return ret;
 }
 
@@ -52,8 +39,7 @@ IGL_INLINE std::thread igl::png::render_to_png_async(
   const bool fast)
 {
   // Part that should serial
-  YImage * img = new YImage();
-  img->resize(width,height);
+  unsigned char * data = new unsigned char[width*height];
   glReadPixels(
     0,
     0,
@@ -61,9 +47,9 @@ IGL_INLINE std::thread igl::png::render_to_png_async(
     height,
     GL_RGBA,
     GL_UNSIGNED_BYTE,
-    img->data());
-  // Part that should be asynchronous  
-  std::thread t(render_to_png_async_helper,img,png_file,alpha,fast);
+    data);
+  // Part that should be asynchronous
+  std::thread t(render_to_png_async_helper,data,width,height,png_file,alpha,fast);
   t.detach();
   return t;
 }

+ 4 - 5
include/igl/png/texture_from_file.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// 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 "texture_from_file.h"
 
@@ -12,7 +12,6 @@
 #include "../pathinfo.h"
 #include "../opengl/report_gl_error.h"
 #include "../opengl/texture_from_tga.h"
-#include <YImage.hpp>
 #include <string>
 #include <algorithm>
 #include <iostream>

+ 30 - 22
include/igl/png/texture_from_png.cpp

@@ -8,20 +8,22 @@
 #include "texture_from_png.h"
 
 #include "../opengl/report_gl_error.h"
-#include <YImage.hpp>
+#include <stb_image.h>
 
 IGL_INLINE bool igl::png::texture_from_png(const std::string png_file, const bool flip, GLuint & id)
 {
-  YImage yimg;
-  if(!yimg.load(png_file.c_str()))
-  {
+  int width,height,n;
+  unsigned char *data = stbi_load(png_file.c_str(), &width, &height, &n, 4);
+  if(data == NULL) {
     return false;
   }
+
   // Why do I need to flip?
-  if(flip)
+  /*if(flip)
   {
     yimg.flip();
-  }
+  }*/
+  
   glGenTextures(1, &id);
   glBindTexture(GL_TEXTURE_2D, id);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -30,8 +32,11 @@ IGL_INLINE bool igl::png::texture_from_png(const std::string png_file, const boo
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
   glTexImage2D(
     GL_TEXTURE_2D, 0, GL_RGB,
-    yimg.width(), yimg.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, yimg.data());
+    width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
   glBindTexture(GL_TEXTURE_2D, 0);
+
+  stbi_image_free(data);
+
   return true;
 }
 
@@ -49,27 +54,30 @@ IGL_INLINE bool igl::png::texture_from_png(
   Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic>& A
 )
 {
-  YImage yimg;
-  if(!yimg.load(png_file.c_str()))
-  {
+  int width,height,n;
+  unsigned char *data = stbi_load(png_file.c_str(), &width, &height, &n, 4);
+  if(data == NULL) {
     return false;
   }
 
-  R.resize(yimg.height(),yimg.width());
-  G.resize(yimg.height(),yimg.width());
-  B.resize(yimg.height(),yimg.width());
-  A.resize(yimg.height(),yimg.width());
+  R.resize(height,width);
+  G.resize(height,width);
+  B.resize(height,width);
+  A.resize(height,width);
 
-  for (unsigned j=0; j<yimg.height(); ++j)
-  {
-    for (unsigned i=0; i<yimg.width(); ++i)
-    {
-      R(i,j) = yimg.at(yimg.width()-1-i,yimg.height()-1-j).r;
-      G(i,j) = yimg.at(yimg.width()-1-i,yimg.height()-1-j).g;
-      B(i,j) = yimg.at(yimg.width()-1-i,yimg.height()-1-j).b;
-      //1A(i,j) = yimg.at(yimg.width()-1-i,yimg.height()-1-j).a;
+  for (unsigned j=0; j<height; ++j) {
+    for (unsigned i=0; i<width; ++i) {
+      // used to flip with libPNG, but I'm not sure if
+      // simply j*width + i wouldn't be better
+      // stb_image uses horizontal scanline an starts top-left corner
+      R(i,j) = data[4*( (width-1-i) + width * (height-1-j) )];
+      G(i,j) = data[4*( (width-1-i) + width * (height-1-j) ) + 1];
+      B(i,j) = data[4*( (width-1-i) + width * (height-1-j) ) + 2];
+      //A(i,j) = data[4*( (width-1-i) + width * (height-1-j) ) + 3];
     }
   }
 
+  stbi_image_free(data);
+
   return true;
 }

+ 0 - 7
include/igl/png/texture_from_png.h

@@ -10,7 +10,6 @@
 #include "../igl_inline.h"
 #include <Eigen/Core>
 #include <string>
-#include <Eigen/Core>
 
 #include "../opengl/OpenGL_convenience.h"
 
@@ -28,13 +27,7 @@ namespace igl
     // Returns true on success, false on failure
     IGL_INLINE bool texture_from_png(const std::string png_file, const bool flip, GLuint & id);
     IGL_INLINE bool texture_from_png(const std::string png_file, GLuint & id);
-  }
-}
 
-namespace igl
-{
-  namespace png
-  {
     // Read an image from a .png file and use it as a texture
     //
     // Input:

+ 1 - 1
include/igl/point_simplex_squared_distance.h

@@ -11,7 +11,7 @@
 #include <Eigen/Core>
 namespace igl
 {
-  // Determine squared distance from a point to linear simplex
+  // Determine squared distance from a point to linear simplex. 
   //
   // Inputs:
   //   p  d-long query point

+ 3 - 0
include/igl/polar_svd.cpp

@@ -72,4 +72,7 @@ template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<
 template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
 template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::polar_svd<Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,3,0,3,3>,Eigen::Matrix<float,3,1,0,3,1>,Eigen::Matrix<float,3,3,0,3,3> >(Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > const &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,1,0,3,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<float,3,3,0,3,3> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&);
+template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<float, 2, 1, 0, 2, 1>, Eigen::Matrix<float, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<float, 2, 2, 0, 2, 2> >&);
+template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
 #endif

+ 21 - 0
include/igl/project.cpp

@@ -29,9 +29,30 @@ Eigen::Matrix<Scalar,3,1> igl::project(
   return tmp.head(3);
 }
 
+template <typename DerivedV, typename Scalar, typename DerivedP>
+IGL_INLINE void igl::project(
+  const    Eigen::PlainObjectBase<DerivedV>&  V,
+  const    Eigen::Matrix<Scalar,4,4>& model,
+  const    Eigen::Matrix<Scalar,4,4>& proj,
+  const    Eigen::Matrix<Scalar,4,1>&  viewport,
+  Eigen::PlainObjectBase<DerivedP> & P)
+{
+  typedef typename DerivedP::Scalar PScalar;
+  Eigen::Matrix<PScalar,DerivedV::RowsAtCompileTime,4> HV(V.rows(),4);
+  HV.leftCols(3) = V.template cast<PScalar>();
+  HV.col(3).setConstant(1);
+  HV = (HV*model.template cast<PScalar>().transpose()*
+      proj.template cast<PScalar>().transpose()).eval();
+  HV = (HV.array().colwise()/HV.col(3).array()).eval();
+  HV = (HV.array() * 0.5 + 0.5).eval();
+  HV.col(0) = (HV.array().col(0) * viewport(2) + viewport(0)).eval();
+  HV.col(1) = (HV.array().col(1) * viewport(3) + viewport(1)).eval();
+  P = HV.leftCols(3);
+}
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template Eigen::Matrix<double, 3, 1, 0, 3, 1> igl::project<double>(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 1, 0, 4, 1> const&);
 template Eigen::Matrix<float, 3, 1, 0, 3, 1> igl::project<float>(Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&);
+template void igl::project<Eigen::Matrix<double, -1, -1, 0, -1, -1>, float, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 14 - 0
include/igl/project.h

@@ -25,6 +25,20 @@ namespace igl
     const    Eigen::Matrix<Scalar,4,4>& model,
     const    Eigen::Matrix<Scalar,4,4>& proj,
     const    Eigen::Matrix<Scalar,4,1>&  viewport);
+  // Inputs:
+  //   V  #V by 3 list of object points
+  //   model  model matrix
+  //   proj  projection matrix
+  //   viewport  viewport vector
+  // Outputs:
+  //   P  #V by 3 list of screen space points
+  template <typename DerivedV, typename Scalar, typename DerivedP>
+  IGL_INLINE void project(
+    const    Eigen::PlainObjectBase<DerivedV>&  V,
+    const    Eigen::Matrix<Scalar,4,4>& model,
+    const    Eigen::Matrix<Scalar,4,4>& proj,
+    const    Eigen::Matrix<Scalar,4,1>&  viewport,
+    Eigen::PlainObjectBase<DerivedP> & P);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 0
include/igl/project_to_line.cpp

@@ -123,4 +123,5 @@ IGL_INLINE void igl::project_to_line(
 template void igl::project_to_line<double>(double, double, double, double, double, double, double, double, double, double&, double&);
 template void igl::project_to_line<double>(double, double, double, double, double, double, double, double, double, double&, double&,double&,double&, double&);
 template void igl::project_to_line<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 1, 0, 1, 1>, Eigen::Matrix<double, 1, 1, 0, 1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 1, 0, 1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 1, 0, 1, 1> >&);
+template void igl::project_to_line<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>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 1
include/igl/quat_to_axis_angle.cpp

@@ -68,7 +68,7 @@ IGL_INLINE void igl::quat_to_axis_angle_deg(
   angle = angle*(180.0/PI);
 }
 
-#ifndef IGL_NO_HEADER
+#ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::quat_to_axis_angle<float>(float const*, float*, float&);
 template void igl::quat_to_axis_angle_deg<float>(float const*, float*, float&);

+ 56 - 17
include/igl/readSTL.cpp

@@ -53,7 +53,7 @@ IGL_INLINE bool igl::readSTL(
   // Should test for ascii
 
   // Open file, and check for error
-  FILE * stl_file = fopen(filename.c_str(),"r");
+  FILE * stl_file = fopen(filename.c_str(),"rb");
   if(NULL==stl_file)
   {
     fprintf(stderr,"IOError: %s could not be opened...\n",
@@ -63,23 +63,58 @@ IGL_INLINE bool igl::readSTL(
   V.clear();
   F.clear();
   N.clear();
-#ifndef IGL_LINE_MAX
-#  define IGL_LINE_MAX 2048
-#endif
-  char solid[IGL_LINE_MAX];
-  if(fscanf(stl_file,"%s",solid)!=1)
+  // Specifically 80 character header
+  char header[80];
+  char solid[80];
+  bool is_ascii = true;
+  if(fread(header,1,80,stl_file) != 80)
   {
-    // file too short
-    cerr<<"IOError: "<<filename<<" too short."<<endl;
+    cerr<<"IOError: "<<filename<<" too short (1)."<<endl;
     goto close_false;
   }
-  if(string("solid") == solid)
+
+  sscanf(header,"%s",solid);
+
+  if(string("solid") != solid)
+  {
+    // definitely **not** ascii 
+    is_ascii = false;
+  }else
   {
+    // might still be binary
+    char buf[4];
+    if(fread(buf,1,4,stl_file) != 4)
+    {
+      cerr<<"IOError: "<<filename<<" too short (3)."<<endl;
+      goto close_false;
+    }
+    size_t num_faces = *reinterpret_cast<unsigned int*>(buf);
+    fseek(stl_file,0,SEEK_END);
+    int file_size = ftell(stl_file);
+    if(file_size == 80 + 4 + (4*12 + 2) * num_faces)
+    {
+      is_ascii = false;
+    }else
+    {
+      is_ascii = true;
+    }
+  }
+  fclose(stl_file);
+
+
+
+  if(is_ascii)
+  {
+    // Rewind to end of header
+    stl_file = fopen(filename.c_str(),"r");
     // Eat file name
+#ifndef IGL_LINE_MAX
+#  define IGL_LINE_MAX 2048
+#endif
     char name[IGL_LINE_MAX];
     if(NULL==fgets(name,IGL_LINE_MAX,stl_file))
     {
-      cerr<<"IOError: "<<filename<<" too short."<<endl;
+      cerr<<"IOError: "<<filename<<" ascii too short (2)."<<endl;
       goto close_false;
     }
     // ascii
@@ -94,8 +129,13 @@ IGL_INLINE bool igl::readSTL(
       {
         break;
       }
-      if(ret != 5 || string("facet") != facet || string("normal") != normal)
+      if(ret != 5 || 
+          !(string("facet") == facet || 
+          string("faced") == facet) ||
+          string("normal") != normal)
       {
+        cout<<"facet: "<<facet<<endl;
+        cout<<"normal: "<<normal<<endl;
         cerr<<"IOError: "<<filename<<" bad format (1)."<<endl;
         goto close_false;
       }
@@ -152,7 +192,6 @@ IGL_INLINE bool igl::readSTL(
   }else
   {
     // Binary
-    fclose(stl_file);
     stl_file = fopen(filename.c_str(),"rb");
     if(NULL==stl_file)
     {
@@ -164,14 +203,14 @@ IGL_INLINE bool igl::readSTL(
     char header[80];
     if(fread(header,sizeof(char),80,stl_file)!=80)
     {
-      cerr<<"IOError: "<<filename<<" bad format (1)."<<endl;
+      cerr<<"IOError: "<<filename<<" bad format (6)."<<endl;
       goto close_false;
     }
     // Read number of triangles
     unsigned int num_tri;
     if(fread(&num_tri,sizeof(unsigned int),1,stl_file)!=1)
     {
-      cerr<<"IOError: "<<filename<<" bad format (2)."<<endl;
+      cerr<<"IOError: "<<filename<<" bad format (7)."<<endl;
       goto close_false;
     }
     V.resize(num_tri*3,vector<TypeV >(3,0));
@@ -183,7 +222,7 @@ IGL_INLINE bool igl::readSTL(
       float n[3];
       if(fread(n,sizeof(float),3,stl_file)!=3)
       {
-        cerr<<"IOError: "<<filename<<" bad format (3)."<<endl;
+        cerr<<"IOError: "<<filename<<" bad format (8)."<<endl;
         goto close_false;
       }
       // Read each vertex
@@ -194,7 +233,7 @@ IGL_INLINE bool igl::readSTL(
         float v[3];
         if(fread(v,sizeof(float),3,stl_file)!=3)
         {
-          cerr<<"IOError: "<<filename<<" bad format (4)."<<endl;
+          cerr<<"IOError: "<<filename<<" bad format (9)."<<endl;
           goto close_false;
         }
         V[3*t+c][0] = v[0];
@@ -205,7 +244,7 @@ IGL_INLINE bool igl::readSTL(
       unsigned short att_count;
       if(fread(&att_count,sizeof(unsigned short),1,stl_file)!=1)
       {
-        cerr<<"IOError: "<<filename<<" bad format (5)."<<endl;
+        cerr<<"IOError: "<<filename<<" bad format (10)."<<endl;
         goto close_false;
       }
     }

+ 14 - 1
include/igl/read_triangle_mesh.cpp

@@ -39,7 +39,14 @@ IGL_INLINE bool igl::read_triangle_mesh(
   vector<vector<Index> > FTC, FN;
   if(e == "obj")
   {
-    return readOBJ(str,V,TC,N,F,FTC,FN);
+    // Annoyingly obj can store 4 coordinates, truncate to xyz for this generic
+    // read_triangle_mesh
+    bool success = readOBJ(str,V,TC,N,F,FTC,FN);
+    for(auto & v : V)
+    {
+      v.resize(std::min(v.size(),(size_t)3));
+    }
+    return success;
   }else if(e == "off")
   {
     return readOFF(str,V,F,N);
@@ -98,6 +105,12 @@ IGL_INLINE bool igl::read_triangle_mesh(
     {
       return false;
     }
+    // Annoyingly obj can store 4 coordinates, truncate to xyz for this generic
+    // read_triangle_mesh
+    for(auto & v : vV)
+    {
+      v.resize(std::min(v.size(),(size_t)3));
+    }
   }else if(ext == "off")
   {
     if(!readOFF(filename,vV,vF,vN))

+ 2 - 0
include/igl/slice.cpp

@@ -270,4 +270,6 @@ template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1
 template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::slice<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
 #endif

+ 1 - 0
include/igl/triangle_triangle_adjacency.cpp

@@ -213,4 +213,5 @@ template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 3, 0, -1,
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > const&, bool, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&);
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long, int, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, bool, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&);
+template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
 #endif

+ 0 - 15
include/igl/viewer/OpenGL_shader.cpp

@@ -8,21 +8,6 @@
 
 #include "OpenGL_shader.h"
 
-#ifndef __APPLE__
-#  define GLEW_STATIC
-#  include <GL/glew.h>
-#endif
-
-#ifdef __APPLE__
-#   include <OpenGL/gl3.h>
-#   define __gl_h_ /* Prevent inclusion of the old gl.h */
-#else
-#   ifdef _WIN32
-#       include <windows.h>
-#   endif
-#   include <GL/gl.h>
-#endif
-
 #include <iostream>
 #include <fstream>
 

+ 4 - 2
include/igl/viewer/Viewer.cpp

@@ -561,6 +561,10 @@ namespace viewer
 
   IGL_INLINE bool Viewer::mouse_down(MouseButton button,int modifier)
   {
+    // Remember mouse location at down even if used by callback/plugin
+    down_mouse_x = current_mouse_x;
+    down_mouse_y = current_mouse_y;
+
     if (callback_mouse_down)
       if (callback_mouse_down(*this,static_cast<int>(button),modifier))
         return true;
@@ -571,8 +575,6 @@ namespace viewer
 
     down = true;
 
-    down_mouse_x = current_mouse_x;
-    down_mouse_y = current_mouse_y;
     down_translation = core.model_translation;
 
 

+ 1 - 0
include/igl/winding_number.cpp

@@ -221,4 +221,5 @@ IGL_INLINE void igl::winding_number_2(
 template void igl::winding_number_2<double>(double const*, int, double const*, int, double const*, int, double*);
 template void igl::winding_number_3<double>(double const*, int, double const*, int, double const*, int, double*);
 template void igl::winding_number_3<double, int>(double const*, int, int const*, int, double const*, int, double*);
+template void igl::winding_number_2<int>(double const*, int, int const*, int, double const*, int, double*);
 #endif

+ 138 - 0
include/igl/xml/writeDAE.cpp

@@ -0,0 +1,138 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2016 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 "writeDAE.h"
+#include "../STR.h"
+#include <tinyxml2.h>
+#include <map>
+#include <list>
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE bool igl::xml::writeDAE(
+  const std::string & filename,
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedF> & F)
+{
+  using namespace std;
+  using namespace Eigen;
+  using namespace tinyxml2;
+
+  XMLDocument* doc = new XMLDocument();
+
+  const auto & ele = [&doc](
+    const std::string tag,
+    // Can't just use `{}` as the default arguement because of a clang-bug 
+    // http://stackoverflow.com/questions/17264067/
+    const std::map<std::string,std::string> attribs = 
+      std::map<std::string,std::string>(),
+    const std::string text="",
+    const std::list<XMLElement *> children = 
+       std::list<XMLElement *>()
+    )->XMLElement *
+  {
+    XMLElement * element = doc->NewElement(tag.c_str());
+    for(const auto & key_value :  attribs)
+    {
+      element->SetAttribute(key_value.first.c_str(),key_value.second.c_str());
+    }
+    if(!text.empty())
+    {
+      element->InsertEndChild(doc->NewText(text.c_str()));
+    }
+    for(auto & child : children)
+    {
+      element->InsertEndChild(child);
+    }
+    return element;
+  };
+
+  Eigen::IOFormat row_format(Eigen::FullPrecision,0," "," ","","","");
+  doc->InsertEndChild(
+    ele("COLLADA",
+    {
+      {"xmlns","http://www.collada.org/2005/11/COLLADASchema"},
+      {"version","1.4.1"}
+    },
+    "",
+    {
+      ele("asset",{},"",
+      {
+        ele("unit",{{"meter","0.0254000"},{"name","inch"}}),
+        ele("up_axis",{},"Y_UP")
+      }),
+      ele("library_visual_scenes",{},"",
+      {
+        ele("visual_scene",{{"id","ID2"}},"",
+        {
+          ele("node",{{"name","SketchUp"}},"",
+          {
+            ele("node",{{"id","ID3"},{"name","group_0"}},"",
+            {
+              ele("matrix",{},"1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1"),
+              ele("instance_geometry",{{"url","#ID4"}},"",
+              {
+                ele("bind_material",{},"",{ele("technique_common")}),
+              }),
+            }),
+          }),
+        }),
+      }),
+      ele("library_geometries",{},"",
+      {
+        ele("geometry",{{"id","ID4"}},"",
+        {
+          ele("mesh",{},"",
+          {
+            ele("source",{{"id","ID7"}},"",
+            {
+              ele(
+                "float_array",
+                {{"count",STR(V.size())},{"id","ID10"}},
+                STR(V.format(row_format))),
+              ele("technique_common",{},"",
+              {
+                ele(
+                  "accessor",
+                  {{"count",STR(V.rows())},{"source","#ID8"},{"stride","3"}},
+                  "",
+                {
+                  ele("param",{{"name","X"},{"type","float"}}),
+                  ele("param",{{"name","Y"},{"type","float"}}),
+                  ele("param",{{"name","Z"},{"type","float"}}),
+                })
+              })
+            }),
+            ele(
+              "vertices",
+              {{"id","ID9"}},
+              "",
+              {ele("input",{{"semantic","POSITION"},{"source","#ID7"}})}),
+            ele(
+              "triangles",
+              {{"count",STR(F.rows())}},
+              "",
+            {
+              ele("input",{{"semantic","VERTEX"},{"source","#ID9"}}),
+              ele("p",{},STR(F.format(row_format))),
+            })
+          })
+        })
+      }),
+      ele("scene",{},"",{ele("instance_visual_scene",{{"url","#ID2"}})}),
+    }));
+  // tinyxml2 seems **not** to print the <?xml ...?> header by default, but it
+  // also seems that that's OK
+  XMLError error = doc->SaveFile(filename.c_str());
+  bool ret = true;
+  if(error != XML_NO_ERROR)
+  {
+    doc->PrintError();
+    ret = false;
+  }
+  delete doc;
+  return ret;
+}

+ 38 - 0
include/igl/xml/writeDAE.h

@@ -0,0 +1,38 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2016 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_XML_WRITEDAE_H
+#define IGL_XML_WRITEDAE_H
+#include "../igl_inline.h"
+#include <string>
+#include <Eigen/Core>
+namespace igl
+{
+  namespace xml
+  {
+    // Write a mesh to a Collada .dae scene file. The resulting scene contains
+    // a single "geometry" suitable for solid operaions (boolean union,
+    // intersection, etc.) in SketchUp.
+    //
+    // Inputs:
+    //   filename  path to .dae file
+    //   V  #V by 3 list of vertex positions
+    //   F  #F by 3 list of face indices
+    // Returns true iff success
+    //
+    template <typename DerivedV, typename DerivedF>
+    IGL_INLINE bool writeDAE(
+      const std::string & filename,
+      const Eigen::PlainObjectBase<DerivedV> & V,
+      const Eigen::PlainObjectBase<DerivedF> & F);
+  }
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#include "writeDAE.cpp"
+#endif
+#endif

+ 33 - 0
include/igl/xml/write_triangle_mesh.cpp

@@ -0,0 +1,33 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2016 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 "write_triangle_mesh.h"
+#include "../write_triangle_mesh.h"
+#include "../pathinfo.h"
+#include "writeDAE.h"
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE bool igl::xml::write_triangle_mesh(
+  const std::string str,
+  const Eigen::PlainObjectBase<DerivedV>& V,
+  const Eigen::PlainObjectBase<DerivedF>& F,
+  const bool ascii)
+{
+  using namespace std;
+  // dirname, basename, extension and filename
+  string d,b,e,f;
+  pathinfo(str,d,b,e,f);
+  // Convert extension to lower case
+  std::transform(e.begin(), e.end(), e.begin(), ::tolower);
+  if(e == "dae")
+  {
+    return writeDAE(str,V,F);
+  }else
+  {
+    return igl::write_triangle_mesh(str,V,F,ascii);
+  }
+}

+ 45 - 0
include/igl/xml/write_triangle_mesh.h

@@ -0,0 +1,45 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2016 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_XML_WRITE_TRIANGLE_MESH_H
+#define IGL_XML_WRITE_TRIANGLE_MESH_H
+#include "../igl_inline.h"
+
+#include <Eigen/Core>
+#include <string>
+
+namespace igl
+{
+  namespace xml
+  {
+    // write mesh to a file with automatic detection of file format.  supported:
+    // dae, or any of the formats supported by igl::write_triangle_mesh
+    // 
+    // Templates:
+    //   Scalar  type for positions and vectors (will be read as double and cast
+    //     to Scalar)
+    //   Index  type for indices (will be read as int and cast to Index)
+    // Inputs:
+    //   str  path to file
+    //   V  eigen double matrix #V by 3
+    //   F  eigen int matrix #F by 3
+    // Returns true iff success
+    template <typename DerivedV, typename DerivedF>
+    IGL_INLINE bool write_triangle_mesh(
+      const std::string str,
+      const Eigen::PlainObjectBase<DerivedV>& V,
+      const Eigen::PlainObjectBase<DerivedF>& F,
+      const bool ascii = true);
+  }
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "write_triangle_mesh.cpp"
+#endif
+
+#endif
+

+ 41 - 323
optional/CMakeLists.txt

@@ -1,333 +1,51 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8.12)
 project(libigl)
 
-SET(CMAKE_SKIP_RULE_DEPENDENCY 1)
-
-# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../lib)
-SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tutorial/cmake)
-find_package(EIGEN REQUIRED)
-
-add_definitions(-DIGL_STATIC_LIBRARY)
-option(LIBIGL_VIEWER_WITH_NANOGUI "Enable nanogui " OFF)
-
-#option(LIBIGL_NO_OPENGL "Disable OpenGL2 legacy features in main library" ON)
-#option(LIBIGL_OPENGL_4 "Enable OpenGL4 features in optional libraries" ON)
-#
-#if(LIBIGL_NO_OPENGL)
-#  add_definitions(-DIGL_NO_OPENGL)
-#endif(LIBIGL_NO_OPENGL)
-#if(LIBIGL_OPENGL_4)
-#  add_definitions(-DIGL_OPENGL_4)
-#endif(LIBIGL_OPENGL_4)
-
-## Check for GLFW
-find_package(GLFWH QUIET)
-if (GLFW_FOUND)
-  include_directories( ${GLFW_INCLUDE_DIR})
-else (GLFW_FOUND)
-  message(STATUS "GLFW not found.")
-endif(GLFW_FOUND)
-
-## Check for GLEW
-find_package(GLEW QUIET)
-if (GLEW_FOUND)
-  include_directories( ${GLEW_INCLUDE_DIR})
-else (GLEW_FOUND)
-  message(STATUS "GLEW not found.")
-endif(GLEW_FOUND)
-
-find_package(OpenGL QUIET)
-
-## Check for Anttweakbar
-find_package(ANTTWEAKBAR QUIET)
-if (ANTTWEAKBAR_FOUND)
-  include_directories( ${ANT_TWEAK_BAR_INCLUDE_DIR})
-else (ANTTWEAKBAR_FOUND)
-  message(STATUS "AntTweakBar not found.")
-endif(ANTTWEAKBAR_FOUND)
-
-## Check for NANOGUI
-if(LIBIGL_VIEWER_WITH_NANOGUI)
-  find_package(NANOGUIH QUIET)
-  #message(FATAL_ERROR "nanogui not found. ${NANOGUI_INCLUDE_DIRS}")
-  if (NANOGUI_FOUND)
-    include_directories( ${NANOGUI_INCLUDE_DIRS})
-  else (NANOGUI_FOUND)
-    message(STATUS "nanogui not found.")
-  endif(NANOGUI_FOUND)
+### Compilation flags: adapt to your needs ###
+if(MSVC)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj /w") ### Enable parallel compilation
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
+else()
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #### Libigl requires a modern C++ compiler that supports c++11
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../" )
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
 endif()
 
-## Check for Boost
-find_package(BOOST QUIET)
-if (Boost_FOUND)
-  include_directories( ${BOOST_INCLUDE_DIR})
-endif(Boost_FOUND)
-
 
-## Check for CoMiSo, if not available skip the examples that depends on it
-find_package(LIBCOMISOH QUIET)
-if (LIBCOMISO_FOUND)
-  include_directories( ${LIBCOMISO_INCLUDE_DIRS})
-endif(LIBCOMISO_FOUND)
+option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON)
 
-## Check for MATLAB, if not available skip the examples that depends on it
-find_package(MATLAB QUIET)
-if (MATLAB_FOUND)
-  include_directories( ${MATLAB_INCLUDE_DIR})
-else (MATLAB_FOUND)
-  message(STATUS "MATLAB not found.")
-endif(MATLAB_FOUND)
-
-## Check for EMBREE, if not available skip the examples that depends on it
-find_package(EMBREEH QUIET)
-if (EMBREE_FOUND)
-  include_directories( ${EMBREE_INCLUDE_DIR})
-else (EMBREE_FOUND)
-  message(STATUS "Embree not found.")
-endif(EMBREE_FOUND)
 
-## Check for CGAL, if not available skip the examples that depends on it
+option(LIBIGL_WITH_ANTTWEAKBAR      "Use AntTweakBar"    ON)
+option(LIBIGL_WITH_BBW              "Use BBW"            ON)
 find_package(CGAL QUIET)
-
-## Check for mosek
-find_package(MOSEK QUIET)
-if(MOSEK_FOUND)
-  include_directories(${MOSEK_INCLUDE_DIR})
-else(MOSEK_FOUND)
-  add_definitions(-DIGL_NO_MOSEK)
-endif(MOSEK_FOUND)
-
-## Check for CORK
-find_package(CORK QUIET)
-if (NOT CORK_FOUND)
-  add_definitions(-DIGL_NO_CORK)
-else(NOT CORK_FOUND)
-  include_directories( ${CORK_INCLUDE_DIR})
-endif(NOT CORK_FOUND)
-
-## Check for LIM
-find_package(LIM QUIET)
-if(LIM_FOUND)
-  include_directories( ${LIM_INCLUDE_DIR})
-endif(LIM_FOUND)
-
-## Check for PNG
-find_package(PNG QUIET)
-if(PNG_FOUND)
-  include_directories( ${PNG_INCLUDE_DIR})
-else(PNG_FOUND)
-  message(STATUS "PNG not found")
-endif(PNG_FOUND)
-
-## Check for TETGEN
-find_package(TETGEN QUIET)
-if(TETGEN_FOUND)
-  include_directories( ${TETGEN_INCLUDE_DIR})
-else(TETGEN_FOUND)
-  message(STATUS "Tetgen not found.")
-endif(TETGEN_FOUND)
-
-## Check for TRIANGLE
-find_package(TRIANGLE QUIET)
-if(TRIANGLE_FOUND)
-  include_directories( ${TRIANGLE_INCLUDE_DIR})
-endif(TRIANGLE_FOUND)
-
-## Check for TINYXML2
-find_package(TINYXML2 QUIET)
-if(TINYXML2_FOUND)
-  include_directories( ${TINYXML2_INCLUDE_DIR})
-endif(TINYXML2_FOUND)
-
-## Check for COMISO
-find_package(COMISO QUIET)
-if(COMISO_FOUND)
-  include_directories( ${COMISO_INCLUDE_DIR})
-endif(COMISO_FOUND)
-
-## Use openMP if available
-find_package(OpenMP)
-if (OPENMP_FOUND AND NOT WIN32)
-  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-endif()
-
-## Check for YIMG
-find_package(YIMG QUIET)
-if(YIMG_FOUND)
-  include_directories( ${YIMG_INCLUDE_DIR})
-else(YIMG_FOUND)
-  message(STATUS "YIMG not found")
-endif(YIMG_FOUND)
-
-IF(MSVC)
-### Enable parallel compilation for Visual Studio
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-ELSE(MSVC)
-#### Libigl requires a modern C++ compiler that supports c++11
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-ENDIF(MSVC)
-
-#### Compile the core library that depends only on EIGEN ####
-include_directories( ${EIGEN_INCLUDE_DIR})
-include_directories( ${PROJECT_SOURCE_DIR}/../include/)
-
-file(GLOB SOURCES
-  "${PROJECT_SOURCE_DIR}/../include/igl/*.cpp"
-  "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/*.cpp"
-)
-
-add_library(igl STATIC ${SOURCES})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igl")
-
-#### Compile the AntTweakBar part
-if (ANTTWEAKBAR_FOUND)
-  file(GLOB SOURCES_ANTTWEAKBAR
-    "${PROJECT_SOURCE_DIR}/../include/igl/anttweakbar/*.cpp"
-  )
-add_library(iglanttweakbar STATIC ${SOURCES_ANTTWEAKBAR})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglanttweakbar")
-endif (ANTTWEAKBAR_FOUND)
-
-#### Compile the BBW part
-file(GLOB SOURCES_BBW
-  "${PROJECT_SOURCE_DIR}/../include/igl/bbw/*.cpp"
-)
-add_library(iglbbw STATIC ${SOURCES_BBW})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglbbw")
-
-#### Compile the boolean and cgal parts
-if (CGAL_FOUND)
-#### Compile the boolean part
-if (NOT CORK_FOUND)
-  add_definitions(-DIGL_NO_CORK)
-endif(NOT CORK_FOUND)
-file(GLOB SOURCES_BOOLEAN
-  "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/boolean/*.cpp"
-)
-add_library(iglboolean STATIC ${SOURCES_BOOLEAN})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglboolean")
-#### Compile the cgal part
-  file(GLOB SOURCES_CGAL
-    "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/cgal/*.cpp"
-  )
-add_library(iglcgal STATIC ${SOURCES_CGAL})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglcgal")
-endif (CGAL_FOUND)
-
-#### Compile the comiso part
-if (LIBCOMISO_FOUND)
-  file(GLOB SOURCES_COMISO
-    "${PROJECT_SOURCE_DIR}/../include/igl/comiso/*.cpp"
-  )
-  add_library(iglcomiso STATIC ${SOURCES_COMISO})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglcomiso")
-endif (LIBCOMISO_FOUND)
-
-#### Compile the embree part
-if (EMBREE_FOUND)
-  file(GLOB SOURCES_EMBREE
-    "${PROJECT_SOURCE_DIR}/../include/igl/embree/*.cpp"
-  )
-  add_library(iglembree STATIC ${SOURCES_EMBREE})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglembree")
-endif (EMBREE_FOUND)
-
-#### Compile the lim part
-if (LIM_FOUND)
-  file(GLOB SOURCES_LIM
-    "${PROJECT_SOURCE_DIR}/../include/igl/lim/*.cpp"
-  )
-  add_library(igllim STATIC ${SOURCES_LIM})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igllim")
-endif (LIM_FOUND)
-
-#### Compile the matlab part
-if (MATLAB_FOUND)
-  file(GLOB SOURCES_MATLAB
-    "${PROJECT_SOURCE_DIR}/../include/igl/matlab/*.cpp"
-  )
-  add_library(iglmatlab STATIC ${SOURCES_MATLAB})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglmatlab")
-endif (MATLAB_FOUND)
-
-#### Compile the mosek part
-if (MOSEK_FOUND)
-  file(GLOB SOURCES_MOSEK
-    "${PROJECT_SOURCE_DIR}/../include/igl/mosek/*.cpp"
-  )
-add_library(iglmosek STATIC ${SOURCES_MOSEK})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglmosek")
-endif (MOSEK_FOUND)
-
-#### Compile the opengl parts
-if (OPENGL_FOUND)
-  file(GLOB SOURCES_OPENGL2
-    "${PROJECT_SOURCE_DIR}/../include/igl/opengl2/*.cpp"
-  )
-  add_library(iglopengl2 STATIC ${SOURCES_OPENGL2})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglopengl2")
-  file(GLOB SOURCES_OPENGL
-    "${PROJECT_SOURCE_DIR}/../include/igl/opengl/*.cpp"
-  )
-  add_library(iglopengl STATIC ${SOURCES_OPENGL})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglopengl")
-endif (OPENGL_FOUND)
-
-#### Compile the png part
-if (PNG_FOUND AND YIMG_FOUND AND OPENGL_FOUND)
-  file(GLOB SOURCES_PNG
-    "${PROJECT_SOURCE_DIR}/../include/igl/png/*.cpp"
-  )
-  add_library(iglpng STATIC ${SOURCES_PNG})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglpng")
-
-endif (PNG_FOUND AND YIMG_FOUND AND OPENGL_FOUND)
-
-#### Compile the tetgen part
-if (TETGEN_FOUND)
-  file(GLOB SOURCES_TETGEN
-    "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/tetgen/*.cpp"
-  )
-
-  add_library(igltetgen STATIC ${SOURCES_TETGEN})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igltetgen")
-
-endif (TETGEN_FOUND)
-
-#### Compile the triangle part
-if (TRIANGLE_FOUND)
-  file(GLOB SOURCES_TRIANGLE
-    "${PROJECT_SOURCE_DIR}/../include/igl/triangle/*.cpp"
-  )
-
-  add_library(igltriangle STATIC ${SOURCES_TRIANGLE})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igltriangle")
-
-endif (TRIANGLE_FOUND)
-
-#### Compile the viewer
-if(LIBIGL_VIEWER_WITH_NANOGUI)
-  if (NANOGUI_FOUND)
-    add_definitions(-DIGL_VIEWER_WITH_NANOGUI)
-  endif (NANOGUI_FOUND)
+option(LIBIGL_WITH_CGAL             "Use CGAL"           "${CGAL_FOUND}")
+option(LIBIGL_WITH_COMISO           "Use CoMiso"         ON)
+### Cork is off by default since it fails to build out-of-the-box on windows
+option(LIBIGL_WITH_CORK             "Use Cork"           OFF)
+option(LIBIGL_WITH_EMBREE           "Use Embree"         ON)
+option(LIBIGL_WITH_LIM              "Use LIM"            ON)
+find_package(MATLAB QUIET)
+option(LIBIGL_WITH_MATLAB           "Use Matlab"         "${MATLAB_FOUND}")
+find_package(MOSEK  QUIET)
+option(LIBIGL_WITH_MOSEK            "Use MOSEK"          "${MOSEK_FOUND}")
+### Nanogui is off by default because it has many dependencies and generates
+### many issues 
+option(LIBIGL_WITH_NANOGUI          "Use Nanogui menu"   OFF)
+option(LIBIGL_WITH_OPENGL           "Use OpenGL"         ON)
+option(LIBIGL_WITH_PNG              "Use PNG"            ON)
+option(LIBIGL_WITH_TETGEN           "Use Tetgen"         ON)
+option(LIBIGL_WITH_TRIANGLE         "Use Triangle"       ON)
+option(LIBIGL_WITH_VIEWER           "Use OpenGL viewer"  ON)
+option(LIBIGL_WITH_XML              "Use XML"            ON)
+
+if(LIBIGL_WITH_CGAL) # Do not remove or move this block, cgal strange build system fails without it
+  find_package(CGAL REQUIRED)
+  set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
+  include(${CGAL_USE_FILE})
 endif()
-file(GLOB SOURCES_VIEWER
-  "${PROJECT_SOURCE_DIR}/../include/igl/viewer/*.cpp"
-)
-add_library(iglviewer STATIC ${SOURCES_VIEWER})
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglviewer")
-
-#### Compile the xml part
-if (TINYXML2_FOUND)
-  file(GLOB SOURCES_XML
-    "${PROJECT_SOURCE_DIR}/../include/igl/xml/*.cpp"
-  )
-  add_library(iglxml STATIC ${SOURCES_XML})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglxml")
-endif (TINYXML2_FOUND)
 
-# Pass the list of compiled libraries to the parent if there is one
-if(NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
-  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} PARENT_SCOPE)
-endif (NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
+# libigl*.a libraries should be built directly into libigl/lib/
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
+add_subdirectory("${PROJECT_SOURCE_DIR}/../shared/cmake" "libigl")

+ 1 - 9
optional/README.md

@@ -32,16 +32,8 @@ You should expect to see a few linker warnings of the form:
 These are (admittedly unpopular) functions that have never been used by us
 statically so we haven't explicit instantiations (yet).
 
-
-#### Examples ####
-You can make a slew of examples by issuing:
-
-    cd ../examples
-    make
-
 #### External ####
 
-
 Finally there are a number of external libraries that we include in
 `./external/` because they are either difficult to obtain or they have been
 patched for easier use with libigl. Please see the respective readmes in those
@@ -266,7 +258,7 @@ Here's a tiny test example using `igl.h` and `igl.cpp`. Save the following in `t
     {
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
-    return (argc>=2 &amp;&amp; igl::read_triangle_mesh(argv[1],V,F)?0:1);
+    return (argc>=2 && igl::read_triangle_mesh(argv[1],V,F)?0:1);
     }
 
 Then compile `igl.cpp` with:

+ 69 - 135
python/CMakeLists.txt

@@ -1,30 +1,18 @@
-cmake_minimum_required(VERSION 2.8)
-
+cmake_minimum_required(VERSION 2.8.12)
 project(pybind)
 
-IF(MSVC)
-### Enable parallel compilation for Visual Studio
-  add_definitions(-DEIGEN_DONT_ALIGN)
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-  SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/../ )
-  SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../ )
-ENDIF(MSVC)
-
-SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tutorial/cmake)
-
-if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  message(STATUS "Setting build type to 'MinSizeRel' as none was specified.")
-  set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Choose the type of build." FORCE)
-  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
-    "MinSizeRel" "RelWithDebInfo")
+### Compilation flags: adapt to your needs ###
+if(MSVC)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj /w") ### Enable parallel compilation
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
+else()
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #### Libigl requires a modern C++ compiler that supports c++11
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../" )
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
 endif()
 
-find_package(OPENGL QUIET)
-
-if (OPENGL_FOUND)
-  add_definitions(-DPY_VIEWER)
-endif (OPENGL_FOUND)
-
 # Force a specific python version
 # SET(PYTHON_LIBRARIES "D:/Python34/libs/python34.lib")
 # SET(PYTHON_INCLUDE_DIR "D:/Python34/include")
@@ -39,154 +27,100 @@ find_package(PythonInterp REQUIRED)
 
 string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
 if (UNIX)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
   if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
   endif()
 endif()
 
 # Compile with compiler warnings turned on
-if(MSVC)
-  if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
-    string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-  else()
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
-  endif()
-else()
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
-endif()
+# if(MSVC)
+#   if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+#     string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+#   else()
+#     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+#   endif()
+# else()
+#   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
+# endif()
 
 include_directories(${PYTHON_INCLUDE_DIR} include)
 
 ## include pybing
 include_directories(${PROJECT_SOURCE_DIR}/../external/pybind11/include)
 
-## include eigen
-include_directories(${PROJECT_SOURCE_DIR}/../external/nanogui/ext/eigen)
-
 ## include libigl
-include_directories(${PROJECT_SOURCE_DIR}/../include)
-
-if (OPENGL_FOUND)
-
-  ## include glew
-  if(NOT APPLE)
-    find_package(GLEW REQUIRED)
-    include_directories( ${GLEW_INCLUDE_DIR} )
-  	set(SHARED_SOURCES ${SHARED_SOURCES} ${GLEW_SOURCES})
-  endif(NOT APPLE)
+option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" OFF)
+option(LIBIGL_WITH_VIEWER           "Use OpenGL viewer"  ON)
+option(LIBIGL_WITH_NANOGUI          "Use Nanogui menu"   OFF)
+option(LIBIGL_WITH_CGAL             "Use CGAL"           OFF)
+option(LIBIGL_WITH_BOOLEAN          "Use Cork boolean"   OFF)
+option(LIBIGL_WITH_COMISO           "Use CoMiso"         ON)
+option(LIBIGL_WITH_EMBREE           "Use Embree"         OFF)
+option(LIBIGL_WITH_LIM              "Use LIM"            ON)
+option(LIBIGL_WITH_MATLAB           "Use Matlab"         OFF)
+option(LIBIGL_WITH_MOSEK            "Use MOSEK"          OFF)
+option(LIBIGL_WITH_BBW              "Use BBW"            ON)
+option(LIBIGL_WITH_OPENGL_AND_PNG   "Use OpenGL"         ON)
+option(LIBIGL_WITH_TETGEN           "Use Tetgen"         ON)
+option(LIBIGL_WITH_TRIANGLE         "Use Triangle"       ON)
+option(LIBIGL_WITH_XML              "Use XML"            ON)
+
+if(LIBIGL_WITH_CGAL) # Do not remove or move this block, cgal strange build system fails without it
+  find_package(CGAL REQUIRED)
+  set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
+  include(${CGAL_USE_FILE})
+endif()
 
+add_subdirectory("${PROJECT_SOURCE_DIR}/../shared/cmake" "libigl")
 
-  # include nanogui and dependencies
 
-  set(NANOGUI_BUILD_PYTHON OFF CACHE BOOL " " FORCE)
-  set(NANOGUI_BUILD_EXAMPLE OFF CACHE BOOL " " FORCE)
-  set(NANOGUI_BUILD_SHARED OFF CACHE BOOL " " FORCE)
+### Prepare the build environment
 
-  add_subdirectory("../external/nanogui/" "nanogui")
-  include_directories("../external/nanogui/include")
-  include_directories("../external/nanogui/ext/glfw/include")
-  include_directories("../external/nanogui/ext/nanovg/src")
-  list(APPEND SHARED_LIBRARIES "nanogui" ${OPENGL_LIBRARIES})
+include_directories(${LIBIGL_INCLUDE_DIRS})
+add_definitions(${LIBIGL_DEFINITIONS})
 
+## Optional modules
+if (LIBIGL_WITH_OPENGL)
+  add_definitions(-DPY_VIEWER)
   list(APPEND SHARED_SOURCES "py_igl_viewer.cpp")
+endif ()
 
-endif (OPENGL_FOUND)
-# include comiso if available
-
-find_package(LIBCOMISOH QUIET)
-
-#Compile CoMISo (if found)
-# NOTE: this cmakefile works only with the
-# comiso available here: https://github.com/libigl/CoMISo
-IF(LIBCOMISO_FOUND)
-
+if (LIBIGL_WITH_COMISO)
   add_definitions(-DPY_COMISO)
-  list(APPEND SHARED_SOURCES "py_igl_comiso.cpp")
+  list(APPEND SHARED_SOURCES "copyleft/py_igl_comiso.cpp")
+endif ()
 
-  list(GET LIBCOMISO_INCLUDE_DIRS 0 COMISO_ROOT)
-  # message( FATAL_ERROR "${COMISO_ROOT}" )
 
-  if(APPLE)
-    find_library(accelerate_library Accelerate)
-    list(APPEND SHARED_LIBRARIES "CoMISo" ${accelerate_library})
-  elseif(UNIX)
-    find_package(BLAS REQUIRED)
-    list(APPEND SHARED_LIBRARIES "CoMISo" ${BLAS_LIBRARIES})
-  endif(APPLE)
-
-  if(MSVC)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SCL_SECURE_NO_DEPRECATE")
-    #link_directories("${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/lib/")
-    list(APPEND SHARED_LIBRARIES "CoMISo" "${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/lib/libopenblas.dll.a.lib")
-  endif(MSVC)
-
-
-  include_directories("${COMISO_ROOT}/CoMISo/ext/gmm-4.2/include")
-  include_directories("${COMISO_ROOT}/")
-  add_subdirectory("${COMISO_ROOT}/CoMISo/" "CoMISo")
-
-  if(MSVC)
-    # Copy the dll
-    add_custom_target(Copy-CoMISo-DLL        # Adds a post-build event to MyTest
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different
-        "${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libopenblas.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libopenblas.dll"
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different
-        "${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libgcc_s_seh-1.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libgcc_s_seh-1.dll"
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different
-        "${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libgfortran-3.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libgfortran-3.dll"
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different
-        "${COMISO_ROOT}/CoMISo/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libquadmath-0.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libquadmath-0.dll")
-  endif(MSVC)
-
-ENDIF(LIBCOMISO_FOUND)
-
-add_library(igl SHARED
-  python.cpp
+## Prepare the python library
+add_library(pyigl SHARED
+  python_shared.cpp
   py_vector.cpp
   py_igl.cpp
   py_doc.cpp
   ${SHARED_SOURCES}
 )
 
-# if(NOT APPLE)
-# 	find_package(GLEW REQUIRED)
-# endif(NOT APPLE)
-
-if(APPLE)
-	set(CMAKE_SHARED_LINKER_FLAGS "-framework OpenGL -framework Cocoa")
-endif (APPLE) #APPLE
-#
-if(UNIX AND NOT APPLE)
-  if (OPENGL_FOUND)
-    set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lGL -lGLU -lrt -lX11 -lXxf86vm -lXrandr -lpthread -lXi  -lXcursor -lXinerama ")
-  endif (OPENGL_FOUND)
-endif(UNIX AND NOT APPLE)
-
-
-set_target_properties(igl PROPERTIES PREFIX "")
-set_target_properties(igl PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
+set_target_properties(pyigl PROPERTIES PREFIX "")
+set_target_properties(pyigl PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
 
-target_link_libraries(igl ${SHARED_LIBRARIES})
+target_link_libraries(pyigl ${LIBIGL_LIBRARIES} ${LIBIGL_EXTRA_LIBRARIES})
 
 if (WIN32)
   if (MSVC)
     # Enforce size-based optimization and link time code generation on MSVC (~30% smaller binaries in experiments)
-    set_target_properties(igl PROPERTIES COMPILE_FLAGS "/Os /GL")
-    set_target_properties(igl PROPERTIES LINK_FLAGS "/LTCG")
+    set_target_properties(pyigl PROPERTIES COMPILE_FLAGS "/Os /GL")
+    set_target_properties(pyigl PROPERTIES LINK_FLAGS "/LTCG")
   endif()
 
   # .PYD file extension on Windows
-  set_target_properties(igl PROPERTIES SUFFIX ".pyd")
+  set_target_properties(pyigl PROPERTIES SUFFIX ".pyd")
 
   # Link against the Python shared library
   # message(FATAL_ERROR ${PYTHON_LIBRARY})
   # target_link_libraries(igl ${PYTHON_LIBRARY})
-  target_link_libraries(igl ${PYTHON_LIBRARIES})
+  target_link_libraries(pyigl ${PYTHON_LIBRARIES})
 
 
 elseif (UNIX)
@@ -203,18 +137,18 @@ elseif (UNIX)
   # fine -- they will be resolved at import time.
 
   # .SO file extension on Linux/Mac OS
-  set_target_properties(igl PROPERTIES SUFFIX ".so")
+  set_target_properties(pyigl PROPERTIES SUFFIX ".so")
 
   # Strip unnecessary sections of the binary on Linux/Mac OS
   if(APPLE)
-    set_target_properties(igl PROPERTIES MACOSX_RPATH ".")
-    set_target_properties(igl PROPERTIES LINK_FLAGS "-undefined dynamic_lookup -dead_strip")
+    set_target_properties(pyigl PROPERTIES MACOSX_RPATH ".")
+    set_target_properties(pyigl PROPERTIES LINK_FLAGS "-undefined dynamic_lookup -dead_strip")
     if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
-      add_custom_command(TARGET igl POST_BUILD COMMAND strip -u -r ${CMAKE_CURRENT_BINARY_DIR}/../igl.so)
+      add_custom_command(TARGET pyigl POST_BUILD COMMAND strip -u -r ${CMAKE_CURRENT_BINARY_DIR}/../pyigl.so)
     endif()
   else()
     if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
-      add_custom_command(TARGET igl POST_BUILD COMMAND strip ${CMAKE_CURRENT_BINARY_DIR}/../igl.so)
+      add_custom_command(TARGET pyigl POST_BUILD COMMAND strip ${CMAKE_CURRENT_BINARY_DIR}/../pyigl.so)
     endif()
   endif()
 endif()

+ 2 - 2
python/README.md

@@ -25,7 +25,7 @@ that your terminal is pointing to the root of libigl:
 ```bash
 cd python
 mkdir build
-cd build; make; cd ..
+cd build; cmake ..; make; cd ..
 ```
 
 The cmake script will complain if it is not able to find python. In that case
@@ -70,7 +70,7 @@ native python functions as callbacks. This is a simple example that loads
 two meshes and switches between the two when a key is pressed:
 
 ```python
-import igl
+import pyigl as igl
 
 V1 = igl.eigen.MatrixXd()
 F1 = igl.eigen.MatrixXi()

+ 5 - 5
python/py_igl_comiso.cpp → python/copyleft/py_igl_comiso.cpp

@@ -3,17 +3,17 @@
 #include <Eigen/Sparse>
 
 
-#include "python.h"
+#include "../python_shared.h"
 
-#include <igl/comiso/nrosy.h>
-#include <igl/comiso/miq.h>
+#include <igl/copyleft/comiso/nrosy.h>
+#include <igl/copyleft/comiso/miq.h>
 
 void python_export_igl_comiso(py::module &me) {
 
   py::module m = me.def_submodule(
     "comiso", "Wrappers for libigl functions that use comiso");
 
-  #include "py_igl/comiso/py_nrosy.cpp"
-  #include "py_igl/comiso/py_miq.cpp"
+  #include "../py_igl/copyleft/comiso/py_nrosy.cpp"
+  #include "../py_igl/copyleft/comiso/py_miq.cpp"
 
 }

+ 1 - 1
python/iglhelpers.py

@@ -1,6 +1,6 @@
 import numpy as np
 import scipy.sparse as sparse
-import igl
+import pyigl as igl
 
 def p2e(m):
     if isinstance(m, np.ndarray):

+ 1 - 1
python/py_igl.cpp

@@ -1,6 +1,6 @@
 #include <Eigen/Dense>
 
-#include "python.h"
+#include "python_shared.h"
 
 #include <igl/readOFF.h>
 #include <igl/writeOBJ.h>

+ 2 - 2
python/py_igl/comiso/py_miq.cpp → python/py_igl/copyleft/comiso/py_miq.cpp

@@ -19,7 +19,7 @@ m.def("miq", []
   std::vector<int> round_vertices;
   std::vector<std::vector<int> > hard_features;
 
-  igl::comiso::miq(V,F,PD1,PD2,UV,FUV,scale,stiffness,direct_round,iter,local_iter,DoRound, SingularityRound, round_vertices, hard_features);
+  igl::copyleft::comiso::miq(V,F,PD1,PD2,UV,FUV,scale,stiffness,direct_round,iter,local_iter,DoRound, SingularityRound, round_vertices, hard_features);
 }, __doc_igl_comiso_miq,
 py::arg("V"), py::arg("F"), py::arg("PD1"), py::arg("PD2"), py::arg("UV"), py::arg("FUV"), py::arg("scale") = 30.0, py::arg("stiffness") = 5.0, py::arg("direct_round") = false, py::arg("iter") = 5, py::arg("local_iter") = 5, py::arg("DoRound") = true, py::arg("SingularityRound") = true
 // , py::arg("round_vertices"), py::arg("hard_features")
@@ -50,7 +50,7 @@ m.def("miq", []
   std::vector<int> roundVertices;
   std::vector<std::vector<int> > hardFeatures;
 
-  igl::comiso::miq(V,F,PD1_combed,PD2_combed,MMatch,Singular,Seams,UV,FUV,GradientSize,Stiffness,DirectRound,iter,localIter,DoRound, SingularityRound, roundVertices, hardFeatures);
+  igl::copyleft::comiso::miq(V,F,PD1_combed,PD2_combed,MMatch,Singular,Seams,UV,FUV,GradientSize,Stiffness,DirectRound,iter,localIter,DoRound, SingularityRound, roundVertices, hardFeatures);
 }, __doc_igl_comiso_miq,
 py::arg("V"), py::arg("F"), py::arg("PD1_combed"), py::arg("PD2_combed"),
 py::arg("MMatch"), py::arg("Singular"), py::arg("Seams"),

+ 2 - 2
python/py_igl/comiso/py_nrosy.cpp → python/py_igl/copyleft/comiso/py_nrosy.cpp

@@ -30,7 +30,7 @@ m.def("nrosy", []
     w_softt = w_soft;
 
   Eigen::VectorXd St;
-  igl::comiso::nrosy(V,F,bt,bc,b_softt,w_softt,bc_soft,N,soft,R,St);
+  igl::copyleft::comiso::nrosy(V,F,bt,bc,b_softt,w_softt,bc_soft,N,soft,R,St);
   S = St;
 
 }, __doc_igl_comiso_nrosy,
@@ -54,7 +54,7 @@ m.def("nrosy", []
     bt = b;
 
   Eigen::VectorXd St;
-  igl::comiso::nrosy(V,F,bt,bc,N,R,St);
+  igl::copyleft::comiso::nrosy(V,F,bt,bc,N,R,St);
   S = St;
 }, __doc_igl_comiso_nrosy,
 py::arg("V"), py::arg("F"), py::arg("b"), py::arg("bc"), py::arg("N"), py::arg("R"), py::arg("S"));

+ 1 - 2
python/py_igl_viewer.cpp

@@ -1,7 +1,7 @@
 #include <Eigen/Dense>
 #include <Eigen/Sparse>
 
-#include "python.h"
+#include "python_shared.h"
 #define ENABLE_SERIALIZATION
 #include <igl/viewer/Viewer.h>
 #include <igl/viewer/ViewerCore.h>
@@ -145,7 +145,6 @@ py::class_<igl::viewer::ViewerCore> viewercore_class(me, "ViewerCore");
     .def("draw",&igl::viewer::ViewerCore::draw)
     .def("draw_buffer",&igl::viewer::ViewerCore::draw_buffer)
 
-    .def_readwrite("textrenderer",&igl::viewer::ViewerCore::textrenderer)
     .def_readwrite("shininess",&igl::viewer::ViewerCore::shininess)
 
     .def_property("background_color",

+ 1 - 1
python/py_vector.cpp

@@ -3,7 +3,7 @@
 #include <Eigen/Sparse>
 
 
-#include "python.h"
+#include "python_shared.h"
 
 /// Creates Python bindings for a dynamic Eigen matrix
 template <typename Type>

+ 3 - 3
python/python.cpp → python/python_shared.cpp

@@ -1,4 +1,4 @@
-#include "python.h"
+#include "python_shared.h"
 #include <sstream>
 #include <string>
 #include <fstream>
@@ -14,9 +14,9 @@ extern void python_export_igl_viewer(py::module &);
 extern void python_export_igl_comiso(py::module &);
 #endif
 
-PYTHON_PLUGIN(igl) {
+PYTHON_PLUGIN(pyigl) {
     py::init_threading();
-    py::module m("igl", "Python wrappers for libigl");
+    py::module m("pyigl", "Python wrappers for libigl");
 
     python_export_vector(m);
     python_export_igl(m);

+ 0 - 0
python/python.h → python/python_shared.h


+ 1 - 1
python/tcpviewer.py

@@ -1,6 +1,6 @@
 import socket
 import threading
-import igl
+import pyigl as igl
 import array
 import time
 

+ 1 - 1
python/tutorial/101_FileIO.py

@@ -3,7 +3,7 @@ from __future__ import print_function
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 # Load a mesh in OFF format
 V = igl.eigen.MatrixXd()

+ 1 - 1
python/tutorial/102_DrawMesh.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 # Load a mesh in OFF format
 V = igl.eigen.MatrixXd()

+ 1 - 1
python/tutorial/102_DrawMesh_TCP.py

@@ -13,7 +13,7 @@ os.system("python ../tcpviewer.py&")
 # Wait for it to set up the socket
 time.sleep(1)
 
-import igl
+import pyigl as igl
 import tcpviewer
 
 # Read a mesh

+ 1 - 1
python/tutorial/103_Events.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V1 = igl.eigen.MatrixXd()
 F1 = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/104_Colors.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/105_Overlays.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/201_Normals.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/202_GaussianCurvature.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 # Load mesh
 V = igl.eigen.MatrixXd()

+ 1 - 1
python/tutorial/203_CurvatureDirections.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd();
 F = igl.eigen.MatrixXi();

+ 1 - 1
python/tutorial/204_Gradient.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/205_Laplacian.py

@@ -4,7 +4,7 @@ from __future__ import print_function
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 import math
 
 global V

+ 1 - 1
python/tutorial/301_Slice.py

@@ -4,7 +4,7 @@ from __future__ import print_function
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

+ 1 - 1
python/tutorial/302_Sort.py

@@ -2,7 +2,7 @@
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 
-import igl
+import pyigl as igl
 
 V = igl.eigen.MatrixXd()
 F = igl.eigen.MatrixXi()

Some files were not shown because too many files changed in this diff