Переглянути джерело

merge

Former-commit-id: 7c26ff8b73d3e6887399a27928c06d2a856e3189
Alec Jacobson 9 роки тому
батько
коміт
bd44ef991c
100 змінених файлів з 849 додано та 852 видалено
  1. 18 0
      .gitmodules
  2. 17 2
      .travis.yml
  3. 2 2
      README.md
  4. 3 0
      include/igl/AABB.h
  5. 23 0
      include/igl/MeshBooleanType.h
  6. 6 5
      include/igl/WindingNumberTree.h
  7. 1 1
      include/igl/ambient_occlusion.cpp
  8. 11 13
      include/igl/bbw/bbw.cpp
  9. 17 16
      include/igl/bbw/bbw.h
  10. 2 0
      include/igl/cat.cpp
  11. 0 29
      include/igl/copyleft/boolean/MeshBooleanType.h
  12. 6 6
      include/igl/copyleft/cgal/BinaryWindingNumberOperations.h
  13. 4 4
      include/igl/copyleft/cgal/CSGTree.h
  14. 1 1
      include/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h
  15. 3 1
      include/igl/copyleft/cgal/assign_scalar.cpp
  16. 1 0
      include/igl/copyleft/cgal/extract_cells.cpp
  17. 28 28
      include/igl/copyleft/cgal/mesh_boolean.cpp
  18. 4 4
      include/igl/copyleft/cgal/mesh_boolean.h
  19. 4 4
      include/igl/copyleft/cgal/minkowski_sum.cpp
  20. 1 1
      include/igl/copyleft/cgal/minkowski_sum.h
  21. 3 0
      include/igl/copyleft/cgal/outer_hull.cpp
  22. 2 1
      include/igl/copyleft/cgal/points_inside_component.h
  23. 5 3
      include/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp
  24. 4 4
      include/igl/copyleft/cgal/string_to_mesh_boolean_type.h
  25. 6 3
      include/igl/copyleft/comiso/frame_field.cpp
  26. 3 0
      include/igl/copyleft/comiso/frame_field.h
  27. 44 42
      include/igl/copyleft/comiso/miq.cpp
  28. 3 0
      include/igl/copyleft/comiso/miq.h
  29. 29 25
      include/igl/copyleft/comiso/nrosy.cpp
  30. 3 0
      include/igl/copyleft/comiso/nrosy.h
  31. 3 6
      include/igl/copyleft/cork/from_cork_mesh.cpp
  32. 3 5
      include/igl/copyleft/cork/from_cork_mesh.h
  33. 4 6
      include/igl/copyleft/cork/mesh_boolean.cpp
  34. 6 8
      include/igl/copyleft/cork/mesh_boolean.h
  35. 4 6
      include/igl/copyleft/cork/to_cork_mesh.cpp
  36. 3 5
      include/igl/copyleft/cork/to_cork_mesh.h
  37. 5 5
      include/igl/cross_field_missmatch.cpp
  38. 2 2
      include/igl/cross_field_missmatch.h
  39. 2 6
      include/igl/find_cross_field_singularities.cpp
  40. 5 0
      include/igl/in_element.cpp
  41. 3 1
      include/igl/jet.cpp
  42. 1 0
      include/igl/massmatrix.cpp
  43. 2 0
      include/igl/matlab/parse_rhs.cpp
  44. 38 0
      include/igl/matlab/prepare_lhs.cpp
  45. 6 0
      include/igl/matlab/prepare_lhs.h
  46. 1 1
      include/igl/mosek/mosek_quadprog.h
  47. 2 1
      include/igl/per_vertex_normals.cpp
  48. 8 18
      include/igl/png/render_to_png.cpp
  49. 15 29
      include/igl/png/render_to_png_async.cpp
  50. 4 5
      include/igl/png/texture_from_file.cpp
  51. 30 22
      include/igl/png/texture_from_png.cpp
  52. 0 7
      include/igl/png/texture_from_png.h
  53. 1 1
      include/igl/point_simplex_squared_distance.h
  54. 3 0
      include/igl/polar_svd.cpp
  55. 21 0
      include/igl/project.cpp
  56. 14 0
      include/igl/project.h
  57. 1 0
      include/igl/project_to_line.cpp
  58. 1 1
      include/igl/quat_to_axis_angle.cpp
  59. 2 0
      include/igl/slice.cpp
  60. 1 0
      include/igl/triangle_triangle_adjacency.cpp
  61. 0 15
      include/igl/viewer/OpenGL_shader.cpp
  62. 4 2
      include/igl/viewer/Viewer.cpp
  63. 1 0
      include/igl/winding_number.cpp
  64. 138 0
      include/igl/xml/writeDAE.cpp
  65. 38 0
      include/igl/xml/writeDAE.h
  66. 33 0
      include/igl/xml/write_triangle_mesh.cpp
  67. 45 0
      include/igl/xml/write_triangle_mesh.h
  68. 38 323
      optional/CMakeLists.txt
  69. 1 9
      optional/README.md
  70. 69 135
      python/CMakeLists.txt
  71. 1 1
      python/README.md
  72. 5 5
      python/copyleft/py_igl_comiso.cpp
  73. 1 1
      python/iglhelpers.py
  74. 1 1
      python/py_igl.cpp
  75. 2 2
      python/py_igl/copyleft/comiso/py_miq.cpp
  76. 2 2
      python/py_igl/copyleft/comiso/py_nrosy.cpp
  77. 1 2
      python/py_igl_viewer.cpp
  78. 1 1
      python/py_vector.cpp
  79. 3 3
      python/python_shared.cpp
  80. 0 0
      python/python_shared.h
  81. 1 1
      python/tcpviewer.py
  82. 1 1
      python/tutorial/101_FileIO.py
  83. 1 1
      python/tutorial/102_DrawMesh.py
  84. 1 1
      python/tutorial/102_DrawMesh_TCP.py
  85. 1 1
      python/tutorial/103_Events.py
  86. 1 1
      python/tutorial/104_Colors.py
  87. 1 1
      python/tutorial/105_Overlays.py
  88. 1 1
      python/tutorial/201_Normals.py
  89. 1 1
      python/tutorial/202_GaussianCurvature.py
  90. 1 1
      python/tutorial/203_CurvatureDirections.py
  91. 1 1
      python/tutorial/204_Gradient.py
  92. 1 1
      python/tutorial/205_Laplacian.py
  93. 1 1
      python/tutorial/301_Slice.py
  94. 1 1
      python/tutorial/302_Sort.py
  95. 1 1
      python/tutorial/303_LaplaceEquation.py
  96. 1 1
      python/tutorial/304_LinearEqualityConstraints.py
  97. 1 1
      python/tutorial/305_QuadraticProgramming.py
  98. 1 1
      python/tutorial/306_EigenDecomposition.py
  99. 1 1
      python/tutorial/401_BiharmonicDeformation.py
  100. 1 1
      python/tutorial/402_PolyharmonicDeformation.py

+ 18 - 0
.gitmodules

@@ -9,3 +9,21 @@ url=https://github.com/libigl/nanogui.git
 [submodule "external/pybind11"]
 [submodule "external/pybind11"]
 	path = external/pybind11
 	path = external/pybind11
 	url = https://github.com/wjakob/pybind11.git
 	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
         - git submodule update --init --recursive
         - mkdir external/nanogui/ext/glfw/include/GL
         - mkdir external/nanogui/ext/glfw/include/GL
         - wget -P external/nanogui/ext/glfw/include/GL http://www.opengl.org/registry/api/GL/glcorearb.h
         - 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
         - cd tutorial
         - mkdir build
         - mkdir build
         - cd 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
         - make -j 2
       addons:
       addons:
         apt:
         apt:
           sources:
           sources:
             - ubuntu-toolchain-r-test
             - ubuntu-toolchain-r-test
-            - kalakris-cmake
+            - george-edison55-precise-backports
           packages:
           packages:
             - xorg-dev
             - xorg-dev
             - libglu1-mesa-dev
             - libglu1-mesa-dev
             - g++-4.8
             - g++-4.8
             - cmake
             - cmake
