Browse Source

Merge branch 'master' of github.com:libigl/libigl

Former-commit-id: 5b3ba79291e06dd28083d60ac27d3182433ac180
Alec Jacobson 10 years ago
parent
commit
583cf91be1

+ 1 - 1
build/Makefile.conf

@@ -107,7 +107,7 @@ endif
 ifeq ($(IGL_USERNAME),daniele)
 	IGL_WITH_MATLAB=0
 	AFLAGS=-m64
-	GG=g++-4.7
+	GG=g++
 	EIGEN3_INC=-I/usr/local/include/eigen3
 endif
 

+ 0 - 23
examples/principal_curvature/Makefile

@@ -1,23 +0,0 @@
-
-.PHONY: all
-
-# Shared flags etc.
-include ../../build/Makefile.conf
-
-all: curvature
-
-.PHONY: curvature
-
-igl_lib=../../
-eigen=-I$(DEFAULT_PREFIX)/include/eigen3
-
-inc=-I$(igl_lib)/include $(eigen)
-
-curvature: curvature.o
-	g++ $(CFLAGS) $(OPENMP) -o curvature curvature.o $(lib)
-
-curvature.o: curvature.cpp
-	g++ $(CFLAGS) $(OPENMP) -c curvature.cpp -o curvature.o $(inc)
-clean:
-	rm -f curvature.o
-	rm -f curvature

+ 0 - 164
examples/principal_curvature/curvature.cpp

