瀏覽代碼

Merge branch 'master' of https://github.com/libigl/libigl

Former-commit-id: 929809ba7b851045be4964a02dacdc9495d8ae92
Olga Diamanti 9 年之前
父節點
當前提交
ec8219cfd1

+ 1 - 0
include/igl/adjacency_matrix.cpp

@@ -67,4 +67,5 @@ IGL_INLINE void igl::adjacency_matrix(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
+template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<int, 0, int>&);
 #endif

+ 1 - 0
include/igl/embree/reorient_facets_raycast.cpp

@@ -254,4 +254,5 @@ IGL_INLINE void igl::embree::reorient_facets_raycast(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::embree::reorient_facets_raycast<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::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<int, -1, 1, 0, -1, 1> >&);
+template void igl::embree::reorient_facets_raycast<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<bool, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -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&, int, int, bool, bool, bool, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 0
include/igl/matlab/prepare_lhs.cpp

@@ -100,6 +100,7 @@ template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, -1, 0, -
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_logical<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
+template void igl::matlab::prepare_lhs_logical<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_double<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, mxArray_tag**);
 #endif

+ 21 - 0
include/igl/project.cpp

@@ -29,9 +29,30 @@ Eigen::Matrix<Scalar,3,1> igl::project(
   return tmp.head(3);
 }
 
+template <typename DerivedV, typename Scalar, typename DerivedP>
+IGL_INLINE void igl::project(
+  const    Eigen::PlainObjectBase<DerivedV>&  V,
+  const    Eigen::Matrix<Scalar,4,4>& model,
+  const    Eigen::Matrix<Scalar,4,4>& proj,
+  const    Eigen::Matrix<Scalar,4,1>&  viewport,
+  Eigen::PlainObjectBase<DerivedP> & P)
+{
+  typedef typename DerivedP::Scalar PScalar;
+  Eigen::Matrix<PScalar,DerivedV::RowsAtCompileTime,4> HV(V.rows(),4);
+  HV.leftCols(3) = V.template cast<PScalar>();
+  HV.col(3).setConstant(1);
+  HV = (HV*model.template cast<PScalar>().transpose()*
+      proj.template cast<PScalar>().transpose()).eval();
+  HV = (HV.array().colwise()/HV.col(3).array()).eval();
+  HV = (HV.array() * 0.5 + 0.5).eval();
+  HV.col(0) = (HV.array().col(0) * viewport(2) + viewport(0)).eval();
+  HV.col(1) = (HV.array().col(1) * viewport(3) + viewport(1)).eval();
+  P = HV.leftCols(3);
+}
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template Eigen::Matrix<double, 3, 1, 0, 3, 1> igl::project<double>(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 1, 0, 4, 1> const&);
 template Eigen::Matrix<float, 3, 1, 0, 3, 1> igl::project<float>(Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&);
+template void igl::project<Eigen::Matrix<double, -1, -1, 0, -1, -1>, float, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 14 - 0
include/igl/project.h

@@ -25,6 +25,20 @@ namespace igl
     const    Eigen::Matrix<Scalar,4,4>& model,
     const    Eigen::Matrix<Scalar,4,4>& proj,
     const    Eigen::Matrix<Scalar,4,1>&  viewport);
+  // Inputs:
+  //   V  #V by 3 list of object points
+  //   model  model matrix
+  //   proj  projection matrix
+  //   viewport  viewport vector
+  // Outputs:
+  //   P  #V by 3 list of screen space points
+  template <typename DerivedV, typename Scalar, typename DerivedP>
+  IGL_INLINE void project(
+    const    Eigen::PlainObjectBase<DerivedV>&  V,
+    const    Eigen::Matrix<Scalar,4,4>& model,
+    const    Eigen::Matrix<Scalar,4,4>& proj,
+    const    Eigen::Matrix<Scalar,4,1>&  viewport,
+    Eigen::PlainObjectBase<DerivedP> & P);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 4 - 2
include/igl/viewer/Viewer.cpp