+            - cmake-data
+            - libblas-dev
+            - liblapack-dev
     #         - binutils
     #         - binutils
     #         - libx11-dev
     #         - libx11-dev
     #         - mesa-common-dev
     #         - mesa-common-dev
@@ -40,6 +49,12 @@ matrix:
         - brew upgrade cmake
         - brew upgrade cmake
         - brew upgrade cgal
         - brew upgrade cgal
         - git submodule update --init --recursive
         - git submodule update --init --recursive
+        - cd python
+        - mkdir build
+        - cd build
+        - cmake ../
+        - make -j 2
+        - cd ../../
         - cd tutorial
         - cd tutorial
         - mkdir build
         - mkdir build
         - cd 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).
 For more information see our [tutorial](tutorial/tutorial.html).
 
 
-### Optional dependencies ###
+### Optional dependencies
 
 
 Libigl compartmentalizes its **optional** dependences via its directory
 Libigl compartmentalizes its **optional** dependences via its directory
 organization in the `include/` folder. All header files located _directly_ in
 organization in the `include/` folder. All header files located _directly_ in
@@ -155,7 +155,7 @@ subrepos:
 
 
 ```bash
 ```bash
 git pull
 git pull
-git submodule update -- recursive
+git submodule update --recursive
 ```
 ```
 
 
 ## Unit testing
 ## Unit testing

+ 3 - 0
include/igl/AABB.h

@@ -322,6 +322,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
+  deinit();
   if(bb_mins.size() > 0)
   if(bb_mins.size() > 0)
   {
   {
     assert(bb_mins.rows() == bb_maxs.rows() && "Serial tree arrays must match");
     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)
     const Eigen::MatrixXi & Ele)
 {
 {
   using namespace Eigen;
   using namespace Eigen;
+  // deinit will be immediately called...
   return init(V,Ele,MatrixXDIMS(),MatrixXDIMS(),VectorXi(),0);
   return init(V,Ele,MatrixXDIMS(),MatrixXDIMS(),VectorXi(),0);
 }
 }
 
 