@@ -1,164 +0,0 @@
-// This example is broken. It secretly uses classes from inside
-// principal_curvature.cpp not the api provided in the header
-// principal_curvature.h
-#undef IGL_STATIC_LIBRARY
-#include <igl/principal_curvature.h>
-#include <igl/read_triangle_mesh.h>
-#include <iostream>
-#include <Eigen/Dense>
-#include <Eigen/Sparse>
-
-
-using namespace std;
-bool cont=true;
-bool benchmark=false;
-
-void print_help()
-{
-    cout << "Usage: Curvature -i meshfile [-o curvfile] [-S scalefile] "
-            "[-k N | -e F] [-a] [-l] [-p] [-m N] [-s] [-z] [-b] [-n N] [-M N] [-h] \n"
-            "    -k N: compute using the N-ring of vertexes.\n"
-            "    -e S: compute using a sphere of radius R = S * mesh_average_edge.\n"
-            "    -a: no projection plane, use normals average.\n"
-            "    -l: local mode, use vcg normal (when using -a) or incident faces normal (default)\n"
-            "    -p: check projection plane calculation\n"
-            "    -m N: use montecarlo, extract N vertices maximum.\n"
-            "    -b: benchmark mode\n"
-            "    -n N: step for benchmarking\n"
-            "    -M N: max size for benchmarking\n"
-            "    -s: use svd calculation, not pseudoinverse.\n"
-            "    -z: check if determinant is almost zero.\n"
-            "    -h: print this help and exit.\n";
-}
-
-bool isDir(char* file)
-{
-    std::string s(file);
-    return (s.find_last_of('/')==s.size()-1);
-}
-
-void app_init(int argc, char* argv[], CurvatureCalculator& c, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
-{
-    if (argc<2)
-    {
-        print_help();
-        exit(0);
-    }
-    char* tmp;
-    const char* meshName;
-    //char * scaleFile;
-    for (argc--, argv++; argc--; argv++)
-    {
-        if( (*argv)[0] == '-')
-        {
-            switch( (*argv)[1] )
-            {
-            case 'b':
-                benchmark=true;
-                break;
-            case 'n':
-                tmp=*++argv;
-                if (!strcmp(tmp,"exp"))
-                    c.expStep=true;
-                else
-                    c.step=atoi(tmp);
-                --argc;
-                break;
-            case 'M':
-                c.maxSize=atoi(*++argv);
-                argc--;
-                break;
-            case 'i':
-                meshName=*++argv;
-                igl::read_triangle_mesh(meshName,V,F);
-                argc--;
-                break;
-            case 'k':
-                c.st=K_RING_SEARCH;
-                c.kRing = atoi (*++argv);
-                argc--;
-                break;
-
-            case 'e':
-                c.st=SPHERE_SEARCH;
-                c.sphereRadius = atof (*++argv);
-                argc--;
-                break;
-
-            case 'a':
-                c.nt=AVERAGE;
-                break;
-
-            case 'l':
-                c.localMode = true;
-                break;
-
-            case 'p':
-                c.projectionPlaneCheck = true;
-                break;
-
-            case 'm':
-                c.montecarlo=true;
-                c.montecarloN = atoi (*++argv);
-                argc--;
-                break;
-
-            case 's':
-                c.svd = true;
-                break;
-
-            case 'z':
-                c.zeroDetCheck = true;
-                break;
-
-            case 'f':
-                /* dc.fitCreaseMode = atoi (*++argv);
-                    argc--;*/
-                break;
-
-            case 'o':
-                tmp=*++argv;
-                cerr << "Tmp: " << tmp << endl;
-                if (isDir(tmp))
-                {
-                    std::string tmpS(tmp);
-                    std::string tmpM(meshName);
-                    size_t pos=tmpM.find_last_of('/');
-                    tmpM.assign(tmpM.begin()+pos+1,tmpM.end());
-                    c.lastMeshName=tmpS+tmpM;
-                }
-                else
-                    c.lastMeshName=tmp;
-                argc--;
-                break;
-
-            case 'h':
-                print_help();
-                exit(0);
-
-            default:
-                print_help();
-                exit(0);
-            }
-        }
-    }
-
-    return;
-}
-
-int main(int argc, char *argv[])
-{
-    CurvatureCalculator c;
-    Eigen::MatrixXd V;
-    Eigen::MatrixXi F;
-    string filename;
-
-    app_init(argc,argv,c,V,F);
-
-    c.init(V,F);
-
-    c.computeCurvature();
-
-    c.printCurvature(c.lastMeshName);
-
-}

+ 1 - 1
include/igl/comiso/miq.cpp

@@ -1006,7 +1006,7 @@ IGL_INLINE void igl::PoissonSolver<DerivedV, DerivedF>::SolvePoisson(Eigen::Vect
   if (DEBUGPRINT)
     printf("\n BUILT THE MATRIX \n");
 
-  if (integer_rounding)    
+  if (integer_rounding)
     AddToRoundVertices(roundVertices);
 
   if (_singularity_rounding)

+ 1 - 1
include/igl/find_cross_field_singularities.cpp

@@ -69,7 +69,7 @@ IGL_INLINE void igl::find_cross_field_singularities(const Eigen::PlainObjectBase
 {
 
   Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 3> Handle_MMatch;
-  igl::cross_field_missmatch<DerivedV, DerivedF, DerivedO>(V, F, PD1, PD2, Handle_MMatch);
+  igl::cross_field_missmatch<DerivedV, DerivedF, DerivedO>(V, F, PD1, PD2, true, Handle_MMatch);
   igl::find_cross_field_singularities(V, F, Handle_MMatch, isSingularity, singularityIndex);
 }
 

+ 4 - 3
include/igl/find_cross_field_singularities.h

@@ -13,8 +13,8 @@
 namespace igl
 {
   // Computes singularities of a cross field, assumed combed
-  
-  
+
+
   // Inputs:
   //   V                #V by 3 eigen Matrix of mesh vertex 3D positions
   //   F                #F by 3 eigen Matrix of face (quad) indices
@@ -31,7 +31,8 @@ namespace igl
                                                  Eigen::PlainObjectBase<DerivedO> &isSingularity,
                                                  Eigen::PlainObjectBase<DerivedO> &singularityIndex);
 
-  // Wrapper that calculates the missmatch if it is not provided
+  // Wrapper that calculates the missmatch if it is not provided.
+  // Note that the field in PD1 and PD2 MUST BE combed (see igl::comb_cross_field).
   // Inputs:
   //   V                #V by 3 eigen Matrix of mesh vertex 3D positions
   //   F                #F by 3 eigen Matrix of face (quad) indices

+ 2 - 1
include/igl/peal_outer_hull_layers.cpp

@@ -1,5 +1,6 @@
 #include "peal_outer_hull_layers.h"
 #include "outer_hull.h"
+#include <vector>
 
 template <
   typename DerivedV,
@@ -40,7 +41,7 @@ IGL_INLINE void igl::peal_outer_hull_layers(
     outer_hull(V,Fr,Fo,Jo,flipr);
     assert(Fo.rows() == Jo.rows());
     // all faces in Fo of Fr
-    vector<bool> in_outer(Fr.rows(),false); 
+    vector<bool> in_outer(Fr.rows(),false);
     for(Index g = 0;g<Jo.rows();g++)
     {
       odd(IM(Jo(g))) = odd_iter;

+ 8 - 2
include/igl/principal_curvature.cpp

@@ -418,8 +418,8 @@ IGL_INLINE void CurvatureCalculator::finalEigenStuff (int i, std::vector<Eigen::
   v2global.normalize();
 
   v1global *= c_val(0);
-  v2global *= c_val(1);  
-  
+  v2global *= c_val(1);
+
   if (c_val[0] > c_val[1])
   {
     curv[i]=std::vector<double>(2);
@@ -794,6 +794,12 @@ IGL_INLINE void igl::principal_curvature(
 {
   using namespace std;
 
+  if (radius < 2)
+  {
+    radius = 2;
+    cout << "WARNING: igl::principal_curvature needs a radius >= 2, fixing it to 2." << endl;
+  }
+
   // Preallocate memory
   PD1.resize(V.rows(),3);
   PD2.resize(V.rows(),3);

+ 5 - 0
tutorial/CMakeLists.txt

@@ -14,6 +14,9 @@ find_package(MATLAB QUIET)
 find_package(EMBREE QUIET)
 find_package(CGAL QUIET)
 
+## Check for mosek
+find_package(MOSEK QUIET)
+
 # Chapter 1
 add_subdirectory("101_FileIO")
 add_subdirectory("102_DrawMesh")
@@ -38,7 +41,9 @@ add_subdirectory("305_QuadraticProgramming")
 # Chapter 4
 add_subdirectory("401_BiharmonicDeformation")
 add_subdirectory("402_PolyharmonicDeformation")
+if(MOSEK_FOUND)
 add_subdirectory("403_BoundedBiharmonicWeights")
+endif(MOSEK_FOUND)
 add_subdirectory("404_DualQuaternionSkinning")
 add_subdirectory("405_AsRigidAsPossible")
 add_subdirectory("406_FastAutomaticSkinningTransformations")

+ 1 - 2
tutorial/cmake/FindMOSEK.cmake

@@ -26,6 +26,5 @@ IF (MOSEK_FOUND)
    SET(MOSEK_INCLUDE_DIRS ${MOSEK_INCLUDE_DIR} )
 ELSE (MOSEK_FOUND)
     #add_definitions(-DIGL_NO_MOSEK)
-    message(WARNING "could NOT find MOSEK")
+    #message(WARNING "could NOT find MOSEK")
 ENDIF (MOSEK_FOUND)
-