Browse Source

composite harmonic

Teseo Schneider 6 years ago
parent
commit
0bb49a9f77
2 changed files with 9 additions and 9 deletions
  1. 8 8
      include/igl/bijective_composite_harmonic_mapping.cpp
  2. 1 1
      include/igl/slice.cpp

+ 8 - 8
include/igl/bijective_composite_harmonic_mapping.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2017 Alec Jacobson <[email protected]>
 // Copyright (C) 2017 Alec Jacobson <[email protected]>
-// 
-// 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/.
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "bijective_composite_harmonic_mapping.h"
 #include "bijective_composite_harmonic_mapping.h"
 
 
@@ -51,11 +51,11 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
   assert(F.cols() == 3 && "F should contain triangles");
   assert(F.cols() == 3 && "F should contain triangles");
   int tries = 0;
   int tries = 0;
   int nsteps = min_steps;
   int nsteps = min_steps;
-  Derivedbc bc0;
+  Eigen::Matrix<typename Derivedbc::Scalar, Eigen::Dynamic, Eigen::Dynamic> bc0;
   slice(V,b,1,bc0);
   slice(V,b,1,bc0);
 
 
   // It's difficult to check for flips "robustly" in the sense that the input
   // It's difficult to check for flips "robustly" in the sense that the input
-  // mesh might not have positive/consistent sign to begin with. 
+  // mesh might not have positive/consistent sign to begin with.
 
 
   while(nsteps<=max_steps)
   while(nsteps<=max_steps)
   {
   {
@@ -71,7 +71,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
       // of the boundary conditions. Something like "Homotopic Morphing of
       // of the boundary conditions. Something like "Homotopic Morphing of
       // Planar Curves" [Dym et al. 2015] but also handling multiple connected
       // Planar Curves" [Dym et al. 2015] but also handling multiple connected
       // components.
       // components.
-      Derivedbc bct = bc0 + t*(bc - bc0);
+      Eigen::Matrix<typename Derivedbc::Scalar, Eigen::Dynamic, Eigen::Dynamic> bct = bc0 + t * (bc - bc0);
       // Compute dsicrete harmonic map using metric of previous step
       // Compute dsicrete harmonic map using metric of previous step
       for(int iter = 0;iter<num_inner_iters;iter++)
       for(int iter = 0;iter<num_inner_iters;iter++)
       {
       {
@@ -82,7 +82,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
         //mw.save_index(b,"b");
         //mw.save_index(b,"b");
         //mw.save(bct,"bct");
         //mw.save(bct,"bct");
         //mw.write("numerical.mat");
         //mw.write("numerical.mat");
-        harmonic(DerivedU(U),F,b,bct,1,U);
+        harmonic(Eigen::Matrix<typename DerivedU::Scalar, Eigen::Dynamic, Eigen::Dynamic>(U), F, b, bct, 1, U);
         igl::slice(U,b,1,bct);
         igl::slice(U,b,1,bct);
         nans = (U.array() != U.array()).count();
         nans = (U.array() != U.array()).count();
         if(test_for_flips)
         if(test_for_flips)

+ 1 - 1
include/igl/slice.cpp

@@ -210,7 +210,7 @@ IGL_INLINE void igl::slice(
   {
   {
     for (int j = 0; j < yn; j++)
     for (int j = 0; j < yn; j++)
     {
     {
-      Y(i, j) = X(R(i), C(j));
+      Y(i, j) = X(R(i,0), C(j,0));
     }
     }
   }
   }
 }
 }