@@ -561,6 +561,10 @@ namespace viewer
 
   IGL_INLINE bool Viewer::mouse_down(MouseButton button,int modifier)
   {
+    // Remember mouse location at down even if used by callback/plugin
+    down_mouse_x = current_mouse_x;
+    down_mouse_y = current_mouse_y;
+
     if (callback_mouse_down)
       if (callback_mouse_down(*this,static_cast<int>(button),modifier))
         return true;
@@ -571,8 +575,6 @@ namespace viewer
 
     down = true;
 
-    down_mouse_x = current_mouse_x;
-    down_mouse_y = current_mouse_y;
     down_translation = core.model_translation;
 
 

+ 3 - 0
optional/CMakeLists.txt

@@ -22,6 +22,7 @@ option(LIBIGL_WITH_BBW              "Use BBW"            ON)
 find_package(CGAL QUIET)
 option(LIBIGL_WITH_CGAL             "Use CGAL"           "${CGAL_FOUND}")
 option(LIBIGL_WITH_COMISO           "Use CoMiso"         ON)
+### Cork is off by default since it fails to build out-of-the-box on windows
 option(LIBIGL_WITH_CORK             "Use Cork"           OFF)
 option(LIBIGL_WITH_EMBREE           "Use Embree"         ON)
 option(LIBIGL_WITH_LIM              "Use LIM"            ON)
@@ -29,6 +30,8 @@ find_package(MATLAB QUIET)
 option(LIBIGL_WITH_MATLAB           "Use Matlab"         "${MATLAB_FOUND}")
 find_package(MOSEK  QUIET)
 option(LIBIGL_WITH_MOSEK            "Use MOSEK"          "${MOSEK_FOUND}")
+### Nanogui is off by default because it has many dependencies and generates
+### many issues 
 option(LIBIGL_WITH_NANOGUI          "Use Nanogui menu"   OFF)
 option(LIBIGL_WITH_OPENGL           "Use OpenGL"         ON)
 option(LIBIGL_WITH_PNG              "Use PNG"            ON)

+ 10 - 5
shared/cmake/CMakeLists.txt

@@ -100,8 +100,13 @@ endif()
 
 ### Compile the AntTweakBar part ###
 if(LIBIGL_WITH_ANTTWEAKBAR)
+  set(ANTTWEAKBAR_DIR "${LIBIGL_EXTERNAL}/anttweakbar")
+  set(ANTTWEAKBAR_INCLUDE_DIR "${ANTTWEAKBAR_DIR}/include")
+  list(APPEND LIBIGL_INCLUDE_DIRS "${ANTTWEAKBAR_INCLUDE_DIR}")
   if(LIBIGL_USE_STATIC_LIBRARY)
     CompileIGL_Module("anttweakbar")
+    target_include_directories(iglanttweakbar PRIVATE
+      ${ANTTWEAKBAR_INCLUDE_DIR})
   endif()
 endif()
 
@@ -352,19 +357,19 @@ if(LIBIGL_WITH_COMISO)
 
   if(MSVC)
     # Copy the dll
-    add_custom_target(Copy-CoMISo-DLL        # Adds a post-build event to MyTest
+    add_custom_target(Copy-CoMISo-DLL ALL       # Adds a post-build event to MyTest
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
         "${COMISO_DIR}/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libopenblas.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libopenblas.dll"
+        "${CMAKE_CURRENT_BINARY_DIR}/../libopenblas.dll"
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
         "${COMISO_DIR}/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libgcc_s_seh-1.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libgcc_s_seh-1.dll"
+        "${CMAKE_CURRENT_BINARY_DIR}/../libgcc_s_seh-1.dll"
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
         "${COMISO_DIR}/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libgfortran-3.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libgfortran-3.dll"
+        "${CMAKE_CURRENT_BINARY_DIR}/../libgfortran-3.dll"
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
         "${COMISO_DIR}/ext/OpenBLAS-v0.2.14-Win64-int64/bin/libquadmath-0.dll"
-        "${CMAKE_CURRENT_BINARY_DIR}/libquadmath-0.dll")
+        "${CMAKE_CURRENT_BINARY_DIR}/../libquadmath-0.dll")
   endif()
 
   if(LIBIGL_USE_STATIC_LIBRARY)

+ 1 - 1
tutorial/tutorial.md.REMOVED.git-id

@@ -1 +1 @@
-c1fd59bc7313c701b8e5c88150b65216c1ea30a5
+f600032cf5553688f2e8ad31dcc300bc9c303a65