Sfoglia il codice sorgente

Merge remote-tracking branch 'upstream/master' into merge_branch

Former-commit-id: f92b6355dbf7e4bef84803d3aa80b9cfad96b30e
zero-impact 6 anni fa
parent
commit
4f83e01386

+ 21 - 8
.appveyor.yml

@@ -8,21 +8,34 @@ branches:
     - alecjacobson
     - alecjacobson
     - cmake
     - cmake
     - cgal
     - cgal
+environment:
+  BOOST_ROOT: C:/Libraries/boost_1_65_1
 install:
 install:
   - git submodule update --init --recursive
   - git submodule update --init --recursive
   - cinstall: python
   - cinstall: python
 build_script:
 build_script:
-  - echo Running cmake...
   - cd c:\projects\libigl
   - cd c:\projects\libigl
-  - cd external
+  # External libraries (boost)
+  # - cd external
+  # - mkdir build
+  # - cd build
+  # - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
+  # - msbuild %MSBuildOptions% libigl_external.sln
+  # - cd ../..
+  # Python bindings
+  # - cd python
+  # - mkdir build
+  # - cd build
+  # - cmake -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON ../
+  # - msbuild %MSBuildOptions% pyigl.sln
+  # - cd ../tutorial
+  # - ${PYTHON} 101_FileIO.py
+  # - cd ../../
+  # Tutorials
+  - cd tutorial
   - mkdir build
   - mkdir build
   - cd build
   - cd build
-  - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
-  - msbuild %MSBuildOptions% libigl_external.sln
-  - cd ../../tutorial
-  - mkdir build
-  - cd build
-  - cmake -D "LIBIGL_USE_STATIC_LIBRARY=ON" -D "LIBIGL_WITH_ANTTWEAKBAR=OFF" -D "BOOST_ROOT=../external/boost/" -G "Visual Studio 15 2017 Win64" ../
+  - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -G "Visual Studio 15 2017 Win64" ../
   - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
   - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
   - set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
   - set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
   - msbuild %MSBuildOptions% libigl_tutorials.sln
   - msbuild %MSBuildOptions% libigl_tutorials.sln

+ 5 - 0
.gitignore

