Browse Source

unproject and crouzeix_raviart_cotmatrix.cpp

Teseo Schneider 6 years ago
parent
commit
1e3cfb42c7

+ 11 - 11
include/igl/crouzeix_raviart_cotmatrix.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // 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/.
 #include "crouzeix_raviart_cotmatrix.h"
 #include "unique_simplices.h"
@@ -13,14 +13,14 @@
 
 template <typename DerivedV, typename DerivedF, typename LT, typename DerivedE, typename DerivedEMAP>
 void igl::crouzeix_raviart_cotmatrix(
-  const Eigen::MatrixBase<DerivedV> & V, 
-  const Eigen::MatrixBase<DerivedF> & F, 
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   Eigen::SparseMatrix<LT> & L,
   Eigen::PlainObjectBase<DerivedE> & E,
   Eigen::PlainObjectBase<DerivedEMAP> & EMAP)
 {
   // All occurrences of directed "facets"
-  Eigen::MatrixXi allE;
+  Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic>  allE;
   oriented_facets(F,allE);
   Eigen::VectorXi _1;
   unique_simplices(allE,E,_1,EMAP);
@@ -29,8 +29,8 @@ void igl::crouzeix_raviart_cotmatrix(
 
 template <typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP, typename LT>
 void igl::crouzeix_raviart_cotmatrix(
-  const Eigen::MatrixBase<DerivedV> & V, 
-  const Eigen::MatrixBase<DerivedF> & F, 
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
   const Eigen::MatrixBase<DerivedE> & E,
   const Eigen::MatrixBase<DerivedEMAP> & EMAP,
   Eigen::SparseMatrix<LT> & L)
@@ -84,8 +84,8 @@ void igl::crouzeix_raviart_cotmatrix(
     for(int c = 0;c<k;c++)
     {
       LIJV.emplace_back(
-        EMAP(F2E(f,LI(c))),
-        EMAP(F2E(f,LJ(c))),
+        EMAP(F2E(f,LI(c)), 0),
+        EMAP(F2E(f,LJ(c)), 0),
         (c<(k/2)?-1.:1.) * factor *C(f,LV(c)));
     }
   }

+ 3 - 3
include/igl/unproject.cpp

@@ -38,13 +38,13 @@ IGL_INLINE void igl::unproject(
   for(int i = 0;i<n;i++)
   {
     typedef typename Derivedscene::Scalar Scalar;
-    Eigen::Matrix<Scalar,4,4> Inverse = 
+    Eigen::Matrix<Scalar,4,4> Inverse =
       (proj.template cast<Scalar>() * model.template cast<Scalar>()).inverse();
 
     Eigen::Matrix<Scalar,4,1> tmp;
     tmp << win.row(i).head(3).transpose(), 1;
-    tmp(0) = (tmp(0) - viewport(0)) / viewport(2);
-    tmp(1) = (tmp(1) - viewport(1)) / viewport(3);
+    tmp(0) = (tmp(0) - viewport(0, 0)) / viewport(2, 0);
+    tmp(1) = (tmp(1) - viewport(1, 0)) / viewport(3, 0);
     tmp = tmp.array() * 2.0f - 1.0f;
 
     Eigen::Matrix<Scalar,4,1> obj = Inverse * tmp;

+ 2 - 2
include/igl/unproject_ray.cpp

@@ -27,8 +27,8 @@ IGL_INLINE void igl::unproject_ray(
   using namespace Eigen;
   // Source and direction on screen
   typedef Eigen::Matrix<typename Deriveds::Scalar,3,1> Vec3;
-  Vec3 win_s(pos(0),pos(1),0);
-  Vec3 win_d(pos(0),pos(1),1);
+  Vec3 win_s(pos(0, 0),pos(1, 0),0);
+  Vec3 win_d(pos(0, 0),pos(1, 0),1);
   // Source, destination and direction in world
   Vec3 d;
   igl::unproject(win_s,model,proj,viewport,s);