Explorar o código

no message

Former-commit-id: 2d3b8d6409f48e4dab9cfa05442246fff7613901
Olga Diamanti %!s(int64=10) %!d(string=hai) anos
pai
achega
461e4ccb09

+ 1 - 0
build/Makefile.conf

@@ -113,6 +113,7 @@ endif
 ifeq ($(IGL_USERNAME),olkido)
     IGL_WITH_MATLAB=0
 		IGL_WITH_COMISO=1
+		IGL_WITH_XML=1
 		COMISO=/Users/olkido/Documents/igl/MIQ/src/CoMISo
 	  IGL_WITH_XML=1
     AFLAGS= -m64

+ 3 - 3
build/Makefile_xml

@@ -1,7 +1,7 @@
 include Makefile.conf
 
 .PHONY: all
-all: 
+all:
 debug:
 #all: libiglxml
 #debug: libiglxml
@@ -20,7 +20,7 @@ OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))
 # include igl headers
 INC+=-I../include/
 
-# EXPECTS THAT CFLAGS IS ALREADY SET APPROPRIATELY 
+# EXPECTS THAT CFLAGS IS ALREADY SET APPROPRIATELY
 
 # Eigen dependency
 EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
@@ -42,7 +42,7 @@ INC+=$(ANTTWEAKBAR_INC)
 
 #CFLAGS+=-std=c++11
 
-obj: 
+obj:
 	mkdir -p obj
 
 ../lib/libiglxml.a: $(OBJ_FILES)

+ 5 - 15
include/igl/cut_mesh_from_singularities.cpp

