Browse Source

Python bindings for line_mesh_intersection()

Former-commit-id: 43e7c6b81c79f452b82cebddb164e89ff433d8fc
Guillermo Lomas Rodríguez 8 years ago
parent
commit
40b45738a5

+ 1 - 1
python/CMakeLists.txt

@@ -30,7 +30,7 @@ if (UNIX)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
   if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -flto")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
   endif()
 endif()
 

+ 2 - 0
python/modules/py_igl_embree.cpp

@@ -7,6 +7,7 @@
 
 #include <igl/embree/ambient_occlusion.h>
 #include <igl/embree/reorient_facets_raycast.h>
+#include <igl/embree/line_mesh_intersection.h>
 
 
 void python_export_igl_embree(py::module &me) {
@@ -16,5 +17,6 @@ void python_export_igl_embree(py::module &me) {
 
   #include "../py_igl/embree/py_ambient_occlusion.cpp"
   #include "../py_igl/embree/py_reorient_facets_raycast.cpp"
+  #include "../py_igl/embree/py_line_mesh_intersection.cpp"
 
 }

+ 18 - 1
python/py_doc.cpp

@@ -215,7 +215,7 @@ const char *__doc_igl_copyleft_cgal_remesh_self_intersections = R"igl_Qu8mg5v7(/
       //     // remove any vertices now unreferenced after duplicate mapping.
       //     igl::remove_unreferenced(VV,FF,SV,SF,UIM);
       //     // Now (SV,SF) is ready to extract outer hull
-      //     igl::copyleft::cgal::outer_hull(SV,SF,G,J,flip);igl_Qu8mg5v7";
+      //     igl::copyleft::cgal::outer_hull(SV,SF,G,J,flip);)igl_Qu8mg5v7";
 const char *__doc_igl_copyleft_comiso_miq = R"igl_Qu8mg5v7(// Inputs:
     //   V              #V by 3 list of mesh vertex 3D positions
     //   F              #F by 3 list of faces indices in V
@@ -453,6 +453,23 @@ const char *__doc_igl_embree_reorient_facets_raycast = R"igl_Qu8mg5v7(// Orient
     // Outputs:
     //   I  #F list of whether face has been flipped
     //   C  #F list of patch ID (output of bfs_orient > manifold patches))igl_Qu8mg5v7";
+const char *__doc_igl_embree_line_mesh_intersection = R"igl_Qu8mg5v7(// Project the point cloud V_source onto the triangle mesh
+    // V_target,F_target. 
+    // A ray is casted for every vertex in the direction specified by 
+    // N_source and its opposite.
+    //
+    // Input:
+    // V_source: #Vx3 Vertices of the source mesh
+    // N_source: #Vx3 Normals of the point cloud
+    // V_target: #V2x3 Vertices of the target mesh
+    // F_target: #F2x3 Faces of the target mesh
+    //
+    // Output:
+    // #Vx3 matrix of baricentric coordinate. Each row corresponds to 
+    // a vertex of the projected mesh and it has the following format:
+    // id b1 b2. id is the id of a face of the source mesh. b1 and b2 are 
+    // the barycentric coordinates wrt the first two edges of the triangle
+    // To convert to standard global coordinates, see barycentric_to_global.h)igl_Qu8mg5v7";
 const char *__doc_igl_find_cross_field_singularities = R"igl_Qu8mg5v7(// Inputs:
   //   V                #V by 3 eigen Matrix of mesh vertex 3D positions
   //   F                #F by 3 eigen Matrix of face (quad) indices

+ 1 - 0
python/py_doc.h

@@ -31,6 +31,7 @@ extern const char *__doc_igl_edge_topology;
 extern const char *__doc_igl_eigs;
 extern const char *__doc_igl_embree_ambient_occlusion;
 extern const char *__doc_igl_embree_reorient_facets_raycast;
+extern const char *__doc_igl_embree_line_mesh_intersection;
 extern const char *__doc_igl_find_cross_field_singularities;
 extern const char *__doc_igl_fit_rotations;
 extern const char *__doc_igl_fit_rotations_planar;

+ 13 - 0
python/py_igl/embree/py_line_mesh_intersection.cpp

@@ -0,0 +1,13 @@
+
+
+m.def("line_mesh_intersection", []
+(
+  const Eigen::MatrixXd& V_source,
+  const Eigen::MatrixXd& N_source,
+  const Eigen::MatrixXd& V_target,
+  const Eigen::MatrixXi& F_target
+)
+{
+  return igl::embree::line_mesh_intersection(V_source, N_source, V_target, F_target);
+}, __doc_igl_embree_line_mesh_intersection,
+py::arg("V_source"), py::arg("N_source"), py::arg("V_target"), py::arg("F_target"));