@@ -28,6 +28,11 @@ external/embree/bin/*
 external/embree/bin
 external/embree/bin
 external/embree/doc/html/*
 external/embree/doc/html/*
 external/embree/doc/latex/*
 external/embree/doc/latex/*
+external/gmp
+external/mpfr
+external/boost
+external/.cache
+external/build
 .DS_Store
 .DS_Store
 libigl.zip
 libigl.zip
 *tags
 *tags

+ 1 - 1
README.md

@@ -1,7 +1,7 @@
 # libigl - A simple C++ geometry processing library
 # libigl - A simple C++ geometry processing library
 [![Build Status](https://travis-ci.org/libigl/libigl.svg?branch=master)](https://travis-ci.org/libigl/libigl)
 [![Build Status](https://travis-ci.org/libigl/libigl.svg?branch=master)](https://travis-ci.org/libigl/libigl)
 [![Build status](https://ci.appveyor.com/api/projects/status/mf3t9rnhco0vhly8/branch/master?svg=true)](https://ci.appveyor.com/project/danielepanozzo/libigl-6hjk1/branch/master)
 [![Build status](https://ci.appveyor.com/api/projects/status/mf3t9rnhco0vhly8/branch/master?svg=true)](https://ci.appveyor.com/project/danielepanozzo/libigl-6hjk1/branch/master)
-![](libigl-teaser.png)
+![](https://github.com/libigl/libigl/raw/5ff6387765fa85ca46f1a6222728e35e2b8b8961/libigl-teaser.png)
 
 
 <https://github.com/libigl/libigl/>
 <https://github.com/libigl/libigl/>
 
 

+ 1 - 1
include/igl/Camera.h

@@ -16,7 +16,7 @@
 
 
 #include <Eigen/Geometry>
 #include <Eigen/Geometry>
 #include <Eigen/Core>
 #include <Eigen/Core>
-#include <PI.h>
+#include "PI.h"
 
 
 #define IGL_CAMERA_MIN_ANGLE 5.0
 #define IGL_CAMERA_MIN_ANGLE 5.0
 namespace igl
 namespace igl

+ 7 - 11
include/igl/average_onto_faces.cpp

@@ -7,22 +7,18 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "average_onto_faces.h"
 #include "average_onto_faces.h"
 
 
-template <typename T, typename I>
-IGL_INLINE void igl::average_onto_faces(const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
-            const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
-            const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
-            Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SF)
+template <typename DerivedF, typename DerivedS, typename DerivedSF>
+IGL_INLINE void average_onto_faces(
+  const Eigen::MatrixBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedS> & S,
+  Eigen::PlainObjectBase<DerivedSF> & SF)
 {
 {
-  
-  SF = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>::Zero(F.rows(),S.cols());
-
+  SF.setConstant(F.rows(),S.cols(),0);
   for (int i = 0; i <F.rows(); ++i)
   for (int i = 0; i <F.rows(); ++i)
     for (int j = 0; j<F.cols(); ++j)
     for (int j = 0; j<F.cols(); ++j)
       SF.row(i) += S.row(F(i,j));
       SF.row(i) += S.row(F(i,j));
-
   SF.array() /= F.cols();
   SF.array() /= F.cols();
-  
-};
+}
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // Explicit template instantiation

+ 7 - 9
include/igl/average_onto_faces.h

@@ -16,17 +16,15 @@ namespace igl
   // Move a scalar field defined on faces to vertices by averaging
   // Move a scalar field defined on faces to vertices by averaging
   //
   //
   // Input:
   // Input:
-  // V,F: mesh
-  // S: scalar field defined on vertices, Vx1
-  // 
+  //   F  #F by ss list of simples/faces
+  //   S  #V by dim list of per-vertex values
   // Output:
   // Output:
-  // SV: scalar field defined on faces
-  template <typename T, typename I>
+  //   SF  #F by dim list of per-face values
+  template <typename DerivedF, typename DerivedS, typename DerivedSF>
   IGL_INLINE void average_onto_faces(
   IGL_INLINE void average_onto_faces(
-    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &V,
-    const Eigen::Matrix<I, Eigen::Dynamic, Eigen::Dynamic> &F,
-    const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &S,
-    Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &SF);
+    const Eigen::MatrixBase<DerivedF> & F,
+    const Eigen::MatrixBase<DerivedS> & S,
+    Eigen::PlainObjectBase<DerivedSF> & SF);
 }
 }
 
 
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY

+ 2 - 1
include/igl/copyleft/cgal/extract_feature.cpp

@@ -7,7 +7,8 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 
 
 #include "extract_feature.h"
 #include "extract_feature.h"
-#include <igl/unique_edge_map.h>
+#include "../../unique_edge_map.h"
+#include "../../PI.h"
 #include <CGAL/Kernel/global_functions.h>
 #include <CGAL/Kernel/global_functions.h>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
 
 

+ 54 - 71
include/igl/copyleft/cgal/fast_winding_number.cpp

@@ -1,3 +1,4 @@
+#include "fast_winding_number.h"
 #include "../../fast_winding_number.h"
 #include "../../fast_winding_number.h"
 #include "../../octree.h"
 #include "../../octree.h"
 #include "../../knn.h"
 #include "../../knn.h"
@@ -5,78 +6,60 @@
 #include "point_areas.h"
 #include "point_areas.h"
 #include <vector>
 #include <vector>
 
 
-namespace igl {
-  namespace copyleft{
-    namespace cgal{
-      template <typename DerivedP, typename DerivedN, typename DerivedQ,
-        typename BetaType, typename DerivedWN>
-      IGL_INLINE void fast_winding_number(const Eigen::MatrixBase<DerivedP>& P,
-                                          const Eigen::MatrixBase<DerivedN>& N,
-                                          const Eigen::MatrixBase<DerivedQ>& Q,
-                                          const int expansion_order,
-                                          const BetaType beta,
-                                          Eigen::PlainObjectBase<DerivedWN>& WN
-                                          ){
-        typedef typename DerivedWN::Scalar real;
-        typedef typename Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic>
-                                                                  RealMatrix;
+template <
+  typename DerivedP, 
+  typename DerivedN, 
+  typename DerivedQ,
+  typename BetaType, 
+  typename DerivedWN>
+IGL_INLINE void igl::copyleft::cgal::fast_winding_number(
+  const Eigen::MatrixBase<DerivedP>& P,
+  const Eigen::MatrixBase<DerivedN>& N,
+  const Eigen::MatrixBase<DerivedQ>& Q,
+  const int expansion_order,
+  const BetaType beta,
+  Eigen::PlainObjectBase<DerivedWN>& WN)
+{
+  typedef typename DerivedWN::Scalar real;
+  typedef typename Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic>
+    RealMatrix;
         
         
-        std::vector<std::vector<int> > point_indices;
-        Eigen::Matrix<int,Eigen::Dynamic,8> CH;
-        Eigen::Matrix<real,Eigen::Dynamic,3> CN;
-        Eigen::Matrix<real,Eigen::Dynamic,1> W;
-        Eigen::MatrixXi I;
-        Eigen::Matrix<real,Eigen::Dynamic,1> A;
-        
-        octree(P,point_indices,CH,CN,W);
-        knn(P,21,point_indices,CH,CN,W,I);
-        point_areas(P,I,N,A);
-        
-        Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic> EC;
-        Eigen::Matrix<real,Eigen::Dynamic,3> CM;
-        Eigen::Matrix<real,Eigen::Dynamic,1> R;
-        
-        igl::fast_winding_number(P,N,A,point_indices,CH,
-                                 expansion_order,CM,R,EC);
-        igl::fast_winding_number(P,N,A,point_indices,CH,
-                                 CM,R,EC,Q,beta,WN);
-      }
+  std::vector<std::vector<int> > point_indices;
+  Eigen::Matrix<int,Eigen::Dynamic,8> CH;
+  Eigen::Matrix<real,Eigen::Dynamic,3> CN;
+  Eigen::Matrix<real,Eigen::Dynamic,1> W;
+  Eigen::MatrixXi I;
+  Eigen::Matrix<real,Eigen::Dynamic,1> A;
+  
+  octree(P,point_indices,CH,CN,W);
+  knn(P,21,point_indices,CH,CN,W,I);
+  point_areas(P,I,N,A);
+  
+  Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic> EC;
+  Eigen::Matrix<real,Eigen::Dynamic,3> CM;
+  Eigen::Matrix<real,Eigen::Dynamic,1> R;
+  
+  igl::fast_winding_number(
+    P,N,A,point_indices,CH,expansion_order,CM,R,EC);
+  igl::fast_winding_number(
+    P,N,A,point_indices,CH,CM,R,EC,Q,beta,WN);
+}
       
       
-      template <typename DerivedP, typename DerivedN,
-        typename DerivedQ, typename DerivedWN>
-      IGL_INLINE void fast_winding_number(
-                                          const Eigen::MatrixBase<DerivedP>& P,
-                                          const Eigen::MatrixBase<DerivedN>& N,
-                                          const Eigen::MatrixBase<DerivedQ>& Q,
-                                          Eigen::PlainObjectBase<DerivedWN>& WN
-                                          ){
-        fast_winding_number(P,N,Q,2,2.0,WN);
-      }
-    }
-  }
+template <
+  typename DerivedP, 
+  typename DerivedN, 
+  typename DerivedQ, 
+  typename DerivedWN>
+IGL_INLINE void igl::copyleft::cgal::fast_winding_number(
+  const Eigen::MatrixBase<DerivedP>& P,
+  const Eigen::MatrixBase<DerivedN>& N,
+  const Eigen::MatrixBase<DerivedQ>& Q,
+  Eigen::PlainObjectBase<DerivedWN>& WN)
+{
+  fast_winding_number(P,N,Q,2,2.0,WN);
 }
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template void igl::copyleft::cgal::fast_winding_number<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, double, 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&, int, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+#endif

+ 65 - 52
include/igl/copyleft/cgal/fast_winding_number.h

@@ -5,58 +5,71 @@
 #include <vector>
 #include <vector>
 namespace igl
 namespace igl
 {
 {
-  // Evaluate the fast winding number for point data, without known areas. The
-  // areas are calculated using igl::knn and igl::copyleft::cgal::point_areas.
-  //
-  // This function performes the precomputation and evaluation all in one.
-  // If you need to acess the precomuptation for repeated evaluations, use the
-  // two functions designed for exposed precomputation, which are the first two
-  // functions see in igl/fast_winding_number.h
-  //
-  // Inputs:
-  //   P  #P by 3 list of point locations
-  //   N  #P by 3 list of point normals
-  //   Q  #Q by 3 list of query points for the winding number
-  //   beta  This is a Barnes-Hut style accuracy term that separates near feild
-  //         from far field. The higher the beta, the more accurate and slower
-  //         the evaluation. We reccommend using a beta value of 2.
-  //   expansion_order    the order of the taylor expansion. We support 0,1,2.
-  // Outputs:
-  //   WN  #Q by 1 list of windinng number values at each query point
-  //
-  template <typename DerivedP, typename DerivedN, typename DerivedQ,
-    typename BetaType, typename DerivedWN>
-  IGL_INLINE void fast_winding_number(const Eigen::MatrixBase<DerivedP>& P,
-                                      const Eigen::MatrixBase<DerivedN>& N,
-                                      const Eigen::MatrixBase<DerivedQ>& Q,
-                                      const int expansion_order,
-                                      const BetaType beta,
-                                      Eigen::PlainObjectBase<DerivedWN>& WN
-                                      );
-  
-  // Evaluate the fast winding number for point data, without known areas. The
-  // areas are calculated using igl::knn and
-  // igl::point_areas. This function uses the default expansion
-  // order and beta (both are set to 2).
-  //
-  // This function performes the precomputation and evaluation all in one.
-  // If you need to acess the precomuptation for repeated evaluations, use the
-  // two functions designed for exposed precomputation (described above).
-  
-  // Inputs:
-  //   P  #P by 3 list of point locations
-  //   N  #P by 3 list of point normals
-  //   Q  #Q by 3 list of query points for the winding number
-  // Outputs:
-  //   WN  #Q by 1 list of windinng number values at each query point
-  //
-  template <typename DerivedP, typename DerivedN, typename DerivedQ,
-    typename DerivedWN>
-  IGL_INLINE void fast_winding_number(const Eigen::MatrixBase<DerivedP>& P,
-                                      const Eigen::MatrixBase<DerivedN>& N,
-                                      const Eigen::MatrixBase<DerivedQ>& Q,
-                                      Eigen::PlainObjectBase<DerivedWN>& WN
-                                      );
+  namespace copyleft
+  {
+    namespace cgal
+    {
+    // Evaluate the fast winding number for point data, without known areas. The
+    // areas are calculated using igl::knn and igl::copyleft::cgal::point_areas.
+    //
+    // This function performes the precomputation and evaluation all in one.
+    // If you need to acess the precomuptation for repeated evaluations, use the
+    // two functions designed for exposed precomputation, which are the first two
+    // functions see in igl/fast_winding_number.h
+    //
+    // Inputs:
+    //   P  #P by 3 list of point locations
+    //   N  #P by 3 list of point normals
+    //   Q  #Q by 3 list of query points for the winding number
+    //   beta  This is a Barnes-Hut style accuracy term that separates near feild
+    //         from far field. The higher the beta, the more accurate and slower
+    //         the evaluation. We reccommend using a beta value of 2.
+    //   expansion_order    the order of the taylor expansion. We support 0,1,2.
+    // Outputs:
+    //   WN  #Q by 1 list of windinng number values at each query point
+    //
+    template <
+      typename DerivedP, 
+      typename DerivedN, 
+      typename DerivedQ,
+      typename BetaType, 
+      typename DerivedWN>
+    IGL_INLINE void fast_winding_number(
+      const Eigen::MatrixBase<DerivedP>& P,
+      const Eigen::MatrixBase<DerivedN>& N,
+      const Eigen::MatrixBase<DerivedQ>& Q,
+      const int expansion_order,
+      const BetaType beta,
+      Eigen::PlainObjectBase<DerivedWN>& WN);
+    
+    // Evaluate the fast winding number for point data, without known areas. The
+    // areas are calculated using igl::knn and
+    // igl::point_areas. This function uses the default expansion
+    // order and beta (both are set to 2).
+    //
+    // This function performes the precomputation and evaluation all in one.
+    // If you need to acess the precomuptation for repeated evaluations, use the
+    // two functions designed for exposed precomputation (described above).
+    
+    // Inputs:
+    //   P  #P by 3 list of point locations
+    //   N  #P by 3 list of point normals
+    //   Q  #Q by 3 list of query points for the winding number
+    // Outputs:
+    //   WN  #Q by 1 list of windinng number values at each query point
+    //
+    template <
+      typename DerivedP, 
+      typename DerivedN, 
+      typename DerivedQ, 
+      typename DerivedWN>
+    IGL_INLINE void fast_winding_number(
+      const Eigen::MatrixBase<DerivedP>& P,
+      const Eigen::MatrixBase<DerivedN>& N,
+      const Eigen::MatrixBase<DerivedQ>& Q,
+      Eigen::PlainObjectBase<DerivedWN>& WN);
+    }
+  }
 }
 }
 #ifndef IGL_STATIC_LIBRARY
 #ifndef IGL_STATIC_LIBRARY
 #  include "fast_winding_number.cpp"
 #  include "fast_winding_number.cpp"

+ 5 - 0
include/igl/copyleft/cgal/hausdorff.cpp

@@ -37,3 +37,8 @@ IGL_INLINE void igl::copyleft::cgal::hausdorff(
   };
   };
   return igl::hausdorff(V,dist_to_B,l,u);
   return igl::hausdorff(V,dist_to_B,l,u);
 }
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template void igl::copyleft::cgal::hausdorff<Eigen::Matrix<double, -1, -1, 0, -1, -1>, CGAL::Simple_cartesian<double>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> > const&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > > const&, double&, double&);
+#endif

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

@@ -73,4 +73,5 @@ template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
 template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck>(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > >&);
+template void igl::copyleft::cgal::mesh_to_cgal_triangle_list<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Simple_cartesian<double> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
 #endif
 #endif

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

@@ -135,4 +135,5 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance(
 // Explicit template instantiation
 // Explicit template instantiation
 template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck, Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >(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<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<double, -1, -1, 0, -1, -1> >&);
 template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck, Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >(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<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<double, -1, -1, 0, -1, -1> >&);
 template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck,   Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>,   Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -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<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3,   0, -1, 3> > const&, 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<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 1,   0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::copyleft::cgal::point_mesh_squared_distance<CGAL::Epeck,   Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>,   Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1,   -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -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<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3,   0, -1, 3> > const&, 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<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 1,   0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&,   Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::copyleft::cgal::point_mesh_squared_distance_precompute<CGAL::Simple_cartesian<double>, 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&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Simple_cartesian<double>, CGAL::AABB_triangle_primitive<CGAL::Simple_cartesian<double>, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >::iterator, CGAL::Boolean_tag<false> >, CGAL::Default> >&, std::vector<CGAL::Triangle_3<CGAL::Simple_cartesian<double> >, std::allocator<CGAL::Triangle_3<CGAL::Simple_cartesian<double> > > >&);
 #endif
 #endif

+ 25 - 25
include/igl/copyleft/tetgen/tetrahedralize.cpp

@@ -1,15 +1,15 @@
 // 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 "tetrahedralize.h"
 #include "tetrahedralize.h"
 #include "mesh_to_tetgenio.h"
 #include "mesh_to_tetgenio.h"
 #include "tetgenio_to_tetmesh.h"
 #include "tetgenio_to_tetmesh.h"
 
 
-// IGL includes 
+// IGL includes
 #include "../../matrix_to_list.h"
 #include "../../matrix_to_list.h"
 #include "../../list_to_matrix.h"
 #include "../../list_to_matrix.h"
 #include "../../boundary_facets.h"
 #include "../../boundary_facets.h"
@@ -19,11 +19,11 @@
 #include <iostream>
 #include <iostream>
 
 
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
-  const std::vector<std::vector<REAL > > & V, 
-  const std::vector<std::vector<int> > & F, 
+  const std::vector<std::vector<REAL > > & V,
+  const std::vector<std::vector<int> > & F,
   const std::string switches,
   const std::string switches,
-  std::vector<std::vector<REAL > > & TV, 
-  std::vector<std::vector<int > > & TT, 
+  std::vector<std::vector<REAL > > & TV,
+  std::vector<std::vector<int > > & TT,
   std::vector<std::vector<int> > & TF)
   std::vector<std::vector<int> > & TF)
 {
 {
   using namespace std;
   using namespace std;
@@ -60,10 +60,10 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 }
 }
 
 
 template <
 template <
-  typename DerivedV, 
-  typename DerivedF, 
-  typename DerivedTV, 
-  typename DerivedTT, 
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedTV,
+  typename DerivedTT,
   typename DerivedTF>
   typename DerivedTF>
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedV>& V,
@@ -101,12 +101,12 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 }
 }
 
 
 template <
 template <
-  typename DerivedV, 
-  typename DerivedF, 
-  typename DerivedVM, 
-  typename DerivedFM, 
-  typename DerivedTV, 
-  typename DerivedTT, 
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedVM,
+  typename DerivedFM,
+  typename DerivedTV,
+  typename DerivedTT,
   typename DerivedTF,
   typename DerivedTF,
   typename DerivedTM>
   typename DerivedTM>
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
@@ -124,7 +124,7 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   vector<vector<REAL> > vV,vTV;
   vector<vector<REAL> > vV,vTV;
   vector<vector<int> > vF,vTT,vTF;
   vector<vector<int> > vF,vTT,vTF;
   vector<int> vTM;
   vector<int> vTM;
-	
+
   matrix_to_list(V,vV);
   matrix_to_list(V,vV);
   matrix_to_list(F,vF);
   matrix_to_list(F,vF);
 	vector<int> vVM = matrix_to_list(VM);
 	vector<int> vVM = matrix_to_list(VM);
@@ -156,13 +156,13 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   return e;
   return e;
 }
 }
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
-  const std::vector<std::vector<REAL > > & V, 
-  const std::vector<std::vector<int> > & F, 
-  const std::vector<int> & VM, 
+  const std::vector<std::vector<REAL > > & V,
+  const std::vector<std::vector<int> > & F,
+  const std::vector<int> & VM,
 	const std::vector<int> & FM,
 	const std::vector<int> & FM,
   const std::string switches,
   const std::string switches,
-  std::vector<std::vector<REAL > > & TV, 
-  std::vector<std::vector<int > > & TT, 
+  std::vector<std::vector<REAL > > & TV,
+  std::vector<std::vector<int > > & TT,
   std::vector<std::vector<int> > & TF,
   std::vector<std::vector<int> > & TF,
   std::vector<int> & TM)
   std::vector<int> & TM)
 {
 {

+ 1 - 2
include/igl/edges.h

@@ -14,8 +14,7 @@
 namespace igl
 namespace igl
 {
 {
   // Constructs a list of unique edges represented in a given mesh (V,F)
   // Constructs a list of unique edges represented in a given mesh (V,F)
-  // Templates:
-  //   T  should be a eigen sparse matrix primitive type like int or double
+  //
   // Inputs:
   // Inputs:
   //   F  #F by 3 list of mesh faces (must be triangles)
   //   F  #F by 3 list of mesh faces (must be triangles)
   //   or
   //   or

+ 1 - 1
include/igl/exact_geodesic.cpp.REMOVED.git-id

@@ -1 +1 @@
-e20783b88c3cc89c874b97023ebfa0fc3ceb0377
+a0c5a93d2bc144890fbfa8d5e413d4dddc4a2827

+ 2 - 6
include/igl/fast_winding_number.h

@@ -40,7 +40,7 @@ namespace igl
                                       const Eigen::MatrixBase<DerivedA>& A,
                                       const Eigen::MatrixBase<DerivedA>& A,
             const std::vector<std::vector<Index> > & point_indices,
             const std::vector<std::vector<Index> > & point_indices,
             const Eigen::MatrixBase<DerivedCH>& CH,
             const Eigen::MatrixBase<DerivedCH>& CH,
-            const int exansion_order,
+            const int expansion_order,
             Eigen::PlainObjectBase<DerivedCM>& CM,
             Eigen::PlainObjectBase<DerivedCM>& CM,
             Eigen::PlainObjectBase<DerivedR>& R,
             Eigen::PlainObjectBase<DerivedR>& R,
             Eigen::PlainObjectBase<DerivedEC>& EC);
             Eigen::PlainObjectBase<DerivedEC>& EC);
@@ -98,10 +98,6 @@ namespace igl
   //   N  #P by 3 list of point normals
   //   N  #P by 3 list of point normals
   //   A  #P by 1 list of point areas
   //   A  #P by 1 list of point areas
   //   Q  #Q by 3 list of query points for the winding number
   //   Q  #Q by 3 list of query points for the winding number
-  //   beta  This is a Barnes-Hut style accuracy term that separates near feild
-  //         from far field. The higher the beta, the more accurate and slower
-  //         the evaluation. We reccommend using a beta value of 2.
-  //   expansion_order    the order of the taylor expansion. We support 0,1,2.
   // Outputs:
   // Outputs:
   //   WN  #Q by 1 list of windinng number values at each query point
   //   WN  #Q by 1 list of windinng number values at each query point
   //
   //
@@ -119,4 +115,4 @@ namespace igl
 #endif
 #endif
 
 
 #endif
 #endif
-
+

+ 1 - 0
include/igl/hausdorff.cpp

@@ -86,4 +86,5 @@ IGL_INLINE void igl::hausdorff(
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 template void igl::hausdorff<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>, double>(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&, double&);
 template void igl::hausdorff<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>, double>(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&, double&);
+template void igl::hausdorff<Eigen::Matrix<double, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::function<double (double const&, double const&, double const&)> const&, double&, double&);
 #endif
 #endif

+ 14 - 14
include/igl/per_corner_normals.cpp

@@ -13,8 +13,8 @@
 
 
 template <typename DerivedV, typename DerivedF, typename DerivedCN>
 template <typename DerivedV, typename DerivedF, typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
   const double corner_threshold,
   const double corner_threshold,
   Eigen::PlainObjectBase<DerivedCN> & CN)
   Eigen::PlainObjectBase<DerivedCN> & CN)
 {
 {
@@ -23,7 +23,7 @@ IGL_INLINE void igl::per_corner_normals(
   Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> FN;
   Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> FN;
   per_face_normals(V,F,FN);
   per_face_normals(V,F,FN);
   vector<vector<int> > VF,VFi;
   vector<vector<int> > VF,VFi;
-  vertex_triangle_adjacency(V,F,VF,VFi);
+  vertex_triangle_adjacency(V.rows(),F,VF,VFi);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
 }
 }
 
 
@@ -33,16 +33,16 @@ template <
   typename DerivedFN, 
   typename DerivedFN, 
   typename DerivedCN>
   typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
-  const Eigen::PlainObjectBase<DerivedV>& V,
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedFN>& FN,
+  const Eigen::MatrixBase<DerivedV>& V,
+  const Eigen::MatrixBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedFN>& FN,
   const double corner_threshold,
   const double corner_threshold,
   Eigen::PlainObjectBase<DerivedCN> & CN)
   Eigen::PlainObjectBase<DerivedCN> & CN)
 {
 {
   using namespace Eigen;
   using namespace Eigen;
   using namespace std;
   using namespace std;
   vector<vector<int> > VF,VFi;
   vector<vector<int> > VF,VFi;
-  vertex_triangle_adjacency(V,F,VF,VFi);
+  vertex_triangle_adjacency(V.rows(),F,VF,VFi);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
   return per_corner_normals(V,F,FN,VF,corner_threshold,CN);
 }
 }
 
 
@@ -53,9 +53,9 @@ template <
   typename IndexType,
   typename IndexType,
   typename DerivedCN>
   typename DerivedCN>
 IGL_INLINE void igl::per_corner_normals(
 IGL_INLINE void igl::per_corner_normals(
-  const Eigen::PlainObjectBase<DerivedV>& /*V*/,
-  const Eigen::PlainObjectBase<DerivedF>& F,
-  const Eigen::PlainObjectBase<DerivedFN>& FN,
+  const Eigen::MatrixBase<DerivedV>& /*V*/,
+  const Eigen::MatrixBase<DerivedF>& F,
+  const Eigen::MatrixBase<DerivedFN>& FN,
   const std::vector<std::vector<IndexType> >& VF,
   const std::vector<std::vector<IndexType> >& VF,
   const double corner_threshold,
   const double corner_threshold,
   Eigen::PlainObjectBase<DerivedCN> & CN)
   Eigen::PlainObjectBase<DerivedCN> & CN)