@@ -19,7 +19,6 @@ namespace igl {
   typename DerivedV,
   typename DerivedF,
   typename DerivedM,
-  typename DerivedS,
   typename DerivedO
   >
   class MeshCutter
@@ -27,8 +26,6 @@ namespace igl {
   protected:
     const Eigen::PlainObjectBase<DerivedV> &V;
     const Eigen::PlainObjectBase<DerivedF> &F;
-    const Eigen::PlainObjectBase<DerivedS> &Handle_Singular;
-    const Eigen::PlainObjectBase<DerivedS> &Handle_SingularDegree;
     const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch;
 
     Eigen::VectorXi F_visited;
@@ -128,14 +125,10 @@ namespace igl {
 
     inline MeshCutter(const Eigen::PlainObjectBase<DerivedV> &V_,
                const Eigen::PlainObjectBase<DerivedF> &F_,
-               const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch_,
-               const Eigen::PlainObjectBase<DerivedS> &Handle_Singular_,
-               const Eigen::PlainObjectBase<DerivedS> &Handle_SingularDegree_):
+               const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch_):
     V(V_),
     F(F_),
-    Handle_MMatch(Handle_MMatch_),
-    Handle_Singular(Handle_Singular_),
-    Handle_SingularDegree(Handle_SingularDegree_)
+    Handle_MMatch(Handle_MMatch_)
     {
       triangle_triangle_adjacency(V,F,TT,TTi);
     };
@@ -155,7 +148,7 @@ namespace igl {
         }
       }
 
-      Retract(Handle_Seams);
+      // Retract(Handle_Seams);
 
       for (unsigned int f=0;f<F.rows();f++)
         for (int j=0;j<3;j++)
@@ -172,20 +165,17 @@ namespace igl {
 template <typename DerivedV,
   typename DerivedF,
   typename DerivedM,
-  typename DerivedS,
   typename DerivedO>
 IGL_INLINE void igl::cut_mesh_from_singularities(const Eigen::PlainObjectBase<DerivedV> &V,
                                                  const Eigen::PlainObjectBase<DerivedF> &F,
                                                  const Eigen::PlainObjectBase<DerivedM> &Handle_MMatch,
-                                                 const Eigen::PlainObjectBase<DerivedS> &isSingularity,
-                                                 const Eigen::PlainObjectBase<DerivedS> &singularityIndex,
                                                  Eigen::PlainObjectBase<DerivedO> &Handle_Seams)
 {
-  igl::MeshCutter< DerivedV, DerivedF, DerivedM, DerivedS, DerivedO> mc(V, F, Handle_MMatch, isSingularity, singularityIndex);
+  igl::MeshCutter< DerivedV, DerivedF, DerivedM, DerivedO> mc(V, F, Handle_MMatch);
   mc.cut(Handle_Seams);
 
 }
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template void igl::cut_mesh_from_singularities<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
+template void igl::cut_mesh_from_singularities<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 1 - 8
include/igl/cut_mesh_from_singularities.h

@@ -20,19 +20,12 @@ namespace igl
   // V:                 #V by 3 list of mesh vertex positions
   // F:                 #F by 3 list of faces
   // MMatch:            #F by 3 list of per corner integer mismatch
-  // is_singularity:    #V by 1 list of booleans that denotes if a vertex is a singularity
-  // singularity_index: #V by 1 list of degree of the singularity
   // seams:             #F by 3 list of per corner booleans that denotes if an edge is a seam or not
   //
-  // TODO: remove is_singularity, it is redundant
-  //       make the name of the variables consistent in the cpp
-
-  template <typename DerivedV, typename DerivedF, typename DerivedM, typename DerivedS, typename DerivedO>
+  template <typename DerivedV, typename DerivedF, typename DerivedM, typename DerivedO>
   IGL_INLINE void cut_mesh_from_singularities(const Eigen::PlainObjectBase<DerivedV> &V,
                                                    const Eigen::PlainObjectBase<DerivedF> &F,
                                                    const Eigen::PlainObjectBase<DerivedM> &MMatch,
-                                                   const Eigen::PlainObjectBase<DerivedS> &is_singularity,
-                                                   const Eigen::PlainObjectBase<DerivedS> &singularity_index,
                                                    Eigen::PlainObjectBase<DerivedO> &seams);
 }
 #ifndef IGL_STATIC_LIBRARY

+ 8 - 2
include/igl/edge_topology.cpp

@@ -18,6 +18,13 @@ IGL_INLINE void igl::edge_topology(
                                    Eigen::MatrixXi& EF)
 {
   // Only needs to be edge-manifold
+  if (V.rows() ==0 || F.rows()==0)
+  {
+    EV = Eigen::MatrixXi::Constant(0,2,-1);
+    FE = Eigen::MatrixXi::Constant(0,3,-1);
+    EF = Eigen::MatrixXi::Constant(0,2,-1);
+    return;
+  }
   assert(igl::is_edge_manifold(V,F));
   std::vector<std::vector<int> > ETT;
   for(int f=0;f<F.rows();++f)
@@ -36,7 +43,7 @@ IGL_INLINE void igl::edge_topology(
 
   // count the number of edges (assume manifoldness)
   int En = 1; // the last is always counted
-  for(unsigned i=0;i<ETT.size()-1;++i)
+  for(int i=0;i<int(ETT.size())-1;++i)
     if (!((ETT[i][0] == ETT[i+1][0]) && (ETT[i][1] == ETT[i+1][1])))
       ++En;
 
@@ -75,7 +82,6 @@ IGL_INLINE void igl::edge_topology(
 
   // Sort the relation EF, accordingly to EV
   // the first one is the face on the left of the edge
-
   for(unsigned i=0; i<EF.rows(); ++i)
   {
     int fid = EF(i,0);

+ 6 - 5
include/igl/jet.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "jet.h"
 #include "colon.h"
@@ -81,7 +81,7 @@ IGL_INLINE void igl::jet(const T x_in, T & r, T & g, T & b)
   {
     r = 0;
     g = gone*(x-1./8.)/(3./8.-1./8.);
-    b = bone; 
+    b = bone;
   }else if(x<5./8.)
   {
     r = rone*(x-3./8.)/(5./8.-3./8.);
@@ -134,4 +134,5 @@ template void igl::jet<double>(double, double&, double&, double&);
 template void igl::jet<float>(float, float*);
 template void igl::jet<Eigen::Array<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Array<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::jet<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template void igl::jet<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 9 - 9
include/igl/rotation_matrix_from_directions.cpp

@@ -10,18 +10,18 @@
 #include <Eigen/Geometry>
 
 template <typename Scalar>
-IGL_INLINE Eigen::Matrix<Scalar, 3, 3> igl::rotation_matrix_from_directions(Eigen::Matrix<Scalar, 3, 1> v0,
-                                                                        Eigen::Matrix<Scalar, 3, 1> v1,
+IGL_INLINE Eigen::Matrix<Scalar, 3, 3> igl::rotation_matrix_from_directions(const Eigen::Matrix<Scalar, 3, 1> v0,
+                                                                        const Eigen::Matrix<Scalar, 3, 1> v1,
                                                                         bool normalized)
 {
   Eigen::Matrix<Scalar, 3, 3> rotM;
   const double epsilon=0.00001;
-  if (!normalized)
-  {
-    v0.normalize();
-    v1.normalize();
-  }
-  Scalar dot=v0.dot(v1);
+  // if (!normalized)
+  // {
+    // v0.normalize();
+    // v1.normalize();
+  // }
+  Scalar dot=v0.normalized().dot(v1.normalized());
   ///control if there is no rotation
   if (dot>((double)1-epsilon))
   {
@@ -57,5 +57,5 @@ IGL_INLINE Eigen::Matrix<Scalar, 3, 3> igl::rotation_matrix_from_directions(Eige
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
-template Eigen::Matrix<double, 3, 3, 0, 3, 3> igl::rotation_matrix_from_directions<double>(Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, bool);
+template Eigen::Matrix<double, 3, 3, 0, 3, 3> igl::rotation_matrix_from_directions<double>(const Eigen::Matrix<double, 3, 1, 0, 3, 1>, const Eigen::Matrix<double, 3, 1, 0, 3, 1>, const bool);
 #endif

+ 4 - 4
include/igl/rotation_matrix_from_directions.h

@@ -14,7 +14,7 @@
 
 namespace igl {
   /// Given 2 vectors centered on origin calculate the rotation matrix from first to the second
-  
+
   // Inputs:
   //   v0, v1         the two #3 by 1 vectors
   //   normalized     boolean, if false, then the vectors are normalized prior to the calculation
@@ -22,9 +22,9 @@ namespace igl {
   //                  3 by 3 rotation matrix that takes v0 to v1
   //
   template <typename Scalar>
-  IGL_INLINE Eigen::Matrix<Scalar, 3, 3> rotation_matrix_from_directions(Eigen::Matrix<Scalar, 3, 1> v0,
-                                                                     Eigen::Matrix<Scalar, 3, 1> v1,
-                                                                     bool normalized=true);
+  IGL_INLINE Eigen::Matrix<Scalar, 3, 3> rotation_matrix_from_directions(const Eigen::Matrix<Scalar, 3, 1> v0,
+                                                                     const Eigen::Matrix<Scalar, 3, 1> v1,
+                                                                     const bool normalized=true);
 }
 
 

+ 2 - 0
include/igl/slice.cpp

@@ -203,4 +203,6 @@ template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::sl
 template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 template void igl::slice<std::__1::complex<double> >(Eigen::SparseMatrix<std::__1::complex<double>, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<std::__1::complex<double>, 0, int>&);
 template void igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::Matrix<double, -1, 3, 0, -1, 3> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<double, -1, 3, 0, -1, 3>&);
+template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&);
+template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > igl::slice<Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 #endif

+ 12 - 11
include/igl/writeOFF.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "writeOFF.h"
 #include <cstdio>
@@ -16,26 +16,26 @@ IGL_INLINE bool igl::writeOFF(
   const Eigen::PlainObjectBase<DerivedF>& F)
 {
   FILE *fp = fopen (fname.c_str(), "w");
-  
-  
+
+
   if (!fp)
   {
       fprintf (stderr, "writeOFF(): could not open file %s", fname.c_str());
     return false;
   }
-  
+
   fprintf (fp, "OFF\n%d %d 0\n",  (int) V.rows(), (int) F.rows());
-  
+
   for (int i = 0; i < V.rows(); i++)
   {
     fprintf(
       fp,
       "%0.17g %0.17g %0.17g\n",
-      (double)V(i,0), 
-      (double)V(i,1), 
+      (double)V(i,0),
+      (double)V(i,1),
       (double)V(i,2));
   }
-  
+
 //  for (int i = 0; i < F.rows(); i++)
 //      fprintf (fp, "3 %d %d %d\n", F(i,0), F(i,1), F(i,2));
   for (int i = 0; i < (int)F.rows(); i++)
@@ -54,4 +54,5 @@ IGL_INLINE bool igl::writeOFF(
 template bool igl::writeOFF<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 template bool igl::writeOFF<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > const&);
 template bool igl::writeOFF<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 1, -1, -1> > const&);
+template bool igl::writeOFF<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&);
 #endif