Kaynağa Gözat

It finally compiles.

Former-commit-id: c079751ef447ec7bba1176920f42a0d534127ac9
Amir Vaxman 7 yıl önce
ebeveyn
işleme
e577d01094

+ 4 - 4
include/igl/shapeup.cpp

@@ -22,8 +22,7 @@ namespace igl
     typename DerivedS,
     typename Derivedb,
     typename Derivedw>
-    IGL_INLINE bool shapeup_precomputation(
-                                           const Eigen::PlainObjectBase<DerivedP>& P,
+    IGL_INLINE bool shapeup_precomputation(const Eigen::PlainObjectBase<DerivedP>& P,
                                            const Eigen::PlainObjectBase<DerivedSC>& SC,
                                            const Eigen::PlainObjectBase<DerivedS>& S,
                                            const Eigen::PlainObjectBase<DerivedS>& E,
@@ -38,7 +37,7 @@ namespace igl
         sudata.SC=SC;
         sudata.S=S;
         sudata.b=b;
-        sudata.local_projection=local_projection;
+        //sudata.local_projection=local_projection;
         
         sudata.DShape.conservativeResize(SC.sum(), P.rows());  //Shape matrix (integration);
         sudata.DClose.conservativeResize(b.rows(), P.rows());  //Closeness matrix for positional constraints
@@ -149,8 +148,9 @@ namespace igl
 
 
 
+
 #ifdef IGL_STATIC_LIBRARY
-template bool igl::shapeup_precomputation<Eigen::Matrix<double, -1, -1, 0, -1, -1> ,Eigen::Matrix<int, -1, -1, 0, -1, 1> ,Eigen::Matrix<int, -1, -1, 0, -1, -1> ,Eigen::Matrix<int, -1, -1, 0, -1, 1> ,Eigen::Matrix<double, -1, -1, 0, -1, 1> >(const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >& P, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, 1> >& SC,const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >& S, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >& E, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, 1> >& b, const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, 1> >& w, const std::function<bool(const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, 1> >&, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,  Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&)>& local_projection, igl::ShapeupData & sudata);
+template bool igl::shapeup_precomputation<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > 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, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&,  const std::function<bool(const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&,  Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >& ) >& local_projection, igl::ShapeupData&);
 
 template bool igl::shapeup_solve<typename Eigen::Matrix<double, -1, -1, 0, -1, -1>, typename Eigen::Matrix<double, -1, -1, 0, -1, -1> >(const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >& bc, const Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >& P0, const igl::ShapeupData & sudata, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >& P);
 #endif

+ 3 - 2
include/igl/shapeup.h

@@ -77,8 +77,7 @@ namespace igl
     typename DerivedS,
     typename Derivedb,
     typename Derivedw>
-    IGL_INLINE void shapeup_precomputation(
-                                           const Eigen::PlainObjectBase<DerivedP>& P,
+    IGL_INLINE bool shapeup_precomputation(const Eigen::PlainObjectBase<DerivedP>& P,
                                            const Eigen::PlainObjectBase<DerivedSC>& SC,
                                            const Eigen::PlainObjectBase<DerivedS>& S,
                                            const Eigen::PlainObjectBase<DerivedS>& E,
@@ -87,6 +86,8 @@ namespace igl
                                            const std::function<bool(const Eigen::PlainObjectBase<DerivedP>&, const Eigen::PlainObjectBase<DerivedSC>&, const Eigen::PlainObjectBase<DerivedS>&,  Eigen::PlainObjectBase<DerivedP>&)>& local_projection,
                                            ShapeupData & sudata);
     
+    
+    
     //This function solve the shapeup project optimization. shapeup_precompute must be called before with the same sudata, or results are unpredictable
     
     //Input:

+ 2 - 2
include/igl/shapeup_local_projections.cpp

@@ -20,7 +20,7 @@ namespace igl
 {
     
     //This projection does nothing but render points into projP. Mostly used for "echoing" the global step
-    IGL_INLINE bool shapeup_identity_projection(const Eigen::MatrixXd& P, const Eigen::VectorXi& SC, const Eigen::MatrixXi& S,  Eigen::MatrixXd& projP){
+    IGL_INLINE bool shapeup_identity_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S,  Eigen::PlainObjectBase<Eigen::MatrixXd>& projP){
         projP.conservativeResize(SC.rows(), 3*SC.maxCoeff());
         for (int i=0;i<S.rows();i++){
             Eigen::RowVector3d avgCurrP=Eigen::RowVector3d::Zero();
@@ -35,7 +35,7 @@ namespace igl
     
     
     //the projection assumes that the sets are vertices of polygons in order
-    IGL_INLINE bool shapeup_regular_face_projection(const Eigen::MatrixXd& P, const Eigen::VectorXi& SC, const Eigen::MatrixXi& S,  Eigen::MatrixXd& projP){
+    IGL_INLINE bool shapeup_regular_face_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S,  Eigen::PlainObjectBase<Eigen::MatrixXd>& projP){
         projP.conservativeResize(SC.rows(), 3*SC.maxCoeff());
         for (int currRow=0;currRow<SC.rows();currRow++){
             //computing average

+ 2 - 2
include/igl/shapeup_local_projections.h

@@ -21,10 +21,10 @@ namespace igl
 {
     
     //This projection does nothing but render points into projP. Mostly used for "echoing" the global step
-    IGL_INLINE bool shapeup_identity_projection(const Eigen::MatrixXd& P, const Eigen::VectorXi& SC, const Eigen::MatrixXi& S,  Eigen::MatrixXd& projP);
+    IGL_INLINE bool shapeup_identity_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S,  Eigen::PlainObjectBase<Eigen::MatrixXd>& projP);
     
     //the projection assumes that the sets are vertices of polygons in order
-    IGL_INLINE bool shapeup_regular_face_projection(const Eigen::MatrixXd& P, const Eigen::VectorXi& SC, const Eigen::MatrixXi& S,  Eigen::MatrixXd& projP);
+    IGL_INLINE bool shapeup_regular_face_projection(const Eigen::PlainObjectBase<Eigen::MatrixXd>& P, const Eigen::PlainObjectBase<Eigen::VectorXi>& SC, const Eigen::PlainObjectBase<Eigen::MatrixXi>& S,  Eigen::PlainObjectBase<Eigen::MatrixXd>& projP);
     
 }
 

+ 3 - 2
tutorial/801_ShapeUp/main.cpp

@@ -116,8 +116,9 @@ int main(int argc, char *argv[])
     
   VectorXi array_of_fours=VectorXi::Constant(FQC.rows(),4);
     cout<<"before pre-computation"<<endl;
-    std::function<bool(const MatrixXd&, const VectorXi&, const MatrixXi&, MatrixXd&)> localFunction=std::function<bool(const MatrixXd&, const VectorXi&, const MatrixXi&, MatrixXd&)>(igl::shapeup_identity_projection);
-    //shapeup_precomputation(VQC, array_of_fours,FQC,E,b,w, localFunction,su_data);
+    std::function<bool(const Eigen::PlainObjectBase<MatrixXd>&, const Eigen::PlainObjectBase<VectorXi>&, const Eigen::PlainObjectBase<MatrixXi>&, Eigen::PlainObjectBase<MatrixXd>&)> localFunction(igl::shapeup_identity_projection);
+    
+    shapeup_precomputation(VQC, array_of_fours,FQC,E,b,w, localFunction,su_data);
     cout<<"after pre-computation"<<endl;
     shapeup_solve(bc,VQC,su_data,VQCregular);
     cout<<"after computation"<<endl;