@@ -104,8 +104,8 @@ IGL_INLINE void igl::per_corner_normals(
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // Explicit template instantiation
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh
-template void igl::per_corner_normals<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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::per_corner_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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::per_corner_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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
-template void igl::per_corner_normals<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<double, -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&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
+template void igl::per_corner_normals<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::per_corner_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::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::per_corner_normals<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
+template void igl::per_corner_normals<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<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
 #endif
 #endif

+ 8 - 8
include/igl/per_corner_normals.h

@@ -23,8 +23,8 @@ namespace igl
   //     for corner F(i,j) is at CN(i*3+j,:) 
   //     for corner F(i,j) is at CN(i*3+j,:) 
   template <typename DerivedV, typename DerivedF, typename DerivedCN>
   template <typename DerivedV, typename DerivedF, typename DerivedCN>
   IGL_INLINE void per_corner_normals(
   IGL_INLINE void per_corner_normals(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
     const double corner_threshold,
     const double corner_threshold,
     Eigen::PlainObjectBase<DerivedCN> & CN);
     Eigen::PlainObjectBase<DerivedCN> & CN);
   // Other Inputs:
   // Other Inputs:
@@ -35,9 +35,9 @@ namespace igl
     typename DerivedFN, 
     typename DerivedFN, 
     typename DerivedCN>
     typename DerivedCN>
   IGL_INLINE void per_corner_normals(
   IGL_INLINE void per_corner_normals(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedFN>& FN,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedFN>& FN,
     const double corner_threshold,
     const double corner_threshold,
     Eigen::PlainObjectBase<DerivedCN> & CN);
     Eigen::PlainObjectBase<DerivedCN> & CN);
   // Other Inputs:
   // Other Inputs:
@@ -49,9 +49,9 @@ namespace igl
     typename IndexType,
     typename IndexType,
     typename DerivedCN>
     typename DerivedCN>
   IGL_INLINE void per_corner_normals(
   IGL_INLINE void per_corner_normals(
-    const Eigen::PlainObjectBase<DerivedV>& V,
-    const Eigen::PlainObjectBase<DerivedF>& F,
-    const Eigen::PlainObjectBase<DerivedFN>& FN,
+    const Eigen::MatrixBase<DerivedV>& V,
+    const Eigen::MatrixBase<DerivedF>& F,
+    const Eigen::MatrixBase<DerivedFN>& FN,
     const std::vector<std::vector<IndexType> >& VF,
     const std::vector<std::vector<IndexType> >& VF,
     const double corner_threshold,
     const double corner_threshold,
     Eigen::PlainObjectBase<DerivedCN> & CN);
     Eigen::PlainObjectBase<DerivedCN> & CN);

+ 12 - 11
include/igl/ray_box_intersect.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) 2016 Alec Jacobson <alecjacobson@gmail.com>
 // 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 