@@ -392,6 +394,7 @@ inline void igl::AABB<DerivedV,DIM>::init(
 {
 {
   using namespace Eigen;
   using namespace Eigen;
   using namespace std;
   using namespace std;
+  deinit();
   if(V.size() == 0 || Ele.size() == 0 || I.size() == 0)
   if(V.size() == 0 || Ele.size() == 0 || I.size() == 0)
   {
   {
     return;
     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
   const Point & p) const
 {
 {
   using namespace std;
   using namespace std;
-  // Simple metric for "far".
+  // Simple metric for `is_far`
+  //
   //   this             that
   //   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
   // a = atan2(R-r,d), where d is the distance between centers
 
 
   // That should be bigger (what about parent? what about sister?)
   // 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(
     double a = atan2(
       that.radius - this->radius,
       that.radius - this->radius,
       (that.center - this->center).norm());
       (that.center - this->center).norm());
     assert(a>0);
     assert(a>0);
-    far = (a<PI/8.0);
+    is_far = (a<PI/8.0);
   }
   }
 
 
-  if(far)
+  if(is_far)
   {
   {
     // Not implemented yet
     // Not implemented yet
     pair<const WindingNumberTree*,const WindingNumberTree*> this_that(this,&that);
     pair<const WindingNumberTree*,const WindingNumberTree*> this_that(this,&that);

+ 1 - 1
include/igl/ambient_occlusion.cpp

@@ -44,7 +44,7 @@ IGL_INLINE void igl::ambient_occlusion(
     for(int t = 0;t<nthreads;t++)
     for(int t = 0;t<nthreads;t++)
     {
     {
       threads[t] = std::thread(std::bind(
       threads[t] = std::thread(std::bind(
-        [&](const int bi, const int ei, const int t)
+        [&P,&N,&shoot_ray,&S,&num_samples,&D](const int bi, const int ei, const int t)
         {
         {
           // loop over mesh vertices in this chunk
           // loop over mesh vertices in this chunk
           for(int p = bi;p<ei;p++)
           for(int p = bi;p<ei;p++)

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

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "bbw.h"
 #include "bbw.h"
 
 
@@ -14,13 +14,11 @@
 #include <igl/slice_into.h>
 #include <igl/slice_into.h>
 #include <igl/min_quad_with_fixed.h>
 #include <igl/min_quad_with_fixed.h>
 
 
-#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
 #include <Eigen/Sparse>
 #include <Eigen/Sparse>
 
 
 #include <iostream>
 #include <iostream>
 #include <cstdio>
 #include <cstdio>
 
 
-
 igl::bbw::BBWData::BBWData():
 igl::bbw::BBWData::BBWData():
   partition_unity(false),
   partition_unity(false),
   W0(),
   W0(),
@@ -45,16 +43,16 @@ void igl::bbw::BBWData::print()
 
 
 
 
 template <
 template <
-  typename DerivedV, 
-  typename DerivedEle, 
+  typename DerivedV,
+  typename DerivedEle,
   typename Derivedb,
   typename Derivedb,
-  typename Derivedbc, 
+  typename Derivedbc,
   typename DerivedW>
   typename DerivedW>
 IGL_INLINE bool igl::bbw::bbw(
 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,
   igl::bbw::BBWData & data,
   Eigen::PlainObjectBase<DerivedW> & W
   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.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_BBW_BBW_H
 #ifndef IGL_BBW_BBW_H
 #define IGL_BBW_BBW_H
 #define IGL_BBW_BBW_H
@@ -51,9 +51,10 @@ namespace igl
         // 2: louder
         // 2: louder
         int verbosity;
         int verbosity;
       public:
       public:
-        BBWData();
+        IGL_INLINE BBWData();
+
         // Print current state of object
         // Print current state of object
-        void print();
+        IGL_INLINE void print();
     };
     };
 
 
     // Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
     // 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
     //   bc #b by #W list of boundary values
     //   data  object containing options, intial guess --> solution and results
     //   data  object containing options, intial guess --> solution and results
     // Outputs:
     // 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
     // Returns true on success, false on failure
     template <
     template <
-      typename DerivedV, 
-               typename DerivedEle, 
+      typename DerivedV,
+               typename DerivedEle,
                typename Derivedb,
                typename Derivedb,
-               typename Derivedbc, 
+               typename Derivedbc,
                typename DerivedW>
                typename DerivedW>
                  IGL_INLINE bool bbw(
                  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,
                      BBWData & data,
                      Eigen::PlainObjectBase<DerivedW> & W);
                      Eigen::PlainObjectBase<DerivedW> & W);
   }
   }
 }
 }
-  
+
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
 #  include "bbw.cpp"
 #  include "bbw.cpp"
 #endif
 #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 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<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 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
 #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 
 // 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/.
 // 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 <stdexcept>
 #include "../../igl_inline.h"
 #include "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <Eigen/Core>
 #include <Eigen/Core>
 
 
 namespace igl
 namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cgal
     {
     {
-      template <igl::copyleft::boolean::MeshBooleanType Op>
+      template <igl::MeshBooleanType Op>
       class BinaryWindingNumberOperations {
       class BinaryWindingNumberOperations {
         public:
         public:
           template<typename DerivedW>
           template<typename DerivedW>
@@ -72,7 +72,7 @@ namespace igl
       };
       };
 
 
       template <>
       template <>
-      class BinaryWindingNumberOperations<igl::copyleft::boolean::MESH_BOOLEAN_TYPE_RESOLVE> {
+      class BinaryWindingNumberOperations<MESH_BOOLEAN_TYPE_RESOLVE> {
         public:
         public:
           template<typename DerivedW>
           template<typename DerivedW>
             typename DerivedW::Scalar operator()(
             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 
 // 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 
 // 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/.
 // 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 "string_to_mesh_boolean_type.h"
-#include "MeshBooleanType.h"
 #include "mesh_boolean.h"
 #include "mesh_boolean.h"
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/number_utils.h>
 #include <CGAL/number_utils.h>
@@ -18,7 +18,7 @@ namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cgal
     {
     {
       // Class for defining and computing a constructive solid geometry result
       // Class for defining and computing a constructive solid geometry result
       // out of a tree of boolean operations on "solid" triangle meshes.
       // 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 detect_only;
         bool first_only;
         bool first_only;
         bool stitch_all;
         bool stitch_all;
-        RemeshSelfIntersectionsParam(
+        inline RemeshSelfIntersectionsParam(
           bool _detect_only=false, 
           bool _detect_only=false, 
           bool _first_only=false,
           bool _first_only=false,
           bool _stitch_all=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(
 IGL_INLINE void igl::copyleft::cgal::assign_scalar(
-  const typename CGAL::Epeck::FT & cgal,
+  const typename CGAL::Epeck::FT & _cgal,
   double & d)
   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);
   const auto interval = CGAL::to_interval(cgal);
   d = interval.first;
   d = interval.first;
   do {
   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
 #ifdef IGL_STATIC_LIBRARY
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #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::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
 #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 "mesh_boolean.h"
 #include "BinaryWindingNumberOperations.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 "../../extract_manifold_patches.h"
 #include "../../remove_unreferenced.h"
 #include "../../remove_unreferenced.h"
 #include "../../unique_simplices.h"
 #include "../../unique_simplices.h"
@@ -40,7 +40,7 @@ template <
   typename DerivedVC,
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedFC,
   typename DerivedJ>
   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<DerivedVA> & VA,
     const Eigen::PlainObjectBase<DerivedFA> & FA,
     const Eigen::PlainObjectBase<DerivedFA> & FA,
     const Eigen::PlainObjectBase<DerivedVB> & VB,
     const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -265,7 +265,7 @@ template <
   typename DerivedVC,
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedFC,
   typename DerivedJ>
   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<DerivedVA > & VA,
     const Eigen::PlainObjectBase<DerivedFA > & FA,
     const Eigen::PlainObjectBase<DerivedFA > & FA,
     const Eigen::PlainObjectBase<DerivedVB > & VB,
     const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -279,26 +279,26 @@ IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
   switch (type) 
   switch (type) 
   {
   {
     case MESH_BOOLEAN_TYPE_UNION:
     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:
     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:
     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:
     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:
     case MESH_BOOLEAN_TYPE_RESOLVE:
       //op = binary_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:
     default:
       assert(false && "Unsupported boolean type.");
       assert(false && "Unsupported boolean type.");
       return false;
       return false;
@@ -313,7 +313,7 @@ template <
   typename DerivedVC,
   typename DerivedVC,
   typename DerivedFC,
   typename DerivedFC,
   typename DerivedJ>
   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<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -371,7 +371,7 @@ template <
   typename DerivedFB,
   typename DerivedFB,
   typename DerivedVC,
   typename DerivedVC,
   typename DerivedFC>
   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<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -381,14 +381,14 @@ IGL_INLINE bool igl::copyleft::boolean::mesh_boolean(
   Eigen::PlainObjectBase<DerivedFC > & FC) 
   Eigen::PlainObjectBase<DerivedFC > & FC) 
 {
 {
   Eigen::Matrix<typename DerivedFC::Index, Eigen::Dynamic,1> J;
   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
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 #undef IGL_STATIC_LIBRARY
 #include "../../remove_unreferenced.cpp"
 #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> >&);
 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 
 // 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/.
 // 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 "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <Eigen/Core>
 #include <Eigen/Core>
 #include <functional>
 #include <functional>
 
 
@@ -19,7 +19,7 @@ namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cgal
     {
     {
       //  MESH_BOOLEAN Compute boolean csg operations on "solid", consistently
       //  MESH_BOOLEAN Compute boolean csg operations on "solid", consistently
       //  oriented meshes.
       //  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 "../../unique.h"
 #include "../../get_seconds.h"
 #include "../../get_seconds.h"
 #include "../../edges.h"
 #include "../../edges.h"
-#include "../cgal/assign_scalar.h"
+#include "assign_scalar.h"
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <cassert>
 #include <cassert>
 #include <vector>
 #include <vector>
@@ -24,7 +24,7 @@ template <
   typename DerivedW,
   typename DerivedW,
   typename DerivedG,
   typename DerivedG,
   typename DerivedJ>
   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<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::PlainObjectBase<DerivedVB> & VB,
   const Eigen::PlainObjectBase<DerivedVB> & VB,
@@ -149,7 +149,7 @@ template <
   typename DerivedW,
   typename DerivedW,
   typename DerivedG,
   typename DerivedG,
   typename DerivedJ>
   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<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::Matrix<sType,1,sCols,sOptions> & s,
   const Eigen::Matrix<sType,1,sCols,sOptions> & s,
@@ -354,7 +354,7 @@ template <
   typename DerivedW,
   typename DerivedW,
   typename DerivedG,
   typename DerivedG,
   typename DerivedJ>
   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<DerivedVA> & VA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::PlainObjectBase<DerivedFA> & FA,
   const Eigen::Matrix<sType,1,sCols,sOptions> & s,
   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 copyleft
   {
   {
-    namespace boolean
+    namespace cgal
     {
     {
       // Compute the Minkowski sum of a closed triangle mesh (V,F) and a
       // Compute the Minkowski sum of a closed triangle mesh (V,F) and a
       // set of simplices in 3D.
       // set of simplices in 3D.

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

@@ -8,6 +8,7 @@
 #include "outer_hull.h"
 #include "outer_hull.h"
 #include "extract_cells.h"
 #include "extract_cells.h"
 #include "remesh_self_intersections.h"
 #include "remesh_self_intersections.h"
+#include "assign_scalar.h"
 #include "../../remove_unreferenced.h"
 #include "../../remove_unreferenced.h"
 
 
 #include <CGAL/AABB_tree.h>
 #include <CGAL/AABB_tree.h>
@@ -532,4 +533,6 @@ IGL_INLINE void igl::copyleft::cgal::outer_hull_legacy(
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 #endif

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

@@ -12,7 +12,8 @@
 #include <Eigen/Core>
 #include <Eigen/Core>
 #include <vector>
 #include <vector>
 
 
-namespace igl {
+namespace igl 
+{
   namespace copyleft
   namespace copyleft
   {
   {
     namespace cgal {
     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 <cassert>
 #include <vector>
 #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,
   const std::string & s,
   MeshBooleanType & type)
   MeshBooleanType & type)
 {
 {
@@ -22,7 +22,8 @@ IGL_INLINE bool igl::copyleft::boolean::string_to_mesh_boolean_type(
   {
   {
     type = MESH_BOOLEAN_TYPE_INTERSECT;
     type = MESH_BOOLEAN_TYPE_INTERSECT;
   }else if(
   }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;
     type = MESH_BOOLEAN_TYPE_MINUS;
   }else if(find_any({"xor","symmetric difference","x","∆"},eff_s))
   }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;
   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)
   const std::string & s)
 {
 {
   MeshBooleanType type;
   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 
 // 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 
 // 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/.
 // 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 "../../igl_inline.h"
-#include "MeshBooleanType.h"
+#include "../../MeshBooleanType.h"
 #include <string>
 #include <string>
 
 
 namespace igl
 namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cgal
     {
     {
       // Convert string to boolean type
       // 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/triangle_triangle_adjacency.h>
 #include <igl/edge_topology.h>
 #include <igl/edge_topology.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_face_normals.h>
-#include <igl/comiso/nrosy.h>
+#include <igl/copyleft/comiso/nrosy.h>
 #include <iostream>
 #include <iostream>
 
 
 namespace igl
 namespace igl
 {
 {
+namespace copyleft
+{
 namespace comiso
 namespace comiso
 {
 {
 
 
@@ -229,7 +231,7 @@ void FrameInterpolator::interpolateCross()
   b.conservativeResize(num,Eigen::NoChange);
   b.conservativeResize(num,Eigen::NoChange);
   bc.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
   //olga:end
   assert(R.rows() == F.rows());
   assert(R.rows() == F.rows());
 
 
@@ -647,10 +649,11 @@ Eigen::MatrixXd FrameInterpolator::getFieldPerFace()
   P = svd.matrixV() * svd.singularValues().asDiagonal() * svd.matrixV().transpose();
   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::MatrixXd& V,
                                  const Eigen::MatrixXi& F,
                                  const Eigen::MatrixXi& F,
                                  const Eigen::VectorXi& b,
                                  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 igl
 {
 {
+namespace copyleft
+{
 namespace comiso
 namespace comiso
 {
 {
 // Generate a piecewise-constant frame-field field from a sparse set of constraints on faces
 // 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
 #ifndef IGL_STATIC_LIBRARY
 #  include "frame_field.cpp"
 #  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
 // 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/.
 // 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/local_basis.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/cut_mesh.h>
 #include <igl/cut_mesh.h>
@@ -45,6 +45,7 @@
 
 
 
 
 namespace igl {
 namespace igl {
+namespace copyleft {
 namespace comiso {
 namespace comiso {
   struct SeamInfo
   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 _v0p,
                                    int _MMatch,
                                    int _MMatch,
                                    int _integerVar)
                                    int _integerVar)
@@ -363,7 +365,7 @@ IGL_INLINE igl::comiso::SeamInfo::SeamInfo(int _v0,
   MMatch=_MMatch;
   MMatch=_MMatch;
 }
 }
 
 
-IGL_INLINE igl::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
+IGL_INLINE igl::copyleft::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
 {
 {
   v0=S1.v0;
   v0=S1.v0;
   v0p=S1.v0p;
   v0p=S1.v0p;
@@ -373,7 +375,7 @@ IGL_INLINE igl::comiso::SeamInfo::SeamInfo(const SeamInfo &S1)
 
 
 
 
 template <typename DerivedV, typename DerivedF>
 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<DerivedF> &_F,
                                                                    const Eigen::PlainObjectBase<DerivedV> &_Vcut,
                                                                    const Eigen::PlainObjectBase<DerivedV> &_Vcut,
                                                                    const Eigen::PlainObjectBase<DerivedF> &_Fcut,
                                                                    const Eigen::PlainObjectBase<DerivedF> &_Fcut,
@@ -402,7 +404,7 @@ Handle_Seams(_Handle_Seams)
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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 f1,
                                                                      const int indexE,
                                                                      const int indexE,
                                                                      int &v0,int &v1,
                                                                      int &v0,int &v1,
@@ -424,7 +426,7 @@ IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::GetSeamInfo(con
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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
   // Return value
   std::vector<std::vector<VertexInfo> >verticesPerSeam;
   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>
 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();
   auto verticesPerSeam = GetVerticesPerSeam();
   Handle_SystemInfo.EdgeSeamInfo.clear();
   Handle_SystemInfo.EdgeSeamInfo.clear();
@@ -590,7 +592,7 @@ IGL_INLINE void igl::comiso::VertexIndexing<DerivedV, DerivedF>::InitSeamInfo()
 
 
 
 
 template <typename DerivedV, typename DerivedF>
 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 vector_field_scale,
                                                                      double grid_res,
                                                                      double grid_res,
                                                                      bool direct_round,
                                                                      bool direct_round,
@@ -662,7 +664,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::SolvePoisson(Eig
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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,
 ::PoissonSolver(const Eigen::PlainObjectBase<DerivedV> &_V,
                 const Eigen::PlainObjectBase<DerivedF> &_F,
                 const Eigen::PlainObjectBase<DerivedF> &_F,
                 const Eigen::PlainObjectBase<DerivedV> &_Vcut,
                 const Eigen::PlainObjectBase<DerivedV> &_Vcut,
@@ -695,7 +697,7 @@ Handle_SystemInfo(_Handle_SystemInfo)
 ///return the complex encoding the rotation
 ///return the complex encoding the rotation
 ///for a given missmatch interval
 ///for a given missmatch interval
 template <typename DerivedV, typename DerivedF>
 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));
   assert((interval>=0)&&(interval<4));
 
 
@@ -713,7 +715,7 @@ IGL_INLINE std::complex<double> igl::comiso::PoissonSolver<DerivedV, DerivedF>::
 ///START FIXING VERTICES
 ///START FIXING VERTICES
 ///set a given vertex as fixed
 ///set a given vertex as fixed
 template <typename DerivedV, typename DerivedF>
 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++;
   n_fixed_vars++;
   Hard_constraints.push_back(v);
   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
 ///find vertex to fix in case we're using
 ///a vector field NB: multiple components not handled
 ///a vector field NB: multiple components not handled
 template <typename DerivedV, typename DerivedF>
 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();
   Hard_constraints.clear();
 
 
@@ -747,21 +749,21 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindFixedVertFie
 ///find hard constraint depending if using or not
 ///find hard constraint depending if using or not
 ///a vector field
 ///a vector field
 template <typename DerivedV, typename DerivedF>
 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();
   Hard_constraints.clear();
   FindFixedVertField();
   FindFixedVertField();
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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]);
   return Fcut(VF[v][0],VFi[v][0]);
 }
 }
 
 
 ///fix the vertices which are flagged as fixed
 ///fix the vertices which are flagged as fixed
 template <typename DerivedV, typename DerivedF>
 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;
   int offset_row = num_cut_constraint*2;
 
 
@@ -798,7 +800,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FixBlockedVertex
 ///HANDLING SINGULARITY
 ///HANDLING SINGULARITY
 //set the singularity round to integer location
 //set the singularity round to integer location
 template <typename DerivedV, typename DerivedF>
 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++)
   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>
 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)
   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
 ///START GENERIC SYSTEM FUNCTIONS
 template <typename DerivedV, typename DerivedF>
 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 idx  = Eigen::VectorXi::LinSpaced(Vcut.rows(), 0, 2*Vcut.rows()-2);
   Eigen::VectorXi idx2 = Eigen::VectorXi::LinSpaced(Vcut.rows(), 1, 2*Vcut.rows()-1);
   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
 ///find different sized of the system
 template <typename DerivedV, typename DerivedF>
 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
   ///find the vertex that need to be fixed
   FindFixedVert();
   FindFixedVert();
@@ -902,7 +904,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::FindSizes()
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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);
   Lhs.resize(n_vert_vars * 2, n_vert_vars * 2);
   Constraints.resize(num_constraint_equations, num_total_vars);
   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
 ///intitialize the whole matrix
 template <typename DerivedV, typename DerivedF>
 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();
   FindSizes();
   AllocateSystem();
   AllocateSystem();
@@ -926,7 +928,7 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::InitMatrix()
 ///map back coordinates after that
 ///map back coordinates after that
 ///the system has been solved
 ///the system has been solved
 template <typename DerivedV, typename DerivedF>
 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
   ///map coords to faces
   for (unsigned int f=0;f<Fcut.rows();f++)
   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
 ///set the constraints for the inter-range cuts
 template <typename DerivedV, typename DerivedF>
 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
   ///current constraint row
   int constr_row = 0;
   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
 ///set the constraints for the inter-range cuts
 template <typename DerivedV, typename DerivedF>
 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
   /// the user defined constraints are at the end
   int offset_row = num_cut_constraint*2 + n_fixed_vars*2;
   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
 ///call of the mixed integer solver
 template <typename DerivedV, typename DerivedF>
 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,
                                                                           bool direct_round,
                                                                           int localIter)
                                                                           int localIter)
 {
 {
@@ -1120,14 +1122,14 @@ IGL_INLINE void igl::comiso::PoissonSolver<DerivedV, DerivedF>::MixedIntegerSolv
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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;
   num_userdefined_constraint = 0;
   userdefined_constraints.clear();
   userdefined_constraints.clear();
 }
 }
 
 
 template <typename DerivedV, typename DerivedF>
 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
   // prepare constraint
   std::vector<int> c(Handle_SystemInfo.num_vert_variables*2 + 1);
   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>
 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<DerivedF> &F_,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD1_combed,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD1_combed,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD2_combed,
                                                                    const Eigen::PlainObjectBase<DerivedV> &PD2_combed,
@@ -1237,7 +1239,7 @@ F(F_)
 }
 }
 
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
 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)
                                                                         Eigen::PlainObjectBase<DerivedF> &FUV_out)
 {
 {
   UV_out = this->UV_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>
 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;
   int numFl=0;
   for (unsigned int i=0;i<F.rows();i++)
   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>
 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);
   assert(h > 0);
 
 
@@ -1345,7 +1347,7 @@ IGL_INLINE double igl::comiso::MIQ_class<DerivedV, DerivedF, DerivedU>::Distorti
 //  @return     distortion laplacian for f
 //  @return     distortion laplacian for f
 ///////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////
 template <typename DerivedV, typename DerivedF, typename DerivedU>
 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 mydist = Distortion(f, h, WUV);
   double lapl=0;
   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>
 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;
   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>
 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 &uv1,
                                                                         const Eigen::Vector2d &uv2)
                                                                         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>
 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)
   const int i, const Eigen::MatrixXd& WUV)
 {
 {
   Eigen::Vector2d uv0,uv1,uv2;
   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>
 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<DerivedV> &V,
   const Eigen::PlainObjectBase<DerivedF> &F,
   const Eigen::PlainObjectBase<DerivedF> &F,
   const Eigen::PlainObjectBase<DerivedV> &PD1_combed,
   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();
   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,
     F,
     PD1_combed,
     PD1_combed,
     PD2_combed,
     PD2_combed,
@@ -1466,7 +1468,7 @@ IGL_INLINE void igl::comiso::miq(
 }
 }
 
 
 template <typename DerivedV, typename DerivedF, typename DerivedU>
 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<DerivedV> &V,
     const Eigen::PlainObjectBase<DerivedF> &F,
     const Eigen::PlainObjectBase<DerivedF> &F,
     const Eigen::PlainObjectBase<DerivedV> &PD1,
     const Eigen::PlainObjectBase<DerivedV> &PD1,
@@ -1502,7 +1504,7 @@ IGL_INLINE void igl::comiso::miq(
   Eigen::PlainObjectBase<DerivedV> PD1_combed, PD2_combed;
   Eigen::PlainObjectBase<DerivedV> PD1_combed, PD2_combed;
   igl::comb_frame_field(V, F, PD1, PD2, BIS1_combed, BIS2_combed, 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,
            F,
            PD1_combed,
            PD1_combed,
            PD2_combed,
            PD2_combed,
@@ -1525,7 +1527,7 @@ IGL_INLINE void igl::comiso::miq(
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 #endif

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

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

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

@@ -8,7 +8,7 @@
 
 
 #include "nrosy.h"
 #include "nrosy.h"
 
 
-#include <igl/comiso/nrosy.h>
+#include <igl/copyleft/comiso/nrosy.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/triangle_triangle_adjacency.h>
 #include <igl/edge_topology.h>
 #include <igl/edge_topology.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_face_normals.h>
@@ -27,6 +27,9 @@
 
 
 namespace igl
 namespace igl
 {
 {
+namespace copyleft
+{
+
 namespace comiso
 namespace comiso
 {
 {
 class NRosyField
 class NRosyField
@@ -150,9 +153,10 @@ private:
 };
 };
 
 
 } // NAMESPACE COMISO
 } // NAMESPACE COMISO
+} // NAMESPACE COPYLEFT
 } // NAMESPACE IGL
 } // 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 std;
   using namespace Eigen;
   using namespace Eigen;
@@ -207,14 +211,14 @@ igl::comiso::NRosyField::NRosyField(const Eigen::MatrixXd& _V, const Eigen::Matr
   softAlpha = 0.5;
   softAlpha = 0.5;
 }
 }
 
 
-void igl::comiso::NRosyField::setSoftAlpha(double alpha)
+void igl::copyleft::comiso::NRosyField::setSoftAlpha(double alpha)
 {
 {
   assert(alpha >= 0 && alpha < 1);
   assert(alpha >= 0 && alpha < 1);
   softAlpha = alpha;
   softAlpha = alpha;
 }
 }
 
 
 
 
-void igl::comiso::NRosyField::prepareSystemMatrix(const int N)
+void igl::copyleft::comiso::NRosyField::prepareSystemMatrix(const int N)
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
@@ -395,7 +399,7 @@ void igl::comiso::NRosyField::prepareSystemMatrix(const int N)
 //  s2.close();
 //  s2.close();
 }
 }
 
 
-void igl::comiso::NRosyField::solveNoRoundings()
+void igl::copyleft::comiso::NRosyField::solveNoRoundings()
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
@@ -417,7 +421,7 @@ void igl::comiso::NRosyField::solveNoRoundings()
       p[i] = roundl(x[tag_p[i]]);
       p[i] = roundl(x[tag_p[i]]);
 }
 }
 
 
-void igl::comiso::NRosyField::solveRoundings()
+void igl::copyleft::comiso::NRosyField::solveRoundings()
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   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)
   for(unsigned i=0; i<p.rows(); ++i)
     pFixed[i] = true;
     pFixed[i] = true;
 }
 }
 
 
-void igl::comiso::NRosyField::roundAndFixToZero()
+void igl::copyleft::comiso::NRosyField::roundAndFixToZero()
 {
 {
   for(unsigned i=0; i<p.rows(); ++i)
   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
   // Reduce the search space by fixing matchings
   reduceSpace();
   reduceSpace();
@@ -514,19 +518,19 @@ void igl::comiso::NRosyField::solve(const int N)
   findCones(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;
   isHard[fid] = true;
   hard(fid) = convert3DtoLocal(fid, v);
   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;
   wSoft(fid) = w;
   soft(fid) = convert3DtoLocal(fid, v);
   soft(fid) = convert3DtoLocal(fid, v);
 }
 }
 
 
-void igl::comiso::NRosyField::resetConstraints()
+void igl::copyleft::comiso::NRosyField::resetConstraints()
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
@@ -540,7 +544,7 @@ void igl::comiso::NRosyField::resetConstraints()
   soft   = VectorXd::Zero(F.rows());
   soft   = VectorXd::Zero(F.rows());
 }
 }
 
 
-Eigen::MatrixXd igl::comiso::NRosyField::getFieldPerFace()
+Eigen::MatrixXd igl::copyleft::comiso::NRosyField::getFieldPerFace()
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   using namespace Eigen;
@@ -551,7 +555,7 @@ Eigen::MatrixXd igl::comiso::NRosyField::getFieldPerFace()
   return result;
   return result;
 }
 }
 
 
-Eigen::MatrixXd igl::comiso::NRosyField::getFFieldPerFace()
+Eigen::MatrixXd igl::copyleft::comiso::NRosyField::getFFieldPerFace()
 {
 {
   using namespace std;
   using namespace std;
   using namespace Eigen;
   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 std;
   using namespace Eigen;
   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 std;
   using namespace Eigen;
   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 std;
   using namespace Eigen;
   using namespace Eigen;
@@ -780,7 +784,7 @@ double igl::comiso::NRosyField::convert3DtoLocal(unsigned fid, const Eigen::Vect
   return atan2(vp(1),vp(0));
   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 std;
   using namespace Eigen;
   using namespace Eigen;
@@ -789,7 +793,7 @@ Eigen::Vector3d igl::comiso::NRosyField::convertLocalto3D(unsigned fid, double a
   return vp.transpose() * TPs[fid];
   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);
   Eigen::VectorXd A = Eigen::VectorXd::Constant(V.rows(),-2*M_PI);
 
 
@@ -808,7 +812,7 @@ Eigen::VectorXd igl::comiso::NRosyField::angleDefect()
   return A;
   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
   // 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;
   singularityIndex = I;
 }
 }
 
 
-Eigen::VectorXd igl::comiso::NRosyField::getSingularityIndexPerVertex()
+Eigen::VectorXd igl::copyleft::comiso::NRosyField::getSingularityIndexPerVertex()
 {
 {
   return singularityIndex;
   return singularityIndex;
 }
 }
 
 
-IGL_INLINE void igl::comiso::nrosy(
+IGL_INLINE void igl::copyleft::comiso::nrosy(
   const Eigen::MatrixXd& V,
   const Eigen::MatrixXd& V,
   const Eigen::MatrixXi& F,
   const Eigen::MatrixXi& F,
   const Eigen::VectorXi& b,
   const Eigen::VectorXi& b,
@@ -885,7 +889,7 @@ IGL_INLINE void igl::comiso::nrosy(
   )
   )
 {
 {
   // Init solver
   // Init solver
-  igl::comiso::NRosyField solver(V,F);
+  igl::copyleft::comiso::NRosyField solver(V,F);
 
 
   // Add hard constraints
   // Add hard constraints
   for (unsigned i=0; i<b.size();++i)
   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::MatrixXd& V,
                            const Eigen::MatrixXi& F,
                            const Eigen::MatrixXi& F,
                            const Eigen::VectorXi& b,
                            const Eigen::VectorXi& b,
@@ -920,7 +924,7 @@ IGL_INLINE void igl::comiso::nrosy(
                            )
                            )
 {
 {
   // Init solver
   // Init solver
-  igl::comiso::NRosyField solver(V,F);
+  igl::copyleft::comiso::NRosyField solver(V,F);
 
 
   // Add hard constraints
   // Add hard constraints
   for (unsigned i=0; i<b.size();++i)
   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 igl
 {
 {
+  namespace copyleft
+  {
   namespace comiso
   namespace comiso
   {
   {
     // Generate a N-RoSy field from a sparse set of constraints
     // Generate a N-RoSy field from a sparse set of constraints
@@ -61,6 +63,7 @@ namespace igl
 
 
   }
   }
 }
 }
+}
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
 #  include "nrosy.cpp"
 #  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 
 // 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 
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_NO_CORK
 #include "from_cork_mesh.h"
 #include "from_cork_mesh.h"
 
 
 template <
 template <
   typename DerivedV,
   typename DerivedV,
   typename DerivedF>
   typename DerivedF>
-IGL_INLINE void igl::copyleft::boolean::from_cork_mesh(
+IGL_INLINE void igl::copyleft::cork::from_cork_mesh(
   const CorkTriMesh & mesh,
   const CorkTriMesh & mesh,
   Eigen::PlainObjectBase<DerivedV > & V,
   Eigen::PlainObjectBase<DerivedV > & V,
   Eigen::PlainObjectBase<DerivedF > & F)
   Eigen::PlainObjectBase<DerivedF > & F)
@@ -37,8 +36,6 @@ IGL_INLINE void igl::copyleft::boolean::from_cork_mesh(
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 #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 
 // 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 
 // 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/.
 // 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 "../../igl_inline.h"
 #include <cork.h>
 #include <cork.h>
 #include <Eigen/Core>
 #include <Eigen/Core>
@@ -15,7 +14,7 @@ namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cork
     {
     {
       // Convert cork's triangle mesh representation to a (V,F) mesh.
       // Convert cork's triangle mesh representation to a (V,F) mesh.
       //
       //
@@ -38,4 +37,3 @@ namespace igl
 #  include "from_cork_mesh.cpp"
 #  include "from_cork_mesh.cpp"
 #endif
 #endif
 #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 
 // 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 
 // 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/.
 // 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 "to_cork_mesh.h"
 #include "from_cork_mesh.h"
 #include "from_cork_mesh.h"
 
 
@@ -17,7 +16,7 @@ template <
   typename DerivedFB,
   typename DerivedFB,
   typename DerivedVC,
   typename DerivedVC,
   typename DerivedFC>
   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<DerivedVA > & VA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedFA > & FA,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
   const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -94,8 +93,7 @@ IGL_INLINE void igl::copyleft::boolean::mesh_boolean_cork(
 }
 }
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 
 
-#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 
 // 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 
 // 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/.
 // 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 "../../igl_inline.h"
 #include <Eigen/Core>
 #include <Eigen/Core>
 #include <cork.h> // for consistent uint
 #include <cork.h> // for consistent uint
@@ -17,7 +16,7 @@ namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cork
     {
     {
       // Compute a boolean operation on two input meshes using the cork library.
       // Compute a boolean operation on two input meshes using the cork library.
       //
       //
@@ -37,7 +36,7 @@ namespace igl
         typename DerivedFB,
         typename DerivedFB,
         typename DerivedVC,
         typename DerivedVC,
         typename DerivedFC>
         typename DerivedFC>
-      IGL_INLINE void mesh_boolean_cork(
+      IGL_INLINE void mesh_boolean(
         const Eigen::PlainObjectBase<DerivedVA > & VA,
         const Eigen::PlainObjectBase<DerivedVA > & VA,
         const Eigen::PlainObjectBase<DerivedFA > & FA,
         const Eigen::PlainObjectBase<DerivedFA > & FA,
         const Eigen::PlainObjectBase<DerivedVB > & VB,
         const Eigen::PlainObjectBase<DerivedVB > & VB,
@@ -50,8 +49,7 @@ namespace igl
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
-#  include "mesh_boolean_cork.cpp"
-#endif
+#  include "mesh_boolean.cpp"
 #endif
 #endif
 
 
 #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 
 // 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 
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_NO_CORK
 #include "to_cork_mesh.h"
 #include "to_cork_mesh.h"
 template <
 template <
   typename DerivedV,
   typename DerivedV,
   typename DerivedF>
   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<DerivedV > & V,
   const Eigen::PlainObjectBase<DerivedF > & F,
   const Eigen::PlainObjectBase<DerivedF > & F,
   CorkTriMesh & mesh)
   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.");
   assert((V.cols() == 0 || V.cols() == 3) && "Vertices should be in 3D.");
   mesh.n_triangles = F.rows();
   mesh.n_triangles = F.rows();
   mesh.n_vertices = V.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];
   mesh.triangles = new uint[mesh.n_triangles*3];
   for(size_t v = 0;v<mesh.n_vertices;v++)
   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
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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
 #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 
 // 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 
 // 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/.
 // 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 "../../igl_inline.h"
 #include <cork.h>
 #include <cork.h>
 #include <Eigen/Core>
 #include <Eigen/Core>
@@ -15,7 +14,7 @@ namespace igl
 {
 {
   namespace copyleft
   namespace copyleft
   {
   {
-    namespace boolean
+    namespace cork
     {
     {
       // Convert a (V,F) mesh to a cork's triangle mesh representation.
       // Convert a (V,F) mesh to a cork's triangle mesh representation.
       //
       //
@@ -38,4 +37,3 @@ namespace igl
 #  include "to_cork_mesh.cpp"
 #  include "to_cork_mesh.cpp"
 #endif
 #endif
 #endif
 #endif
-#endif

+ 5 - 5
include/igl/cross_field_missmatch.cpp

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

+ 2 - 2
include/igl/cross_field_missmatch.h

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

+ 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,
                                                     Eigen::PlainObjectBase<DerivedO> &singularityIndex,
                                                     bool isCombed)
                                                     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, 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);
   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.resize(Qr,Ele.rows());
   I.setFromTriplets(IJV.begin(),IJV.end());
   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
 // Explicit template specialization
 // generated by autoexplicit.sh
 // 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> >&);
 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<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<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<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
 #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>&);
 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
 // 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, 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>&);
 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
 #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_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_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
 #endif

+ 38 - 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);
   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
 #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<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**);
 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**);
@@ -65,4 +101,6 @@ template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, -1, 0, -1, -
 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_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_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_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
 #endif

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

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

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

@@ -28,7 +28,7 @@ namespace igl
       // Double parameters
       // Double parameters
       std::map<MSKdparame,double> douparam;
       std::map<MSKdparame,double> douparam;
       // Default values
       // Default values
-      MosekData();
+      IGL_INLINE MosekData();
     };
     };
     // Solve a convex quadratic optimization problem with linear and constant
     // Solve a convex quadratic optimization problem with linear and constant
     // bounds, that is:
     // 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
   // Resize for output
   N.setZero(V.rows(),3);
   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);
     W(F.rows(),3);
   switch(weighting)
   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> >&);
 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<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<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
 #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
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "render_to_png.h"
 #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(
 IGL_INLINE bool igl::png::render_to_png(
   const std::string png_file,
   const std::string png_file,
@@ -26,8 +17,7 @@ IGL_INLINE bool igl::png::render_to_png(
   const bool alpha,
   const bool alpha,
   const bool fast)
   const bool fast)
 {
 {
-  YImage *img = new YImage();
-  img->resize(width,height);
+  unsigned char * data = new unsigned char[width*height];
   glReadPixels(
   glReadPixels(
     0,
     0,
     0,
     0,
@@ -35,18 +25,18 @@ IGL_INLINE bool igl::png::render_to_png(
     height,
     height,
     GL_RGBA,
     GL_RGBA,
     GL_UNSIGNED_BYTE,
     GL_UNSIGNED_BYTE,
-    img->data());
-  img->flip();
+    data);
+  //img->flip();
   if(!alpha)
   if(!alpha)
   {
   {
     for(int i = 0;i<width;i++)
     for(int i = 0;i<width;i++)
     for(int j = 0;j<height;j++)
     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;
   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.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
 // 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "render_to_png_async.h"
 #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(
 static IGL_INLINE bool render_to_png_async_helper(
-  YImage * img,
+  unsigned char * img, int width, int height,
   const std::string png_file,
   const std::string png_file,
   const bool alpha,
   const bool alpha,
   const bool fast)
   const bool fast)
 {
 {
-
-  img->flip();
-  const int width = img->width();
-  const int height = img->height();
+  //img->flip();
   if(!alpha)
   if(!alpha)
   {
   {
     for(int i = 0;i<width;i++)
     for(int i = 0;i<width;i++)
     for(int j = 0;j<height;j++)
     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;
   return ret;
 }
 }
 
 
@@ -52,8 +39,7 @@ IGL_INLINE std::thread igl::png::render_to_png_async(
   const bool fast)
   const bool fast)
 {
 {
   // Part that should serial
   // Part that should serial
-  YImage * img = new YImage();
-  img->resize(width,height);
+  unsigned char * data = new unsigned char[width*height];
   glReadPixels(
   glReadPixels(
     0,
     0,
     0,
     0,
@@ -61,9 +47,9 @@ IGL_INLINE std::thread igl::png::render_to_png_async(
     height,
     height,
     GL_RGBA,
     GL_RGBA,
     GL_UNSIGNED_BYTE,
     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();
   t.detach();
   return t;
   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.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
 // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "texture_from_file.h"
 #include "texture_from_file.h"
 
 
@@ -12,7 +12,6 @@
 #include "../pathinfo.h"
 #include "../pathinfo.h"
 #include "../opengl/report_gl_error.h"
 #include "../opengl/report_gl_error.h"
 #include "../opengl/texture_from_tga.h"
 #include "../opengl/texture_from_tga.h"
-#include <YImage.hpp>
 #include <string>
 #include <string>
 #include <algorithm>
 #include <algorithm>
 #include <iostream>
 #include <iostream>

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

@@ -8,20 +8,22 @@
 #include "texture_from_png.h"
 #include "texture_from_png.h"
 
 
 #include "../opengl/report_gl_error.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)
 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;
     return false;
   }
   }
+
   // Why do I need to flip?
   // Why do I need to flip?
-  if(flip)
+  /*if(flip)
   {
   {
     yimg.flip();
     yimg.flip();
-  }
+  }*/
+  
   glGenTextures(1, &id);
   glGenTextures(1, &id);
   glBindTexture(GL_TEXTURE_2D, id);
   glBindTexture(GL_TEXTURE_2D, id);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   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);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
   glTexImage2D(
   glTexImage2D(
     GL_TEXTURE_2D, 0, GL_RGB,
     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);
   glBindTexture(GL_TEXTURE_2D, 0);
+
+  stbi_image_free(data);
+
   return true;
   return true;
 }
 }
 
 
@@ -49,27 +54,30 @@ IGL_INLINE bool igl::png::texture_from_png(
   Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic>& A
   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;
     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;
   return true;
 }
 }

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

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

+ 1 - 1
include/igl/point_simplex_squared_distance.h

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

+ 21 - 0
include/igl/project.cpp

@@ -29,9 +29,30 @@ Eigen::Matrix<Scalar,3,1> igl::project(
   return tmp.head(3);
   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
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // 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<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 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
 #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>& model,
     const    Eigen::Matrix<Scalar,4,4>& proj,
     const    Eigen::Matrix<Scalar,4,4>& proj,
     const    Eigen::Matrix<Scalar,4,1>&  viewport);
     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
 #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&);
 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<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, 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
 #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);
   angle = angle*(180.0/PI);
 }
 }
 
 
-#ifndef IGL_NO_HEADER
+#ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // Explicit template specialization
 template void igl::quat_to_axis_angle<float>(float const*, float*, float&);
 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&);
 template void igl::quat_to_axis_angle_deg<float>(float const*, float*, float&);

+ 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, 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<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::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
 #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, -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, 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, -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
 #endif

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

@@ -8,21 +8,6 @@
 
 
 #include "OpenGL_shader.h"
 #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 <iostream>
 #include <fstream>
 #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)
   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)
       if (callback_mouse_down(*this,static_cast<int>(button),modifier))
       if (callback_mouse_down(*this,static_cast<int>(button),modifier))
         return true;
         return true;
@@ -571,8 +575,6 @@ namespace viewer
 
 
     down = true;
     down = true;
 
 
-    down_mouse_x = current_mouse_x;
-    down_mouse_y = current_mouse_y;
     down_translation = core.model_translation;
     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_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>(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_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
 #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
+

+ 38 - 323
optional/CMakeLists.txt

@@ -1,333 +1,48 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8.12)
 project(libigl)
 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()
 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)
 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)
+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}")
+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()
 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
 These are (admittedly unpopular) functions that have never been used by us
 statically so we haven't explicit instantiations (yet).
 statically so we haven't explicit instantiations (yet).
 
 
-
-#### Examples ####
-You can make a slew of examples by issuing:
-
-    cd ../examples
-    make
-
 #### External ####
 #### External ####
 
 
-
 Finally there are a number of external libraries that we include in
 Finally there are a number of external libraries that we include in
 `./external/` because they are either difficult to obtain or they have been
 `./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
 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::MatrixXd V;
     Eigen::MatrixXi F;
     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:
 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)
 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()
 endif()
 
 
-find_package(OPENGL QUIET)
-
-if (OPENGL_FOUND)
-  add_definitions(-DPY_VIEWER)
-endif (OPENGL_FOUND)
-
 # Force a specific python version
 # Force a specific python version
 # SET(PYTHON_LIBRARIES "D:/Python34/libs/python34.lib")
 # SET(PYTHON_LIBRARIES "D:/Python34/libs/python34.lib")
 # SET(PYTHON_INCLUDE_DIR "D:/Python34/include")
 # SET(PYTHON_INCLUDE_DIR "D:/Python34/include")
@@ -39,154 +27,100 @@ find_package(PythonInterp REQUIRED)
 
 
 string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
 string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
 if (UNIX)
 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)
   if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
   endif()
   endif()
 endif()
 endif()
 
 
 # Compile with compiler warnings turned on
 # 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_directories(${PYTHON_INCLUDE_DIR} include)
 
 
 ## include pybing
 ## include pybing
 include_directories(${PROJECT_SOURCE_DIR}/../external/pybind11/include)
 include_directories(${PROJECT_SOURCE_DIR}/../external/pybind11/include)
 
 
-## include eigen
-include_directories(${PROJECT_SOURCE_DIR}/../external/nanogui/ext/eigen)
-
 ## include libigl
 ## 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")
   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)
   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_vector.cpp
   py_igl.cpp
   py_igl.cpp
   py_doc.cpp
   py_doc.cpp
   ${SHARED_SOURCES}
   ${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 (WIN32)
   if (MSVC)
   if (MSVC)
     # Enforce size-based optimization and link time code generation on MSVC (~30% smaller binaries in experiments)
     # 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()
   endif()
 
 
   # .PYD file extension on Windows
   # .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
   # Link against the Python shared library
   # message(FATAL_ERROR ${PYTHON_LIBRARY})
   # message(FATAL_ERROR ${PYTHON_LIBRARY})
   # target_link_libraries(igl ${PYTHON_LIBRARY})
   # target_link_libraries(igl ${PYTHON_LIBRARY})
-  target_link_libraries(igl ${PYTHON_LIBRARIES})
+  target_link_libraries(pyigl ${PYTHON_LIBRARIES})
 
 
 
 
 elseif (UNIX)
 elseif (UNIX)
@@ -203,18 +137,18 @@ elseif (UNIX)
   # fine -- they will be resolved at import time.
   # fine -- they will be resolved at import time.
 
 
   # .SO file extension on Linux/Mac OS
   # .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
   # Strip unnecessary sections of the binary on Linux/Mac OS
   if(APPLE)
   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)
     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()
     endif()
   else()
   else()
     if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
     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()
   endif()
 endif()
 endif()

+ 1 - 1
python/README.md

@@ -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:
 two meshes and switches between the two when a key is pressed:
 
 
 ```python
 ```python
-import igl
+import pyigl as igl
 
 
 V1 = igl.eigen.MatrixXd()
 V1 = igl.eigen.MatrixXd()
 F1 = igl.eigen.MatrixXi()
 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 <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) {
 void python_export_igl_comiso(py::module &me) {
 
 
   py::module m = me.def_submodule(
   py::module m = me.def_submodule(
     "comiso", "Wrappers for libigl functions that use comiso");
     "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 numpy as np
 import scipy.sparse as sparse
 import scipy.sparse as sparse
-import igl
+import pyigl as igl
 
 
 def p2e(m):
 def p2e(m):
     if isinstance(m, np.ndarray):
     if isinstance(m, np.ndarray):

+ 1 - 1
python/py_igl.cpp

@@ -1,6 +1,6 @@
 #include <Eigen/Dense>
 #include <Eigen/Dense>
 
 
-#include "python.h"
+#include "python_shared.h"
 
 
 #include <igl/readOFF.h>
 #include <igl/readOFF.h>
 #include <igl/writeOBJ.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<int> round_vertices;
   std::vector<std::vector<int> > hard_features;
   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,
 }, __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("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")
 // , py::arg("round_vertices"), py::arg("hard_features")
@@ -50,7 +50,7 @@ m.def("miq", []
   std::vector<int> roundVertices;
   std::vector<int> roundVertices;
   std::vector<std::vector<int> > hardFeatures;
   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,
 }, __doc_igl_comiso_miq,
 py::arg("V"), py::arg("F"), py::arg("PD1_combed"), py::arg("PD2_combed"),
 py::arg("V"), py::arg("F"), py::arg("PD1_combed"), py::arg("PD2_combed"),
 py::arg("MMatch"), py::arg("Singular"), py::arg("Seams"),
 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;
     w_softt = w_soft;
 
 
   Eigen::VectorXd St;
   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;
   S = St;
 
 
 }, __doc_igl_comiso_nrosy,
 }, __doc_igl_comiso_nrosy,
@@ -54,7 +54,7 @@ m.def("nrosy", []
     bt = b;
     bt = b;
 
 
   Eigen::VectorXd St;
   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;
   S = St;
 }, __doc_igl_comiso_nrosy,
 }, __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"));
 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/Dense>
 #include <Eigen/Sparse>
 #include <Eigen/Sparse>
 
 
-#include "python.h"
+#include "python_shared.h"
 #define ENABLE_SERIALIZATION
 #define ENABLE_SERIALIZATION
 #include <igl/viewer/Viewer.h>
 #include <igl/viewer/Viewer.h>
 #include <igl/viewer/ViewerCore.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",&igl::viewer::ViewerCore::draw)
     .def("draw_buffer",&igl::viewer::ViewerCore::draw_buffer)
     .def("draw_buffer",&igl::viewer::ViewerCore::draw_buffer)
 
 
-    .def_readwrite("textrenderer",&igl::viewer::ViewerCore::textrenderer)
     .def_readwrite("shininess",&igl::viewer::ViewerCore::shininess)
     .def_readwrite("shininess",&igl::viewer::ViewerCore::shininess)
 
 
     .def_property("background_color",
     .def_property("background_color",

+ 1 - 1
python/py_vector.cpp

@@ -3,7 +3,7 @@
 #include <Eigen/Sparse>
 #include <Eigen/Sparse>
 
 
 
 
-#include "python.h"
+#include "python_shared.h"
 
 
 /// Creates Python bindings for a dynamic Eigen matrix
 /// Creates Python bindings for a dynamic Eigen matrix
 template <typename Type>
 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 <sstream>
 #include <string>
 #include <string>
 #include <fstream>
 #include <fstream>
@@ -14,9 +14,9 @@ extern void python_export_igl_viewer(py::module &);
 extern void python_export_igl_comiso(py::module &);
 extern void python_export_igl_comiso(py::module &);
 #endif
 #endif
 
 
-PYTHON_PLUGIN(igl) {
+PYTHON_PLUGIN(pyigl) {
     py::init_threading();
     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_vector(m);
     python_export_igl(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 socket
 import threading
 import threading
-import igl
+import pyigl as igl
 import array
 import array
 import time
 import time
 
 

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

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

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

@@ -2,7 +2,7 @@
 import sys, os
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 sys.path.insert(0, os.getcwd() + "/../")
 
 
-import igl
+import pyigl as igl
 
 
 # Load a mesh in OFF format
 # Load a mesh in OFF format
 V = igl.eigen.MatrixXd()
 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
 # Wait for it to set up the socket
 time.sleep(1)
 time.sleep(1)
 
 
-import igl
+import pyigl as igl
 import tcpviewer
 import tcpviewer
 
 
 # Read a mesh
 # Read a mesh

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 1 - 1
python/tutorial/303_LaplaceEquation.py

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

+ 1 - 1
python/tutorial/304_LinearEqualityConstraints.py

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

+ 1 - 1
python/tutorial/305_QuadraticProgramming.py

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

+ 1 - 1
python/tutorial/306_EigenDecomposition.py

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

+ 1 - 1
python/tutorial/401_BiharmonicDeformation.py

@@ -2,7 +2,7 @@
 import sys, os
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 sys.path.insert(0, os.getcwd() + "/../")
 
 
-import igl
+import pyigl as igl
 
 
 global bc_frac, bc_dir,deformation_field, V, U, V_bc, U_bc, F, b
 global bc_frac, bc_dir,deformation_field, V, U, V_bc, U_bc, F, b
 bc_frac = 1.0
 bc_frac = 1.0

+ 1 - 1
python/tutorial/402_PolyharmonicDeformation.py

@@ -2,7 +2,7 @@
 import sys, os
 import sys, os
 sys.path.insert(0, os.getcwd() + "/../")
 sys.path.insert(0, os.getcwd() + "/../")
 
 
-import igl
+import pyigl as igl
 
 
 global z_max, z_dir, k, resolve, V, U, Z, F, b, bc
 global z_max, z_dir, k, resolve, V, U, Z, F, b, bc
 
 

Деякі файли не було показано, через те що забагато файлів було змінено