Browse Source

mv tetgen to copyleft

Former-commit-id: 90dcc6fe35421c6558721a5efb9cb076b626a4d6
Alec Jacobson 9 years ago
parent
commit
cc6d477eee

+ 0 - 0
include/igl/tetgen/README → include/igl/copyleft/tetgen/README


+ 3 - 3
include/igl/tetgen/cdt.cpp → include/igl/copyleft/tetgen/cdt.cpp

@@ -6,8 +6,8 @@
 // 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 "cdt.h"
-#include "../bounding_box.h"
-#include "../writeOBJ.h"
+#include "../../bounding_box.h"
+#include "../../writeOBJ.h"
 
 template <
   typename DerivedV, 
@@ -15,7 +15,7 @@ template <
   typename DerivedTV, 
   typename DerivedTT, 
   typename DerivedTF>
-IGL_INLINE bool igl::tetgen::cdt(
+IGL_INLINE bool igl::copyleft::tetgen::cdt(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const CDTParam & param,

+ 72 - 0
include/igl/copyleft/tetgen/cdt.h

@@ -0,0 +1,72 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_CDT_H
+#define IGL_COPYLEFT_TETGEN_CDT_H
+#include "../../igl_inline.h"
+
+#include <Eigen/Core>
+#include <string>
+#ifndef TETLIBRARY
+#  define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      struct CDTParam
+      {
+        // Tetgen can compute mesh of convex hull of input (i.e. "c") but often
+        // chokes. One workaround is to force it to mesh the entire bounding box.
+        // {false}
+        bool use_bounding_box = false;
+        // Scale the bounding box a bit so that vertices near it do not give tetgen
+        // problems. {1.01}
+        double bounding_box_scale = 1.01;
+        // Flags to tetgen. Do not include the "c" flag here! {"Y"}
+        std::string flags = "Y";
+      };
+      // Create a constrained delaunay tesselation containing convex hull of the
+      // given **non-selfintersecting** mesh.
+      //
+      // Inputs:
+      //    V  #V by 3 list of input mesh vertices
+      //    F  #F by 3 list of input mesh facets
+      //    param  see above
+      //    TV  #TV by 3 list of output mesh vertices (V come first)
+      //    TT  #TT by 3 list of tetrahedra indices into TV.
+      //    TF  #TF by 3 list of facets from F potentially subdivided.
+      // 
+      template <
+        typename DerivedV, 
+        typename DerivedF, 
+        typename DerivedTV, 
+        typename DerivedTT, 
+        typename DerivedTF>
+      IGL_INLINE bool cdt(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const CDTParam & param,
+        Eigen::PlainObjectBase<DerivedTV>& TV,
+        Eigen::PlainObjectBase<DerivedTT>& TT,
+        Eigen::PlainObjectBase<DerivedTF>& TF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "cdt.cpp"
+#endif
+
+#endif
+
+

+ 4 - 4
include/igl/tetgen/mesh_to_tetgenio.cpp → include/igl/copyleft/tetgen/mesh_to_tetgenio.cpp

@@ -8,12 +8,12 @@
 #include "mesh_to_tetgenio.h"
 
 // IGL includes 
-#include <igl/matrix_to_list.h>
+#include "../../matrix_to_list.h"
 
 // STL includes
 #include <cassert>
 
-IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_to_tetgenio(
   const std::vector<std::vector<REAL > > & V, 
   const std::vector<std::vector<int> > & F, 
   tetgenio & in)
@@ -59,7 +59,7 @@ IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
 }
 
 template <typename DerivedV, typename DerivedF>
-IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_to_tetgenio(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   tetgenio & in)
@@ -75,5 +75,5 @@ IGL_INLINE bool igl::tetgen::mesh_to_tetgenio(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::tetgen::mesh_to_tetgenio<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&, tetgenio&);
+template bool igl::copyleft::tetgen::mesh_to_tetgenio<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&, tetgenio&);
 #endif

+ 55 - 0
include/igl/copyleft/tetgen/mesh_to_tetgenio.h

@@ -0,0 +1,55 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_MESH_TO_TETGENIO_H
+#define IGL_COPYLEFT_TETGEN_MESH_TO_TETGENIO_H
+#include "../../igl_inline.h"
+
+#ifndef TETLIBRARY
+#  define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+#include <vector>
+#include <Eigen/Core>
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Load a vertex list and face list into a tetgenio object
+      // Inputs:
+      //   V  #V by 3 vertex position list
+      //   F  #F list of polygon face indices into V (0-indexed)
+      // Outputs:
+      //   in  tetgenio input object
+      // Returns true on success, false on error
+      IGL_INLINE bool mesh_to_tetgenio(
+        const std::vector<std::vector<REAL > > & V, 
+        const std::vector<std::vector<int> > & F, 
+        tetgenio & in);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedF  integer-value: i.e. from MatrixXi
+      template <typename DerivedV, typename DerivedF>
+      IGL_INLINE bool mesh_to_tetgenio(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        tetgenio & in);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "mesh_to_tetgenio.cpp"
+#endif
+
+#endif

+ 7 - 7
include/igl/tetgen/mesh_with_skeleton.cpp → include/igl/copyleft/tetgen/mesh_with_skeleton.cpp

@@ -6,19 +6,19 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "mesh_with_skeleton.h"
+#include "tetrahedralize.h"
 
-#include <igl/sample_edges.h>
-#include <igl/cat.h>
-#include <igl/tetgen/tetrahedralize.h>
-#include <igl/writeOFF.h>
-#include <igl/writeOBJ.h>
+#include "../../sample_edges.h"
+#include "../../cat.h"
+#include "../../writeOFF.h"
+#include "../../writeOBJ.h"
 
 #include <iostream>
 // Default settings pq2Y tell tetgen to mesh interior of triangle mesh and
 // to produce a graded tet mesh
 const static std::string DEFAULT_TETGEN_FLAGS = "pq2Y";
 
-IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXd & C,
@@ -85,7 +85,7 @@ IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
   return true;
 }
 
