Przeglądaj źródła

harmonic weights

Former-commit-id: 059c36d5b3d31f00fc6e2b0a2ed4dfd4303a1232
Alec Jacobson (jalec 11 lat temu
rodzic
commit
2608885ba3

+ 1 - 37
examples/arap/example.cpp

@@ -1,6 +1,7 @@
 #include <igl/svd3x3/arap.h>
 #include <igl/writeDMAT.h>
 #include <igl/partition.h>
+#include <igl/harmonic.h>
 #include <igl/cotmatrix.h>
 #include <igl/massmatrix.h>
 #include <igl/invert_diag.h>
@@ -155,43 +156,6 @@ int num_in_selection(const Eigen::VectorXi & S)
   return count;
 }
 
-bool harmonic(
-  const Eigen::MatrixXd & V,
-  const Eigen::MatrixXi & F,
-  const Eigen::VectorXi & b,
-  const Eigen::MatrixXd & bc,
-  const int k,
-  Eigen::MatrixXd & W)
-{
-  using namespace igl;
-  using namespace Eigen;
-  SparseMatrix<double> L,M,Mi;
-  cotmatrix(V,F,L);
-  massmatrix(V,F,MASSMATRIX_VORONOI,M);
-  invert_diag(M,Mi);
-  SparseMatrix<double> Q = -L;
-  for(int p = 1;p<k;p++)
-  {
-    Q = (Q*Mi*-L).eval();
-  }
-  const VectorXd B = VectorXd::Zero(V.rows(),1);
-  min_quad_with_fixed_data<double> data;
-  min_quad_with_fixed_precompute(Q,b,SparseMatrix<double>(),true,data);
-  W.resize(V.rows(),bc.cols());
-  for(int w = 0;w<bc.cols();w++)
-  {
-    const VectorXd bcw = bc.col(w);
-    VectorXd Ww;
-    if(!min_quad_with_fixed_solve(data,B,bcw,VectorXd(),Ww))
-    {
-      return false;
-    }
-    W.col(w) = Ww;
-  }
-  return true;
-}
-
-
 bool init_arap()
 {
   using namespace igl;

+ 42 - 0
include/igl/harmonic.cpp

@@ -0,0 +1,42 @@
+#include "harmonic.h"
+#include "cotmatrix.h"
+#include "massmatrix.h"
+#include "invert_diag.h"
+#include "min_quad_with_fixed.h"
+#include <Eigen/Sparse>
+
+IGL_INLINE bool igl::harmonic(
+  const Eigen::MatrixXd & V,
+  const Eigen::MatrixXi & F,
+  const Eigen::VectorXi & b,
+  const Eigen::MatrixXd & bc,
+  const int k,
+  Eigen::MatrixXd & W)
+{
+  using namespace igl;
+  using namespace Eigen;
+  SparseMatrix<double> L,M,Mi;
+  cotmatrix(V,F,L);
+  massmatrix(V,F,MASSMATRIX_VORONOI,M);
+  invert_diag(M,Mi);
+  SparseMatrix<double> Q = -L;
+  for(int p = 1;p<k;p++)
+  {
+    Q = (Q*Mi*-L).eval();
+  }
+  const VectorXd B = VectorXd::Zero(V.rows(),1);
+  min_quad_with_fixed_data<double> data;
+  min_quad_with_fixed_precompute(Q,b,SparseMatrix<double>(),true,data);
+  W.resize(V.rows(),bc.cols());
+  for(int w = 0;w<bc.cols();w++)
+  {
+    const VectorXd bcw = bc.col(w);
+    VectorXd Ww;
+    if(!min_quad_with_fixed_solve(data,B,bcw,VectorXd(),Ww))
+    {
+      return false;
+    }
+    W.col(w) = Ww;
+  }
+  return true;
+}

+ 23 - 1
include/igl/harmonic.h

@@ -9,7 +9,29 @@
 #define IGL_HARMONIC_H
 #include "igl_inline.h"
 #include <Eigen/Core>
-
 namespace igl 
 {
+  // Compute k-harmonic weight functions "coordinates".
+  //
+  //
+  // Inputs:
+  //   V  #V by dim vertex positions
+  //   F  #F by simplex-size list of element indices
+  //   b  #b boundary indices into V
+  //   bc #b by #W list of boundary values
+  //   k  power of harmonic operation (1: harmonic, 2: biharmonic, etc)
+  // Outputs:
+  //   W  #V by #W list of weights
+  //
+  IGL_INLINE bool harmonic(
+    const Eigen::MatrixXd & V,
+    const Eigen::MatrixXi & F,
+    const Eigen::VectorXi & b,
+    const Eigen::MatrixXd & bc,
+    const int k,
+    Eigen::MatrixXd & W);
 };
+#ifdef IGL_HEADER_ONLY
+#include "harmonic.cpp"
+#endif
+#endif

+ 1 - 1
include/igl/matlab/Makefile

@@ -23,7 +23,7 @@ INC+=$(EIGEN3_INC)
 
 # Matlab dependency
 ifndef MATLAB
-  MATLAB=/Applications/MATLAB_R2012a.app/
+  MATLAB=/Applications/MATLAB_R2013b.app/
   $(warning MATLAB undefined. Setting MATLAB=${MATLAB})
 endif
 MATLAB_INC=-I$(MATLAB)/extern/include/

+ 7 - 0
scripts/upload.sh

@@ -1,6 +1,13 @@
 #!/bin/bash
+set -e
 make clean
 zip -9 -r --exclude=@exclude.lst  libigl.zip ../libigl
 scp libigl.zip $WEBSORKINE:www/htdocs-igl/projects/libigl/
 cp *.html ~/Documents/IGL-website/projects/libigl/
 cp file-formats/* ~/Documents/IGL-website/projects/libigl/file-formats/
+VERSION=`grep -v "^\#" VERSION.txt | tr -d '\n'`
+cd ~/Documents/IGL-website/projects/libigl/
+svn up
+sed -ie "s/RELEASE_HISTORY\.txt>[0-9\.]*<\/a>/RELEASE_HISTORY\.txt>$VERSION<\/a>/" index.php
+svn ci -m "update igl version: $VERSION"
+ssh websorkine@web-login.inf.ethz.ch "svn update www/htdocs-igl/"