فهرست منبع

un-template CSGTree, fix tutorial paths

Former-commit-id: ee4ca9cc4799e05d6afb6d4e4a7f09f335ce8e96
Alec Jacobson 9 سال پیش
والد
کامیت
3702f3d4ef
2فایلهای تغییر یافته به همراه15 افزوده شده و 11 حذف شده
  1. 9 4
      include/igl/boolean/CSGTree.h
  2. 6 7
      tutorial/610_CSGTree/main.cpp

+ 9 - 4
include/igl/boolean/CSGTree.h

@@ -21,15 +21,16 @@ namespace igl
     // Class for defining and computing a constructive solid geometry result
     // out of a tree of boolean operations on "solid" triangle meshes.
     //
-    template <typename DerivedF>
+    //template <typename DerivedF>
     class CSGTree
     {
       private:
         typedef CGAL::Epeck::FT ExactScalar;
         typedef Eigen::Matrix<ExactScalar,Eigen::Dynamic,3> MatrixX3E;
-        typedef Eigen::PlainObjectBase<DerivedF> POBF;
-        typedef Eigen::Matrix<typename DerivedF::Index,Eigen::Dynamic,1> 
-          VectorJ;
+        //typedef Eigen::PlainObjectBase<DerivedF> POBF;
+        typedef Eigen::MatrixXi POBF;
+        typedef POBF::Index FIndex;
+        typedef Eigen::Matrix<FIndex,Eigen::Dynamic,1> VectorJ;
         // Resulting mesh
         MatrixX3E m_V;
         POBF m_F;
@@ -48,6 +49,8 @@ namespace igl
           :
           // copy things
           m_V(other.m_V),
+          // This is an issue if m_F is templated
+          // https://forum.kde.org/viewtopic.php?f=74&t=128414
           m_F(other.m_F),
           m_J(other.m_J),
           m_number_of_birth_faces(other.m_number_of_birth_faces)
@@ -59,6 +62,8 @@ namespace igl
           using std::swap;
           // swap things
           swap(first.m_V,second.m_V);
+          // This is an issue if m_F is templated, similar to
+          // https://forum.kde.org/viewtopic.php?f=74&t=128414
           swap(first.m_F,second.m_F);
           swap(first.m_J,second.m_J);
           swap(first.m_number_of_birth_faces,second.m_number_of_birth_faces);

+ 6 - 7
tutorial/610_CSGTree/main.cpp

@@ -13,11 +13,11 @@ int main(int argc, char * argv[])
   MatrixXi FA,FB,FC,FD,FE;
   MatrixXd VA,VB,VC,VD,VE;
   // Read in inputs as double precision floating point meshes
-  read_triangle_mesh(     "cube.obj",VA,FA);
-  read_triangle_mesh(   "sphere.obj",VB,FB);
-  read_triangle_mesh("xcylinder.obj",VC,FC);
-  read_triangle_mesh("ycylinder.obj",VD,FD);
-  read_triangle_mesh("zcylinder.obj",VE,FE);
+  read_triangle_mesh("../shared/cube.obj"     ,VA,FA);
+  read_triangle_mesh("../shared/sphere.obj"   ,VB,FB);
+  read_triangle_mesh("../shared/xcylinder.obj",VC,FC);
+  read_triangle_mesh("../shared/ycylinder.obj",VD,FD);
+  read_triangle_mesh("../shared/zcylinder.obj",VE,FE);
   igl::viewer::Viewer viewer;
 
   int num_views = 5+4;
@@ -26,7 +26,6 @@ int main(int argc, char * argv[])
   {
     viewer.data.clear();
     // CSGTree templated on type of F
-    typedef CSGTree<MatrixXi> CSGTreei;
     VectorXd I;
     const auto & set_mesh = 
       [&](const MatrixXd & V, const MatrixXi & F, const int i)
@@ -53,7 +52,7 @@ int main(int argc, char * argv[])
         break;
       default:
       {
-        CSGTreei M;
+        CSGTree M;
         Matrix<long int,Dynamic,1> J;
         switch(view_id)
         {