Browse Source

Merge remote-tracking branch 'upstream/master' into docs

Former-commit-id: d7d246a9f3e39f4feb9adce55da50c97324c4eee
Jérémie Dumas 7 years ago
parent
commit
a8703b3bd1

+ 9 - 0
include/igl/copyleft/cgal/remesh_intersections.cpp

@@ -148,6 +148,8 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
     std::vector<Index> source_faces;
     std::vector<Index> source_faces;
     std::vector<Point_3> new_vertices;
     std::vector<Point_3> new_vertices;
     EdgeMap edge_vertices;
     EdgeMap edge_vertices;
+    // face_vertices: Given a face Index, find vertices inside the face
+    std::unordered_map<Index, std::vector<Index>> face_vertices;
 
 
     // Run constraint Delaunay triangulation on the plane.
     // Run constraint Delaunay triangulation on the plane.
     // 
     // 
@@ -252,8 +254,15 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
         }
         }
 
 
         // p must be in the middle of the triangle.
         // p must be in the middle of the triangle.
+        auto & existing_face_vertices = face_vertices[ori_f];
+        for(const auto vid : existing_face_vertices) {
+          if (p == new_vertices[vid - num_base_vertices]) {
+            return vid;
+          }
+        }
         const size_t index = num_base_vertices + new_vertices.size();
         const size_t index = num_base_vertices + new_vertices.size();
         new_vertices.push_back(p);
         new_vertices.push_back(p);
+        existing_face_vertices.push_back(index);
         return index;
         return index;
       }
       }
     };
     };

+ 3 - 0
include/igl/delaunay_triangulation.cpp

@@ -81,3 +81,6 @@ IGL_INLINE void igl::delaunay_triangulation(
   }
   }
 }
 }
 
 
+#ifdef IGL_STATIC_LIBRARY
+template void igl::delaunay_triangulation<Eigen::Matrix<double, -1, -1, 0, -1, -1>, short (*)(double const*, double const*, double const*), short (*)(double const*, double const*, double const*, double const*), Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, short (*)(double const*, double const*, double const*), short (*)(double const*, double const*, double const*, double const*), Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+#endif

+ 5 - 0
include/igl/flip_edge.cpp

@@ -146,3 +146,8 @@ IGL_INLINE void igl::flip_edge(
   sanity_check(ue_41);
   sanity_check(ue_41);
 #endif
 #endif
 }
 }
+
+
+#ifdef IGL_STATIC_LIBRARY
+template void igl::flip_edge<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<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, unsigned long);
+#endif

+ 4 - 0
include/igl/lexicographic_triangulation.cpp

@@ -126,3 +126,7 @@ IGL_INLINE void igl::lexicographic_triangulation(
   }
   }
 }
 }
 
 
+
+#ifdef IGL_STATIC_LIBRARY
+template void igl::lexicographic_triangulation<Eigen::Matrix<double, -1, -1, 0, -1, -1>, short (*)(double const*, double const*, double const*), Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, short (*)(double const*, double const*, double const*), Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+#endif

+ 1 - 1
include/igl/opengl/glfw/imgui/ImGuiMenu.cpp

@@ -221,7 +221,7 @@ IGL_INLINE void ImGuiMenu::draw_viewer_menu()
     ImGui::DragFloat("Zoom", &(viewer->core.camera_zoom), 0.05f, 0.1f, 20.0f);
     ImGui::DragFloat("Zoom", &(viewer->core.camera_zoom), 0.05f, 0.1f, 20.0f);
 
 
     // Select rotation type
     // Select rotation type
-    static int rotation_type = static_cast<int>(viewer->core.rotation_type);
+    int rotation_type = static_cast<int>(viewer->core.rotation_type);
     static Eigen::Quaternionf trackball_angle = Eigen::Quaternionf::Identity();
     static Eigen::Quaternionf trackball_angle = Eigen::Quaternionf::Identity();
     static bool orthographic = true;
     static bool orthographic = true;
     if (ImGui::Combo("Camera Type", &rotation_type, "Trackball\0Two Axes\0002D Mode\0\0"))
     if (ImGui::Combo("Camera Type", &rotation_type, "Trackball\0Two Axes\0002D Mode\0\0"))

+ 1 - 1
include/igl/ply.h.REMOVED.git-id

@@ -1 +1 @@
-75a3bab471417c278eec124122f42d7a6f8cfee2
+71f4860db5bab6831ffc0ceb38c42c4973c0fc1a

+ 2 - 0
python/py_igl.cpp

@@ -16,6 +16,7 @@
 #include <igl/SolverStatus.h>
 #include <igl/SolverStatus.h>
 #include <igl/active_set.h>
 #include <igl/active_set.h>
 #include <igl/adjacency_list.h>
 #include <igl/adjacency_list.h>
+#include <igl/adjacency_matrix.h>
 #include <igl/arap.h>
 #include <igl/arap.h>
 #include <igl/avg_edge_length.h>
 #include <igl/avg_edge_length.h>
 #include <igl/barycenter.h>
 #include <igl/barycenter.h>
@@ -114,6 +115,7 @@ void python_export_igl(py::module &m)
 #include "py_igl/py_SolverStatus.cpp"
 #include "py_igl/py_SolverStatus.cpp"
 #include "py_igl/py_active_set.cpp"
 #include "py_igl/py_active_set.cpp"
 #include "py_igl/py_adjacency_list.cpp"
 #include "py_igl/py_adjacency_list.cpp"
+#include "py_igl/py_adjacency_matrix.cpp"
 #include "py_igl/py_arap.cpp"
 #include "py_igl/py_arap.cpp"
 #include "py_igl/py_avg_edge_length.cpp"
 #include "py_igl/py_avg_edge_length.cpp"
 #include "py_igl/py_barycenter.cpp"
 #include "py_igl/py_barycenter.cpp"

+ 10 - 0
python/py_igl/py_adjacency_matrix.cpp

@@ -0,0 +1,10 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
+//
+// 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/.
+m.def("adjacency_matrix", [](const Eigen::MatrixXi & F, Eigen::SparseMatrix<int>& A) {
+    igl::adjacency_matrix(F, A);
+}, py::arg("F"), py::arg("A"));