+//
+// 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 "ray_box_intersect.h"
 #include "ray_box_intersect.h"
 #include <vector>
 #include <vector>
@@ -27,7 +27,7 @@ IGL_INLINE bool igl::ray_box_intersect(
     const Eigen::Vector3f& rayo,
     const Eigen::Vector3f& rayo,
     const Eigen::Vector3f& rayd,
     const Eigen::Vector3f& rayd,
     const Eigen::Vector3f& bmin,
     const Eigen::Vector3f& bmin,
-    const Eigen::Vector3f& bmax, 
+    const Eigen::Vector3f& bmax,
     float & tnear,
     float & tnear,
     float & tfar
     float & tfar
     )->bool
     )->bool
@@ -35,12 +35,12 @@ IGL_INLINE bool igl::ray_box_intersect(
     Eigen::Vector3f bnear;
     Eigen::Vector3f bnear;
     Eigen::Vector3f bfar;
     Eigen::Vector3f bfar;
     // Checks for intersection testing on each direction coordinate
     // Checks for intersection testing on each direction coordinate
-    // Computes 
+    // Computes
     float t1, t2;
     float t1, t2;
     tnear = -1e+6f, tfar = 1e+6f; //, tCube;
     tnear = -1e+6f, tfar = 1e+6f; //, tCube;
     bool intersectFlag = true;
     bool intersectFlag = true;
     for (int i = 0; i < 3; ++i) {
     for (int i = 0; i < 3; ++i) {
-  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl; 
+  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl;
       assert(bmin(i) <= bmax(i));
       assert(bmin(i) <= bmax(i));
       if (::fabs(rayd(i)) < 1e-6) {   // Ray parallel to axis i-th
       if (::fabs(rayd(i)) < 1e-6) {   // Ray parallel to axis i-th
         if (rayo(i) < bmin(i) || rayo(i) > bmax(i)) {
         if (rayo(i) < bmin(i) || rayo(i) > bmax(i)) {
@@ -59,12 +59,12 @@ IGL_INLINE bool igl::ray_box_intersect(
         }
         }
   //      std::cout << "  bnear " << bnear(i) << ", bfar " << bfar(i) << std::endl;
   //      std::cout << "  bnear " << bnear(i) << ", bfar " << bfar(i) << std::endl;
         // Finds the distance parameters t1 and t2 of the two ray-box intersections:
         // Finds the distance parameters t1 and t2 of the two ray-box intersections:
-        // t1 must be the closest to the ray origin rayo. 
+        // t1 must be the closest to the ray origin rayo.
         t1 = (bnear(i) - rayo(i)) / rayd(i);
         t1 = (bnear(i) - rayo(i)) / rayd(i);
         t2 = (bfar(i) - rayo(i)) / rayd(i);
         t2 = (bfar(i) - rayo(i)) / rayd(i);
         if (t1 > t2) {
         if (t1 > t2) {
           std::swap(t1,t2);
           std::swap(t1,t2);
-        } 
+        }
         // The two intersection values are used to saturate tnear and tfar
         // The two intersection values are used to saturate tnear and tfar
         if (t1 > tnear) {
         if (t1 > tnear) {
           tnear = t1;
           tnear = t1;
@@ -72,7 +72,7 @@ IGL_INLINE bool igl::ray_box_intersect(
         if (t2 < tfar) {
         if (t2 < tfar) {
           tfar = t2;
           tfar = t2;
         }
         }
-  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar 
+  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar
   //        << "  tnear > tfar? " << (tnear > tfar) << ", tfar < 0? " << (tfar < 0) << std::endl;
   //        << "  tnear > tfar? " << (tnear > tfar) << ", tfar < 0? " << (tfar < 0) << std::endl;
         if(tnear > tfar) {
         if(tnear > tfar) {
           intersectFlag = false;
           intersectFlag = false;
@@ -145,5 +145,6 @@ IGL_INLINE bool igl::ray_box_intersect(
 }
 }
 
 
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
 template bool igl::ray_box_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::AlignedBox<double, 3> const&, double const&, double const&, double&, double&);
 template bool igl::ray_box_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::AlignedBox<double, 3> const&, double const&, double const&, double&, double&);
-#endif
+#endif

+ 10 - 10
include/igl/ray_mesh_intersect.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) 2016 Alec Jacobson <alecjacobson@gmail.com>
 // 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 
+//
+// 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 "ray_mesh_intersect.h"
 #include "ray_mesh_intersect.h"
 
 
@@ -15,8 +15,8 @@ extern "C"
 template <
 template <
   typename Derivedsource,
   typename Derivedsource,
   typename Deriveddir,
   typename Deriveddir,
-  typename DerivedV, 
-  typename DerivedF> 
+  typename DerivedV,
+  typename DerivedF>
 IGL_INLINE bool igl::ray_mesh_intersect(
 IGL_INLINE bool igl::ray_mesh_intersect(
   const Eigen::MatrixBase<Derivedsource> & s,
   const Eigen::MatrixBase<Derivedsource> & s,
   const Eigen::MatrixBase<Deriveddir> & dir,
   const Eigen::MatrixBase<Deriveddir> & dir,
@@ -26,14 +26,14 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 {
 {
   using namespace Eigen;
   using namespace Eigen;
   using namespace std;
   using namespace std;
-  // Should be but can't be const 
+  // Should be but can't be const
   Vector3d s_d = s.template cast<double>();
   Vector3d s_d = s.template cast<double>();
   Vector3d dir_d = dir.template cast<double>();
   Vector3d dir_d = dir.template cast<double>();
   hits.clear();
   hits.clear();
   // loop over all triangles
   // loop over all triangles
   for(int f = 0;f<F.rows();f++)
   for(int f = 0;f<F.rows();f++)
   {
   {
-    // Should be but can't be const 
+    // Should be but can't be const
     RowVector3d v0 = V.row(F(f,0)).template cast<double>();
     RowVector3d v0 = V.row(F(f,0)).template cast<double>();
     RowVector3d v1 = V.row(F(f,1)).template cast<double>();
     RowVector3d v1 = V.row(F(f,1)).template cast<double>();
     RowVector3d v2 = V.row(F(f,2)).template cast<double>();
     RowVector3d v2 = V.row(F(f,2)).template cast<double>();
@@ -57,8 +57,8 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 template <
 template <
   typename Derivedsource,
   typename Derivedsource,
   typename Deriveddir,
   typename Deriveddir,
-  typename DerivedV, 
-  typename DerivedF> 
+  typename DerivedV,
+  typename DerivedF>
 IGL_INLINE bool igl::ray_mesh_intersect(
 IGL_INLINE bool igl::ray_mesh_intersect(
   const Eigen::MatrixBase<Derivedsource> & source,
   const Eigen::MatrixBase<Derivedsource> & source,
   const Eigen::MatrixBase<Deriveddir> & dir,
   const Eigen::MatrixBase<Deriveddir> & dir,

+ 1 - 1
python/CMakeLists.txt

@@ -145,7 +145,7 @@ elseif(UNIX)
   # .SO file extension on Linux/Mac OS
   # .SO file extension on Linux/Mac OS
   set_target_properties(pyigl PROPERTIES SUFFIX ".so")
   set_target_properties(pyigl PROPERTIES SUFFIX ".so")
 
 
-  #Enable flag if undefined symbols appear on pyigl module import to get notified about the missing symbols at link time
+  # Enable flag if undefined symbols appear on pyigl module import to get notified about the missing symbols at link time
   option(CHECK_UNDEFINED        "Check for undefined symbols"    OFF)
   option(CHECK_UNDEFINED        "Check for undefined symbols"    OFF)
 
 
   # Strip unnecessary sections of the binary on Linux/Mac OS
   # Strip unnecessary sections of the binary on Linux/Mac OS

+ 17 - 0
shared/cmake/DownloadProject.CMakeLists.cmake.in

@@ -0,0 +1,17 @@
+# Distributed under the OSI-approved MIT License.  See accompanying
+# file LICENSE or https://github.com/Crascit/DownloadProject for details.
+
+cmake_minimum_required(VERSION 2.8.2)
+
+project(${DL_ARGS_PROJ}-download NONE)
+
+include(ExternalProject)
+ExternalProject_Add(${DL_ARGS_PROJ}-download
+                    ${DL_ARGS_UNPARSED_ARGUMENTS}
+                    SOURCE_DIR          "${DL_ARGS_SOURCE_DIR}"
+                    BINARY_DIR          "${DL_ARGS_BINARY_DIR}"
+                    CONFIGURE_COMMAND   ""
+                    BUILD_COMMAND       ""
+                    INSTALL_COMMAND     ""
+                    TEST_COMMAND        ""
+)

+ 182 - 0
shared/cmake/DownloadProject.cmake

@@ -0,0 +1,182 @@
+# Distributed under the OSI-approved MIT License.  See accompanying
+# file LICENSE or https://github.com/Crascit/DownloadProject for details.
+#
+# MODULE:   DownloadProject
+#
+# PROVIDES:
+#   download_project( PROJ projectName
+#                    [PREFIX prefixDir]
+#                    [DOWNLOAD_DIR downloadDir]
+#                    [SOURCE_DIR srcDir]
+#                    [BINARY_DIR binDir]
+#                    [QUIET]
+#                    ...
+#   )
+#
+#       Provides the ability to download and unpack a tarball, zip file, git repository,
+#       etc. at configure time (i.e. when the cmake command is run). How the downloaded
+#       and unpacked contents are used is up to the caller, but the motivating case is
+#       to download source code which can then be included directly in the build with
+#       add_subdirectory() after the call to download_project(). Source and build
+#       directories are set up with this in mind.
+#
+#       The PROJ argument is required. The projectName value will be used to construct
+#       the following variables upon exit (obviously replace projectName with its actual
+#       value):
+#
+#           projectName_SOURCE_DIR
+#           projectName_BINARY_DIR
+#
+#       The SOURCE_DIR and BINARY_DIR arguments are optional and would not typically
+#       need to be provided. They can be specified if you want the downloaded source
+#       and build directories to be located in a specific place. The contents of
+#       projectName_SOURCE_DIR and projectName_BINARY_DIR will be populated with the
+#       locations used whether you provide SOURCE_DIR/BINARY_DIR or not.
+#
+#       The DOWNLOAD_DIR argument does not normally need to be set. It controls the
+#       location of the temporary CMake build used to perform the download.
+#
+#       The PREFIX argument can be provided to change the base location of the default
+#       values of DOWNLOAD_DIR, SOURCE_DIR and BINARY_DIR. If all of those three arguments
+#       are provided, then PREFIX will have no effect. The default value for PREFIX is
+#       CMAKE_BINARY_DIR.
+#
+#       The QUIET option can be given if you do not want to show the output associated
+#       with downloading the specified project.
+#
+#       In addition to the above, any other options are passed through unmodified to
+#       ExternalProject_Add() to perform the actual download, patch and update steps.
+#       The following ExternalProject_Add() options are explicitly prohibited (they
+#       are reserved for use by the download_project() command):
+#
+#           CONFIGURE_COMMAND
+#           BUILD_COMMAND
+#           INSTALL_COMMAND
+#           TEST_COMMAND
+#
+#       Only those ExternalProject_Add() arguments which relate to downloading, patching
+#       and updating of the project sources are intended to be used. Also note that at
+#       least one set of download-related arguments are required.
+#
+#       If using CMake 3.2 or later, the UPDATE_DISCONNECTED option can be used to
+#       prevent a check at the remote end for changes every time CMake is run
+#       after the first successful download. See the documentation of the ExternalProject
+#       module for more information. It is likely you will want to use this option if it
+#       is available to you. Note, however, that the ExternalProject implementation contains
+#       bugs which result in incorrect handling of the UPDATE_DISCONNECTED option when
+#       using the URL download method or when specifying a SOURCE_DIR with no download
+#       method. Fixes for these have been created, the last of which is scheduled for
+#       inclusion in CMake 3.8.0. Details can be found here:
+#
+#           https://gitlab.kitware.com/cmake/cmake/commit/bdca68388bd57f8302d3c1d83d691034b7ffa70c
+#           https://gitlab.kitware.com/cmake/cmake/issues/16428
+#
+#       If you experience build errors related to the update step, consider avoiding
+#       the use of UPDATE_DISCONNECTED.
+#
+# EXAMPLE USAGE:
+#
+#   include(DownloadProject)
+#   download_project(PROJ                googletest
+#                    GIT_REPOSITORY      https://github.com/google/googletest.git
+#                    GIT_TAG             master
+#                    UPDATE_DISCONNECTED 1
+#                    QUIET
+#   )
+#
+#   add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
+#
+#========================================================================================
+
+
+set(_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}")
+
+include(CMakeParseArguments)
+
+function(download_project)
+
+    set(options QUIET)
+    set(oneValueArgs
+        PROJ
+        PREFIX
+        DOWNLOAD_DIR
+        SOURCE_DIR
+        BINARY_DIR
+        # Prevent the following from being passed through
+        CONFIGURE_COMMAND
+        BUILD_COMMAND
+        INSTALL_COMMAND
+        TEST_COMMAND
+    )
+    set(multiValueArgs "")
+
+    cmake_parse_arguments(DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+    # Hide output if requested
+    if (DL_ARGS_QUIET)
+        set(OUTPUT_QUIET "OUTPUT_QUIET")
+    else()
+        unset(OUTPUT_QUIET)
+        message(STATUS "Downloading/updating ${DL_ARGS_PROJ}")
+    endif()
+
+    # Set up where we will put our temporary CMakeLists.txt file and also
+    # the base point below which the default source and binary dirs will be.
+    # The prefix must always be an absolute path.
+    if (NOT DL_ARGS_PREFIX)
+        set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
+    else()
+        get_filename_component(DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE
+                               BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+    endif()
+    if (NOT DL_ARGS_DOWNLOAD_DIR)
+        set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
+    endif()
+
+    # Ensure the caller can know where to find the source and build directories
+    if (NOT DL_ARGS_SOURCE_DIR)
+        set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-src")
+    endif()
+    if (NOT DL_ARGS_BINARY_DIR)
+        set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-build")
+    endif()
+    set(${DL_ARGS_PROJ}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE)
+    set(${DL_ARGS_PROJ}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE)
+
+    # The way that CLion manages multiple configurations, it causes a copy of
+    # the CMakeCache.txt to be copied across due to it not expecting there to
+    # be a project within a project.  This causes the hard-coded paths in the
+    # cache to be copied and builds to fail.  To mitigate this, we simply
+    # remove the cache if it exists before we configure the new project.  It
+    # is safe to do so because it will be re-generated.  Since this is only
+    # executed at the configure step, it should not cause additional builds or
+    # downloads.
+    file(REMOVE "${DL_ARGS_DOWNLOAD_DIR}/CMakeCache.txt")
+
+    # Create and build a separate CMake project to carry out the download.
+    # If we've already previously done these steps, they will not cause
+    # anything to be updated, so extra rebuilds of the project won't occur.
+    # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
+    # has this set to something not findable on the PATH.
+    configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
+                   "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
+    execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
+                        -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}"
+                        .
+                    RESULT_VARIABLE result
+                    ${OUTPUT_QUIET}
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
+    )
+    if(result)
+        message(FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}")
+    endif()
+    execute_process(COMMAND ${CMAKE_COMMAND} --build .
+                    RESULT_VARIABLE result
+                    ${OUTPUT_QUIET}
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
+    )
+    if(result)
+        message(FATAL_ERROR "Build step for ${DL_ARGS_PROJ} failed: ${result}")
+    endif()
+
+endfunction()

+ 0 - 97
shared/cmake/FindCGAL.cmake

@@ -1,97 +0,0 @@
-#
-# The following module is based on FindVTK.cmake
-#
-
-# - Find a CGAL installation or binary tree.
-# The following variables are set if CGAL is found.  If CGAL is not
-# found, CGAL_FOUND is set to false.
-#
-#  CGAL_FOUND         - Set to true when CGAL is found.
-#  CGAL_USE_FILE      - CMake file to use CGAL.
-#
-
-# Construct consitent error messages for use below.
-set(CGAL_DIR_DESCRIPTION "directory containing CGALConfig.cmake. This is either the binary directory where CGAL was configured or PREFIX/lib/CGAL for an installation.")
-set(CGAL_DIR_MESSAGE     "CGAL not found.  Set the CGAL_DIR cmake variable or environment variable to the ${CGAL_DIR_DESCRIPTION}")
-
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
-
-if ( NOT CGAL_DIR )
-
-  # Get the system search path as a list.
-  if(UNIX)
-    string(REGEX MATCHALL "[^:]+" CGAL_DIR_SEARCH1 "$ENV{PATH}")
-  else()
-    string(REGEX REPLACE "\\\\" "/" CGAL_DIR_SEARCH1 "$ENV{PATH}")
-  endif()
-
-  string(REGEX REPLACE "/;" ";" CGAL_DIR_SEARCH2 "${CGAL_DIR_SEARCH1}")
-
-  # Construct a set of paths relative to the system search path.
-  set(CGAL_DIR_SEARCH "")
-
-  foreach(dir ${CGAL_DIR_SEARCH2})
-
-    set(CGAL_DIR_SEARCH ${CGAL_DIR_SEARCH} ${dir}/../lib/CGAL )
-
-  endforeach()
-
-
-  #
-  # Look for an installation or build tree.
-  #
-  find_path(CGAL_DIR CGALConfig.cmake
-    # Look for CGAL in 'external/' folder
-    "${CMAKE_CURRENT_LIST_DIR}/../../external/cgal/lib/CGAL"
-
-    # Look for an environment variable CGAL_DIR.
-    $ENV{CGAL_DIR}
-
-    # Look in places relative to the system executable search path.
-    ${CGAL_DIR_SEARCH}
-
-    # Look in standard UNIX install locations.
-    /usr/lib/x86_64-linux-gnu/cmake/CGAL
-    /opt/local/share/CGAL/cmake
-    /usr/local/lib/CGAL
-    /usr/lib/CGAL
-
-    # Read from the CMakeSetup registry entries.  It is likely that
-    # CGAL will have been recently built.
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
-    # Help the user find it if we cannot.
-    DOC "The ${CGAL_DIR_DESCRIPTION}"
-  )
-
-endif()
-
-if ( CGAL_DIR )
-
-  if ( EXISTS "${CGAL_DIR}/CGALConfig.cmake" )
-    include( "${CGAL_DIR}/CGALConfig.cmake" )
-    set( CGAL_FOUND TRUE )
-  endif()
-
-endif()
-
-if(CGAL_FOUND)
-  MESSAGE(STATUS "Found CGAL: ${CGAL_DIR}")
-else()
-  if(CGAL_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR ${CGAL_DIR_MESSAGE})
-  else()
-    if(NOT CGAL_FIND_QUIETLY)
-      MESSAGE(STATUS ${CGAL_DIR_MESSAGE})
-    endif()
-  endif()
-endif()

+ 62 - 41
shared/cmake/libigl.cmake

@@ -21,19 +21,14 @@ endif()
 ### Find packages to populate default options ###
 ### Find packages to populate default options ###
 #
 #
 # COMPONENTS should match subsequent calls
 # COMPONENTS should match subsequent calls
-find_package(CGAL COMPONENTS Core) # --> CGAL_FOUND
-find_package(Boost 1.48 COMPONENTS thread system) # --> BOOST_FOUND
-if(CGAL_FOUND AND BOOST_FOUND)
-  set(CGAL_AND_BOOST_FOUND TRUE)
-endif()
 find_package(Matlab COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY) # --> Matlab_FOUND
 find_package(Matlab COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY) # --> Matlab_FOUND
 find_package(MOSEK) # --> MOSEK_FOUND
 find_package(MOSEK) # --> MOSEK_FOUND
 find_package(OpenGL) # --> OPENGL_FOUND
 find_package(OpenGL) # --> OPENGL_FOUND
 
 
 ### Available options ###
 ### Available options ###
-option(LIBIGL_USE_STATIC_LIBRARY     "Use libigl as static library" OFF)
+option(LIBIGL_USE_STATIC_LIBRARY     "Use libigl as static library" ON)
 option(LIBIGL_WITH_ANTTWEAKBAR       "Use AntTweakBar"    OFF)
 option(LIBIGL_WITH_ANTTWEAKBAR       "Use AntTweakBar"    OFF)
-option(LIBIGL_WITH_CGAL              "Use CGAL"           "${CGAL_AND_BOOST_FOUND}")
+option(LIBIGL_WITH_CGAL              "Use CGAL"           ON)
 option(LIBIGL_WITH_COMISO            "Use CoMiso"         ON)
 option(LIBIGL_WITH_COMISO            "Use CoMiso"         ON)
 option(LIBIGL_WITH_CORK              "Use Cork"           OFF)
 option(LIBIGL_WITH_CORK              "Use Cork"           OFF)
 option(LIBIGL_WITH_EMBREE            "Use Embree"         OFF)
 option(LIBIGL_WITH_EMBREE            "Use Embree"         OFF)
@@ -86,9 +81,6 @@ target_compile_features(igl_common INTERFACE ${CXX11_FEATURES})
 if(MSVC)
 if(MSVC)
   # Enable parallel compilation for Visual Studio
   # Enable parallel compilation for Visual Studio
   target_compile_options(igl_common INTERFACE /MP /bigobj)
   target_compile_options(igl_common INTERFACE /MP /bigobj)
-  if(LIBIGL_WITH_CGAL)
-    target_compile_options(igl_common INTERFACE "/MD$<$<CONFIG:Debug>:d>")
-  endif()
 endif()
 endif()
 
 
 if(BUILD_SHARED_LIBS)
 if(BUILD_SHARED_LIBS)
@@ -110,6 +102,38 @@ target_link_libraries(igl_common INTERFACE ${CMAKE_THREAD_LIBS_INIT})
 
 
 ################################################################################
 ################################################################################
 
 
+include(DownloadProject)
+
+# Shortcut function
+function(igl_download_project name)
+  download_project(
+    PROJ         ${name}
+    SOURCE_DIR   ${LIBIGL_EXTERNAL}/${name}
+    DOWNLOAD_DIR ${LIBIGL_EXTERNAL}/.cache/${name}
+    ${ARGN}
+  )
+endfunction()
+
+################################################################################
+
+## CGAL dependencies on Windows: GMP & MPFR
+function(igl_download_cgal_deps)
+  if(WIN32)
+    igl_download_project(gmp
+        URL     https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/GMP/5.0.1/gmp-all-CGAL-3.9.zip
+        URL_MD5 508c1292319c832609329116a8234c9f
+    )
+    igl_download_project(mpfr
+        URL https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/MPFR/3.0.0/mpfr-all-CGAL-3.9.zip
+        URL_MD5 48840454eef0ff18730050c05028734b
+    )
+    set(ENV{GMP_DIR} "${LIBIGL_EXTERNAL}/gmp")
+    set(ENV{MPFR_DIR} "${LIBIGL_EXTERNAL}/mpfr")
+  endif()
+endfunction()
+
+################################################################################
+
 function(compile_igl_module module_dir)
 function(compile_igl_module module_dir)
   string(REPLACE "/" "_" module_name "${module_dir}")
   string(REPLACE "/" "_" module_name "${module_dir}")
   if(module_name STREQUAL "core")
   if(module_name STREQUAL "core")
@@ -161,26 +185,29 @@ if(LIBIGL_WITH_ANTTWEAKBAR)
   endif()
   endif()
   compile_igl_module("anttweakbar")
   compile_igl_module("anttweakbar")
   target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
   target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
+  target_include_directories(igl_anttweakbar ${IGL_SCOPE} "${ANTTWEAKBAR_DIR}/include")
 endif()
 endif()
 
 
 ################################################################################
 ################################################################################
-### Compile the cgal parts ###
+### Compile the CGAL part ###
 if(LIBIGL_WITH_CGAL)
 if(LIBIGL_WITH_CGAL)
+  # Try to find the CGAL library
   # CGAL Core is needed for
   # CGAL Core is needed for
   # `Exact_predicates_exact_constructions_kernel_with_sqrt`
   # `Exact_predicates_exact_constructions_kernel_with_sqrt`
-  if(EXISTS ${LIBIGL_EXTERNAL}/boost)
-    set(BOOST_ROOT "${LIBIGL_EXTERNAL}/boost")
+  if(NOT TARGET CGAL::CGAL)
+    set(CGAL_DIR "${LIBIGL_EXTERNAL}/cgal")
+    igl_download_cgal_deps()
+    if(EXISTS ${LIBIGL_EXTERNAL}/boost)
+      set(BOOST_ROOT "${LIBIGL_EXTERNAL}/boost")
+    endif()
+    set(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
+    find_package(CGAL CONFIG COMPONENTS Core PATHS ${CGAL_DIR} NO_DEFAULT_PATH)
   endif()
   endif()
-  find_package(CGAL COMPONENTS Core)
-  if(CGAL_FOUND)
+
+  # If CGAL has been found, then build the libigl module
+  if(TARGET CGAL::CGAL AND TARGET CGAL::CGAL_Core)
     compile_igl_module("cgal")
     compile_igl_module("cgal")
-    if(WIN32)
-      set(Boost_USE_STATIC_LIBS ON) # Favor static Boost libs on Windows
-    endif()
-    target_include_directories(igl_cgal ${IGL_SCOPE} "${GMP_INCLUDE_DIR}" "${MPFR_INCLUDE_DIR}")
-    find_package(Boost 1.48 REQUIRED thread system)
-    target_include_directories(igl_cgal ${IGL_SCOPE} ${CGAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
-    target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core ${Boost_LIBRARIES})
+    target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core)
   else()
   else()
     set(LIBIGL_WITH_CGAL OFF CACHE BOOL "" FORCE)
     set(LIBIGL_WITH_CGAL OFF CACHE BOOL "" FORCE)
   endif()
   endif()
@@ -188,19 +215,15 @@ endif()
 
 
 # Helper function for `igl_copy_cgal_dll()`
 # Helper function for `igl_copy_cgal_dll()`
 function(igl_copy_imported_dll src_target dst_target)
 function(igl_copy_imported_dll src_target dst_target)
-  get_target_property(configurations ${src_target} IMPORTED_CONFIGURATIONS)
-  foreach(config ${configurations})
-    get_target_property(main_lib ${src_target} IMPORTED_LOCATION_${config})
-    get_target_property(other_libs ${src_target} IMPORTED_LINK_INTERFACE_LIBRARIES_${config})
-    set(locations)
-    list(APPEND locations ${main_lib} ${other_libs})
-    foreach(location ${locations})
-      string(REGEX MATCH "^(.*)\\.[^.]*$" dummy ${location})
-      set(location "${CMAKE_MATCH_1}.dll")
-      if(EXISTS "${location}" AND location MATCHES "^.*\\.dll$")
-        add_custom_command(TARGET ${dst_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${location}" $<TARGET_FILE_DIR:${dst_target}>)
-      endif()
-    endforeach()
+  get_target_property(other_libs ${src_target} INTERFACE_LINK_LIBRARIES)
+  set(locations)
+  list(APPEND locations ${main_lib} ${other_libs})
+  foreach(location ${locations})
+    string(REGEX MATCH "^(.*)\\.[^.]*$" dummy ${location})
+    set(location "${CMAKE_MATCH_1}.dll")
+    if(EXISTS "${location}" AND location MATCHES "^.*\\.dll$")
+      add_custom_command(TARGET ${dst_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${location}" $<TARGET_FILE_DIR:${dst_target}>)
+    endif()
   endforeach()
   endforeach()
 endfunction()
 endfunction()
 
 
@@ -213,7 +236,7 @@ function(igl_copy_cgal_dll target)
 endfunction()
 endfunction()
 
 
 ################################################################################
 ################################################################################
-# Compile CoMISo
+### Compile the CoMISo part ###
 # NOTE: this cmakefile works only with the
 # NOTE: this cmakefile works only with the
 # comiso available here: https://github.com/libigl/CoMISo
 # comiso available here: https://github.com/libigl/CoMISo
 if(LIBIGL_WITH_COMISO)
 if(LIBIGL_WITH_COMISO)
@@ -225,7 +248,7 @@ if(LIBIGL_WITH_COMISO)
 endif()
 endif()
 
 
 ################################################################################
 ################################################################################
-### Compile the cork parts ###
+### Compile the cork part ###
 if(LIBIGL_WITH_CORK)
 if(LIBIGL_WITH_CORK)
   set(CORK_DIR "${LIBIGL_EXTERNAL}/cork")
   set(CORK_DIR "${LIBIGL_EXTERNAL}/cork")
   if(NOT TARGET cork)
   if(NOT TARGET cork)
@@ -248,6 +271,7 @@ if(LIBIGL_WITH_EMBREE)
   set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
   set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
   set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
   set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
   set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
   set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
+  set(BUILD_TESTING OFF CACHE BOOL " " FORCE)
 
 
   # set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
   # set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
   if(MSVC)
   if(MSVC)
@@ -309,8 +333,7 @@ if(LIBIGL_WITH_MOSEK)
 endif()
 endif()
 
 
 ################################################################################
 ################################################################################
-### Compile the opengl parts ###
-
+### Compile the opengl part ###
 if(LIBIGL_WITH_OPENGL)
 if(LIBIGL_WITH_OPENGL)
   # OpenGL module
   # OpenGL module
   find_package(OpenGL REQUIRED)
   find_package(OpenGL REQUIRED)
@@ -327,7 +350,6 @@ endif()
 
 
 ################################################################################
 ################################################################################
 ### Compile the GLFW part ###
 ### Compile the GLFW part ###
-
 if(LIBIGL_WITH_OPENGL_GLFW)
 if(LIBIGL_WITH_OPENGL_GLFW)
   if(TARGET igl::opengl)
   if(TARGET igl::opengl)
     # GLFW module
     # GLFW module
@@ -345,7 +367,6 @@ endif()
 
 
 ################################################################################
 ################################################################################
 ### Compile the ImGui part ###
 ### Compile the ImGui part ###
-
 if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
 if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
   if(TARGET igl::opengl_glfw)
   if(TARGET igl::opengl_glfw)
     # ImGui module
     # ImGui module