Browse Source

better doc

Former-commit-id: d65f1931ce8bc938bbda2173de136e420c7b76ea
Alec Jacobson 10 years ago
parent
commit
0ff5db14a6
2 changed files with 17 additions and 16 deletions
  1. 9 5
      include/igl/lscm.cpp
  2. 8 11
      include/igl/lscm.h

+ 9 - 5
include/igl/lscm.cpp

@@ -9,13 +9,12 @@
 
 #include <igl/vector_area_matrix.h>
 #include <igl/cotmatrix.h>
-//#include <igl/kronecker_product.h>
 #include <igl/repdiag.h>
 #include <igl/min_quad_with_fixed.h>
 #include <igl/matlab_format.h>
 #include <iostream>
 
-IGL_INLINE void igl::lscm(
+IGL_INLINE bool igl::lscm(
   const Eigen::MatrixXd& V,
   const Eigen::MatrixXi& F,
   const Eigen::VectorXi& b,
@@ -48,11 +47,16 @@ IGL_INLINE void igl::lscm(
   SparseMatrix<double> Q = -L_flat + 2.*A;
   const VectorXd B_flat = VectorXd::Zero(V.rows()*2);
   igl::min_quad_with_fixed_data<double> data;
-  igl::min_quad_with_fixed_precompute(Q,b_flat,SparseMatrix<double>(),true,data);
+  if(!igl::min_quad_with_fixed_precompute(Q,b_flat,SparseMatrix<double>(),true,data))
+  {
+    return false;
+  }
 
   MatrixXd W_flat;
   if(!min_quad_with_fixed_solve(data,B_flat,bc_flat,VectorXd(),W_flat))
-    assert(false);
+  {
+    return false;
+  }
 
 
   assert(W_flat.rows() == V.rows()*2);
@@ -61,7 +65,7 @@ IGL_INLINE void igl::lscm(
   {
     V_uv.col(i) = W_flat.block(V_uv.rows()*i,0,V_uv.rows(),1);
   }
-
+  return true;
 }
 
 #ifdef IGL_STATIC_LIBRARY

+ 8 - 11
include/igl/lscm.h

@@ -14,9 +14,12 @@
 
 namespace igl
 {
-  // Compute a Least-squares conformal map parametrization following the algorithm
-  // presented in: Spectral Conformal Parameterization,
-  //               Patrick Mullen, Yiying Tong, Pierre Alliez and Mathieu Desbrun
+  // Compute a Least-squares conformal map parametrization following the
+  // algorithm presented in: Spectral Conformal Parameterization, Patrick
+  // Mullen, Yiying Tong, Pierre Alliez and Mathieu Desbrun. Input should be a
+  // manifold mesh (also no unreferenced vertices) and "boundary" `b` should
+  // contain at least two vertices per connected component.
+  //
   //
   // Inputs:
   //   V  #V by 3 list of mesh vertex positions
@@ -25,15 +28,9 @@ namespace igl
   //   bc #b by 3 list of boundary values
   // Outputs:
   //   UV #V by 2 list of 2D mesh vertex positions in UV space
+  // Returns true only on solver success.
   //
-  // X  Note: if b and bc are empty, lscm automatically removes the null space
-  // X        by fixing two farthest points on the boundary
-  // Boundary conditions are part of the api. It would be strange to secretly
-  // use other boundary conditions. This is also weird if there's more than one
-  // boundary loop.
-  // X  Note: (V,F) must be a genus-0 mesh, with a single boundary
-  // No longer the case. Should probably just be manifold.
-  IGL_INLINE void lscm(
+  IGL_INLINE bool lscm(
     const Eigen::MatrixXd& V,
     const Eigen::MatrixXi& F,
     const Eigen::VectorXi& b,