-IGL_INLINE bool igl::tetgen::mesh_with_skeleton(
+IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXd & C,

+ 72 - 0
include/igl/copyleft/tetgen/mesh_with_skeleton.h

@@ -0,0 +1,72 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_MESH_WITH_SKELETON_H
+#define IGL_COPYLEFT_TETGEN_MESH_WITH_SKELETON_H
+#include "../../igl_inline.h"
+#include <Eigen/Dense>
+#include <string>
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Mesh the interior of a given surface with tetrahedra which are graded
+      // (tend to be small near the surface and large inside) and conform to the
+      // given handles and samplings thereof.
+      //
+      // Inputs:
+      //  V  #V by 3 list of mesh vertex positions
+      //  F  #F by 3 list of triangle indices
+      //  C  #C by 3 list of vertex positions
+      //  P  #P list of point handle indices
+      //  BE #BE by 2 list of bone-edge indices
+      //  CE #CE by 2 list of cage-edge indices
+      //  samples_per_bone  #samples to add per bone
+      //  tetgen_flags  flags to pass to tetgen {""-->"pq2Y"} otherwise you're on
+      //    your own and it's your funeral if you pass nonsense flags
+      // Outputs:
+      //  VV  #VV by 3 list of tet-mesh vertex positions
+      //  TT  #TT by 4 list of tetrahedra indices
+      //  FF  #FF by 3 list of surface triangle indices
+      // Returns true only on success
+      IGL_INLINE bool mesh_with_skeleton(
+        const Eigen::MatrixXd & V,
+        const Eigen::MatrixXi & F,
+        const Eigen::MatrixXd & C,
+        const Eigen::VectorXi & /*P*/,
+        const Eigen::MatrixXi & BE,
+        const Eigen::MatrixXi & CE,
+        const int samples_per_bone,
+        const std::string & tetgen_flags,
+        Eigen::MatrixXd & VV,
+        Eigen::MatrixXi & TT,
+        Eigen::MatrixXi & FF);
+      // Wrapper using default tetgen_flags
+      IGL_INLINE bool mesh_with_skeleton(
+        const Eigen::MatrixXd & V,
+        const Eigen::MatrixXi & F,
+        const Eigen::MatrixXd & C,
+        const Eigen::VectorXi & /*P*/,
+        const Eigen::MatrixXi & BE,
+        const Eigen::MatrixXi & CE,
+        const int samples_per_bone,
+        Eigen::MatrixXd & VV,
+        Eigen::MatrixXi & TT,
+        Eigen::MatrixXi & FF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "mesh_with_skeleton.cpp"
+#endif
+
+#endif

+ 3 - 3
include/igl/tetgen/read_into_tetgenio.cpp → include/igl/copyleft/tetgen/read_into_tetgenio.cpp

@@ -9,13 +9,13 @@
 #include "mesh_to_tetgenio.h"
 
 // IGL includes
-#include <igl/pathinfo.h>
+#include "../../pathinfo.h"
 #ifndef IGL_NO_EIGEN
 #  define IGL_NO_EIGEN_WAS_NOT_ALREADY_DEFINED
 #  define IGL_NO_EIGEN
 #endif 
 // Include igl headers without including Eigen
-#include <igl/readOBJ.h>
+#include "../../readOBJ.h"
 #ifdef IGL_NO_EIGEN_WAS_NOT_ALREADY_DEFINED
 #  undef IGL_NO_EIGEN
 #endif
@@ -25,7 +25,7 @@
 #include <iostream>
 #include <vector>
 
-IGL_INLINE bool igl::tetgen::read_into_tetgenio(
+IGL_INLINE bool igl::copyleft::tetgen::read_into_tetgenio(
   const std::string & path,
   tetgenio & in)
 {

+ 62 - 0
include/igl/copyleft/tetgen/read_into_tetgenio.h

@@ -0,0 +1,62 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
+#define IGL_COPYLEFT_TETGEN_READ_INTO_TETGENIO_H
+#include "../../igl_inline.h"
+
+#include <string>
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Read a mesh or point set into tetgenio (input object for calling
+      // tetgen).  Many file formats are already supported by tetgen:
+      //   .off
+      //   .ply
+      //   .node
+      //   .ply
+      //   .medit
+      //   .vtk
+      //   etc.
+      // Noteably it does not support .obj which is loaded by hand here (also
+      // demonstrating how to load points/faces programatically)
+      //
+      // If the file extension is not recognized the filename is assumed to be
+      // the basename of a collection describe a tetmesh, (of which at least
+      // the .node file must exist):
+      //   [filename].node
+      //   [filename].ele
+      //   [filename].face
+      //   [filename].edge
+      //   [filename].vol
+      //
+      // Inputs:
+      //   path  path to file or basename to files
+      // Outputs:
+      //   in  tetgenio input object
+      // Returns true on success, false on error
+      IGL_INLINE bool read_into_tetgenio(
+        const std::string & path, 
+        tetgenio & in);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "read_into_tetgenio.cpp"
+#endif
+
+#endif

+ 6 - 6
include/igl/tetgen/tetgenio_to_tetmesh.cpp → include/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp

@@ -8,12 +8,12 @@
 #include "tetgenio_to_tetmesh.h"
 
 // IGL includes
-#include <igl/list_to_matrix.h>
+#include "../../list_to_matrix.h"
 
 // STL includes
 #include <iostream>
 
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   std::vector<std::vector<REAL > > & V, 
   std::vector<std::vector<int> > & T,
@@ -84,7 +84,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
   return true;
 }
 
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   std::vector<std::vector<REAL > > & V, 
   std::vector<std::vector<int> > & T)
@@ -94,7 +94,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 }
 
 template <typename DerivedV, typename DerivedT, typename DerivedF>
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   Eigen::PlainObjectBase<DerivedV>& V,
   Eigen::PlainObjectBase<DerivedT>& T,
@@ -125,7 +125,7 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 }
 
 template <typename DerivedV, typename DerivedT>
-IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
+IGL_INLINE bool igl::copyleft::tetgen::tetgenio_to_tetmesh(
   const tetgenio & out,
   Eigen::PlainObjectBase<DerivedV>& V,
   Eigen::PlainObjectBase<DerivedT>& T)
@@ -136,5 +136,5 @@ IGL_INLINE bool igl::tetgen::tetgenio_to_tetmesh(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template bool igl::tetgen::tetgenio_to_tetmesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(tetgenio 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::tetgen::tetgenio_to_tetmesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(tetgenio const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 66 - 0
include/igl/copyleft/tetgen/tetgenio_to_tetmesh.h

@@ -0,0 +1,66 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_TETGENIO_TO_TETMESH_H
+#define IGL_COPYLEFT_TETGEN_TETGENIO_TO_TETMESH_H
+#include "../../igl_inline.h"
+
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined tetgenio, REAL
+#include <vector>
+#include <Eigen/Core>
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Extract a tetrahedral mesh from a tetgenio object
+      // Inputs:
+      //   out tetgenio output object
+      // Outputs:
+      //   V  #V by 3 vertex position list
+      //   T  #T by 4 list of tetrahedra indices into V
+      //   F  #F by 3 list of marked facets
+      // Returns true on success, false on error
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        std::vector<std::vector<REAL > > & V, 
+        std::vector<std::vector<int> > & T,
+        std::vector<std::vector<int> > & F);
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        std::vector<std::vector<REAL > > & V, 
+        std::vector<std::vector<int> > & T);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedT  integer-value: i.e. from MatrixXi
+      template <typename DerivedV, typename DerivedT, typename DerivedF>
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        Eigen::PlainObjectBase<DerivedV>& V,
+        Eigen::PlainObjectBase<DerivedT>& T,
+        Eigen::PlainObjectBase<DerivedF>& F);
+      template <typename DerivedV, typename DerivedT>
+      IGL_INLINE bool tetgenio_to_tetmesh(
+        const tetgenio & out,
+        Eigen::PlainObjectBase<DerivedV>& V,
+        Eigen::PlainObjectBase<DerivedT>& T);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "tetgenio_to_tetmesh.cpp"
+#endif
+
+#endif

+ 6 - 6
include/igl/tetgen/tetrahedralize.cpp → include/igl/copyleft/tetgen/tetrahedralize.cpp

@@ -10,15 +10,15 @@
 #include "tetgenio_to_tetmesh.h"
 
 // IGL includes 
-#include <igl/matrix_to_list.h>
-#include <igl/list_to_matrix.h>
-#include <igl/boundary_facets.h>
+#include "../../matrix_to_list.h"
+#include "../../list_to_matrix.h"
+#include "../../boundary_facets.h"
 
 // STL includes
 #include <cassert>
 #include <iostream>
 
-IGL_INLINE int igl::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::string switches,
@@ -65,7 +65,7 @@ template <
   typename DerivedTV, 
   typename DerivedTT, 
   typename DerivedTF>
-IGL_INLINE int igl::tetgen::tetrahedralize(
+IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F,
   const std::string switches,
@@ -103,5 +103,5 @@ IGL_INLINE int igl::tetgen::tetrahedralize(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template int igl::tetgen::tetrahedralize<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&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 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 int igl::copyleft::tetgen::tetrahedralize<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&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 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> >&);
 #endif

+ 80 - 0
include/igl/copyleft/tetgen/tetrahedralize.h

@@ -0,0 +1,80 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+// 
+// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// 
+// This Source Code Form is subject to the terms of the Mozilla Public License 
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
+#define IGL_COPYLEFT_TETGEN_TETRAHEDRALIZE_H
+#include "../../igl_inline.h"
+
+#include <vector>
+#include <string>
+#include <Eigen/Core>
+#ifndef TETLIBRARY
+#define TETLIBRARY 
+#endif
+#include "tetgen.h" // Defined REAL
+
+namespace igl
+{
+  namespace copyleft
+  {
+    namespace tetgen
+    {
+      // Mesh the interior of a surface mesh (V,F) using tetgen
+      //
+      // Inputs:
+      //   V  #V by 3 vertex position list
+      //   F  #F list of polygon face indices into V (0-indexed)
+      //   switches  string of tetgen options (See tetgen documentation) e.g.
+      //     "pq1.414a0.01" tries to mesh the interior of a given surface with
+      //       quality and area constraints
+      //     "" will mesh the convex hull constrained to pass through V (ignores F)
+      // Outputs:
+      //   TV  #V by 3 vertex position list
+      //   TT  #T by 4 list of tet face indices
+      //   TF  #F by 3 list of triangle face indices
+      // Returns status:
+      //   0 success
+      //   1 tetgen threw exception
+      //   2 tetgen did not crash but could not create any tets (probably there are
+      //     holes, duplicate faces etc.)
+      //   -1 other error
+      IGL_INLINE int tetrahedralize(
+        const std::vector<std::vector<REAL > > & V, 
+        const std::vector<std::vector<int> > & F, 
+        const std::string switches,
+        std::vector<std::vector<REAL > > & TV, 
+        std::vector<std::vector<int > > & TT, 
+        std::vector<std::vector<int> > & TF);
+      
+      // Wrapper with Eigen types
+      // Templates:
+      //   DerivedV  real-value: i.e. from MatrixXd
+      //   DerivedF  integer-value: i.e. from MatrixXi
+      template <
+        typename DerivedV, 
+        typename DerivedF, 
+        typename DerivedTV, 
+        typename DerivedTT, 
+        typename DerivedTF>
+      IGL_INLINE int tetrahedralize(
+        const Eigen::PlainObjectBase<DerivedV>& V,
+        const Eigen::PlainObjectBase<DerivedF>& F,
+        const std::string switches,
+        Eigen::PlainObjectBase<DerivedTV>& TV,
+        Eigen::PlainObjectBase<DerivedTT>& TT,
+        Eigen::PlainObjectBase<DerivedTF>& TF);
+    }
+  }
+}
+
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "tetrahedralize.cpp"
+#endif
+
+#endif
+

+ 0 - 69
include/igl/tetgen/cdt.h

@@ -1,69 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_CDT_H
-#define IGL_TETGEN_CDT_H
-#include "../igl_inline.h"
-
-#include <Eigen/Core>
-#include <string>
-#ifndef TETLIBRARY
-#  define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    struct CDTParam
-    {
-      // Tetgen can compute mesh of convex hull of input (i.e. "c") but often
-      // chokes. One workaround is to force it to mesh the entire bounding box.
-      // {false}
-      bool use_bounding_box = false;
-      // Scale the bounding box a bit so that vertices near it do not give tetgen
-      // problems. {1.01}
-      double bounding_box_scale = 1.01;
-      // Flags to tetgen. Do not include the "c" flag here! {"Y"}
-      std::string flags = "Y";
-    };
-    // Create a constrained delaunay tesselation containing convex hull of the
-    // given **non-selfintersecting** mesh.
-    //
-    // Inputs:
-    //    V  #V by 3 list of input mesh vertices
-    //    F  #F by 3 list of input mesh facets
-    //    param  see above
-    //    TV  #TV by 3 list of output mesh vertices (V come first)
-    //    TT  #TT by 3 list of tetrahedra indices into TV.
-    //    TF  #TF by 3 list of facets from F potentially subdivided.
-    // 
-    template <
-      typename DerivedV, 
-      typename DerivedF, 
-      typename DerivedTV, 
-      typename DerivedTT, 
-      typename DerivedTF>
-    IGL_INLINE bool cdt(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      const CDTParam & param,
-      Eigen::PlainObjectBase<DerivedTV>& TV,
-      Eigen::PlainObjectBase<DerivedTT>& TT,
-      Eigen::PlainObjectBase<DerivedTF>& TF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "cdt.cpp"
-#endif
-
-#endif
-
-

+ 0 - 52
include/igl/tetgen/mesh_to_tetgenio.h

@@ -1,52 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_MESH_TO_TETGENIO_H
-#define IGL_TETGEN_MESH_TO_TETGENIO_H
-#include "../igl_inline.h"
-
-#ifndef TETLIBRARY
-#  define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-#include <vector>
-#include <Eigen/Core>
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Load a vertex list and face list into a tetgenio object
-    // Inputs:
-    //   V  #V by 3 vertex position list
-    //   F  #F list of polygon face indices into V (0-indexed)
-    // Outputs:
-    //   in  tetgenio input object
-    // Returns true on success, false on error
-    IGL_INLINE bool mesh_to_tetgenio(
-      const std::vector<std::vector<REAL > > & V, 
-      const std::vector<std::vector<int> > & F, 
-      tetgenio & in);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedF  integer-value: i.e. from MatrixXi
-    template <typename DerivedV, typename DerivedF>
-    IGL_INLINE bool mesh_to_tetgenio(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      tetgenio & in);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "mesh_to_tetgenio.cpp"
-#endif
-
-#endif

+ 0 - 69
include/igl/tetgen/mesh_with_skeleton.h

@@ -1,69 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_MESH_WITH_SKELETON_H
-#define IGL_TETGEN_MESH_WITH_SKELETON_H
-#include "../igl_inline.h"
-#include <Eigen/Dense>
-#include <string>
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Mesh the interior of a given surface with tetrahedra which are graded
-    // (tend to be small near the surface and large inside) and conform to the
-    // given handles and samplings thereof.
-    //
-    // Inputs:
-    //  V  #V by 3 list of mesh vertex positions
-    //  F  #F by 3 list of triangle indices
-    //  C  #C by 3 list of vertex positions
-    //  P  #P list of point handle indices
-    //  BE #BE by 2 list of bone-edge indices
-    //  CE #CE by 2 list of cage-edge indices
-    //  samples_per_bone  #samples to add per bone
-    //  tetgen_flags  flags to pass to tetgen {""-->"pq2Y"} otherwise you're on
-    //    your own and it's your funeral if you pass nonsense flags
-    // Outputs:
-    //  VV  #VV by 3 list of tet-mesh vertex positions
-    //  TT  #TT by 4 list of tetrahedra indices
-    //  FF  #FF by 3 list of surface triangle indices
-    // Returns true only on success
-    IGL_INLINE bool mesh_with_skeleton(
-      const Eigen::MatrixXd & V,
-      const Eigen::MatrixXi & F,
-      const Eigen::MatrixXd & C,
-      const Eigen::VectorXi & /*P*/,
-      const Eigen::MatrixXi & BE,
-      const Eigen::MatrixXi & CE,
-      const int samples_per_bone,
-      const std::string & tetgen_flags,
-      Eigen::MatrixXd & VV,
-      Eigen::MatrixXi & TT,
-      Eigen::MatrixXi & FF);
-    // Wrapper using default tetgen_flags
-    IGL_INLINE bool mesh_with_skeleton(
-      const Eigen::MatrixXd & V,
-      const Eigen::MatrixXi & F,
-      const Eigen::MatrixXd & C,
-      const Eigen::VectorXi & /*P*/,
-      const Eigen::MatrixXi & BE,
-      const Eigen::MatrixXi & CE,
-      const int samples_per_bone,
-      Eigen::MatrixXd & VV,
-      Eigen::MatrixXi & TT,
-      Eigen::MatrixXi & FF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "mesh_with_skeleton.cpp"
-#endif
-
-#endif

+ 0 - 57
include/igl/tetgen/read_into_tetgenio.h

@@ -1,57 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_READ_INTO_TETGENIO_H
-#define IGL_TETGEN_READ_INTO_TETGENIO_H
-#include "../igl_inline.h"
-
-#include <string>
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Read a mesh or point set into tetgenio (input object for calling tetgen).
-    // Many file formats are already supported by tetgen:
-    //   .off
-    //   .ply
-    //   .node
-    //   .ply
-    //   .medit
-    //   .vtk
-    //   etc.
-    // Noteably it does not support .obj which is loaded by hand here (also
-    // demonstrating how to load points/faces programatically)
-    //
-    // If the file extension is not recognized the filename is assumed to be the
-    // basename of a collection describe a tetmesh, (of which at least the .node
-    // file must exist):
-    //   [filename].node
-    //   [filename].ele
-    //   [filename].face
-    //   [filename].edge
-    //   [filename].vol
-    //
-    // Inputs:
-    //   path  path to file or basename to files
-    // Outputs:
-    //   in  tetgenio input object
-    // Returns true on success, false on error
-    IGL_INLINE bool read_into_tetgenio(const std::string & path, tetgenio & in);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "read_into_tetgenio.cpp"
-#endif
-
-#endif

+ 0 - 63
include/igl/tetgen/tetgenio_to_tetmesh.h

@@ -1,63 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_TETGENIO_TO_TETMESH_H
-#define IGL_TETGEN_TETGENIO_TO_TETMESH_H
-#include "../igl_inline.h"
-
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined tetgenio, REAL
-#include <vector>
-#include <Eigen/Core>
-namespace igl
-{
-  namespace tetgen
-  {
-    // Extract a tetrahedral mesh from a tetgenio object
-    // Inputs:
-    //   out tetgenio output object
-    // Outputs:
-    //   V  #V by 3 vertex position list
-    //   T  #T by 4 list of tetrahedra indices into V
-    //   F  #F by 3 list of marked facets
-    // Returns true on success, false on error
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      std::vector<std::vector<REAL > > & V, 
-      std::vector<std::vector<int> > & T,
-      std::vector<std::vector<int> > & F);
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      std::vector<std::vector<REAL > > & V, 
-      std::vector<std::vector<int> > & T);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedT  integer-value: i.e. from MatrixXi
-    template <typename DerivedV, typename DerivedT, typename DerivedF>
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      Eigen::PlainObjectBase<DerivedV>& V,
-      Eigen::PlainObjectBase<DerivedT>& T,
-      Eigen::PlainObjectBase<DerivedF>& F);
-    template <typename DerivedV, typename DerivedT>
-    IGL_INLINE bool tetgenio_to_tetmesh(
-      const tetgenio & out,
-      Eigen::PlainObjectBase<DerivedV>& V,
-      Eigen::PlainObjectBase<DerivedT>& T);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "tetgenio_to_tetmesh.cpp"
-#endif
-
-#endif

+ 0 - 77
include/igl/tetgen/tetrahedralize.h

@@ -1,77 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TETGEN_TETRAHEDRALIZE_H
-#define IGL_TETGEN_TETRAHEDRALIZE_H
-#include "../igl_inline.h"
-
-#include <vector>
-#include <string>
-#include <Eigen/Core>
-#ifndef TETLIBRARY
-#define TETLIBRARY 
-#endif
-#include "tetgen.h" // Defined REAL
-
-namespace igl
-{
-  namespace tetgen
-  {
-    // Mesh the interior of a surface mesh (V,F) using tetgen
-    //
-    // Inputs:
-    //   V  #V by 3 vertex position list
-    //   F  #F list of polygon face indices into V (0-indexed)
-    //   switches  string of tetgen options (See tetgen documentation) e.g.
-    //     "pq1.414a0.01" tries to mesh the interior of a given surface with
-    //       quality and area constraints
-    //     "" will mesh the convex hull constrained to pass through V (ignores F)
-    // Outputs:
-    //   TV  #V by 3 vertex position list
-    //   TT  #T by 4 list of tet face indices
-    //   TF  #F by 3 list of triangle face indices
-    // Returns status:
-    //   0 success
-    //   1 tetgen threw exception
-    //   2 tetgen did not crash but could not create any tets (probably there are
-    //     holes, duplicate faces etc.)
-    //   -1 other error
-    IGL_INLINE int tetrahedralize(
-      const std::vector<std::vector<REAL > > & V, 
-      const std::vector<std::vector<int> > & F, 
-      const std::string switches,
-      std::vector<std::vector<REAL > > & TV, 
-      std::vector<std::vector<int > > & TT, 
-      std::vector<std::vector<int> > & TF);
-    
-    // Wrapper with Eigen types
-    // Templates:
-    //   DerivedV  real-value: i.e. from MatrixXd
-    //   DerivedF  integer-value: i.e. from MatrixXi
-    template <
-      typename DerivedV, 
-      typename DerivedF, 
-      typename DerivedTV, 
-      typename DerivedTT, 
-      typename DerivedTF>
-    IGL_INLINE int tetrahedralize(
-      const Eigen::PlainObjectBase<DerivedV>& V,
-      const Eigen::PlainObjectBase<DerivedF>& F,
-      const std::string switches,
-      Eigen::PlainObjectBase<DerivedTV>& TV,
-      Eigen::PlainObjectBase<DerivedTT>& TT,
-      Eigen::PlainObjectBase<DerivedTF>& TF);
-  }
-}
-
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "tetrahedralize.cpp"
-#endif
-
-#endif
-

+ 1 - 1
optional/CMakeLists.txt

@@ -283,7 +283,7 @@ 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/tetgen/*.cpp"
+    "${PROJECT_SOURCE_DIR}/../include/igl/copyleft/tetgen/*.cpp"
   )
 
   add_library(igltetgen STATIC ${SOURCES_TETGEN})

+ 2 - 2
tutorial/605_Tetgen/main.cpp

@@ -1,5 +1,5 @@
 #include <igl/viewer/Viewer.h>
-#include <igl/tetgen/tetrahedralize.h>
+#include <igl/copyleft/tetgen/tetrahedralize.h>
 #include <igl/readOFF.h>
 #include <igl/barycenter.h>
 
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
   igl::readOFF(TUTORIAL_SHARED_PATH "/fertility.off",V,F);
 
   // Tetrahedralize the interior
-  igl::tetgen::tetrahedralize(V,F,"pq1.414Y", TV,TT,TF);
+  igl::copyleft::tetgen::tetrahedralize(V,F,"pq1.414Y", TV,TT,TF);
 
   // Compute barycenters
   igl::barycenter(TV,TT,B);