ソースを参照

Python binding for exact_geodesic


Former-commit-id: 84d078222e447158464c6353e62c97ab87cf9de0
Zhongshi Jiang 7 年 前
コミット
16b6a3008c
4 ファイル変更44 行追加0 行削除
  1. 17 0
      python/py_doc.cpp
  2. 1 0
      python/py_doc.h
  3. 2 0
      python/py_igl.cpp
  4. 24 0
      python/py_igl/py_exact_geodesic.cpp

+ 17 - 0
python/py_doc.cpp

@@ -598,6 +598,23 @@ const char *__doc_igl_embree_reorient_facets_raycast = R"igl_Qu8mg5v7(// Orient
     // Outputs:
     // Outputs:
     //   I  #F list of whether face has been flipped
     //   I  #F list of whether face has been flipped
     //   C  #F list of patch ID (output of bfs_orient > manifold patches))igl_Qu8mg5v7";
     //   C  #F list of patch ID (output of bfs_orient > manifold patches))igl_Qu8mg5v7";
+const char *__doc_igl_geodesic_exact_geodesic = R"igl_Qu8mg5v7( 
+    // Exact geodesic algorithm for triangular mesh with the implementation from https://code.google.com/archive/p/geodesic/,  
+    // and the algorithm first described by Mitchell, Mount and Papadimitriou in 1987 
+    //  
+    // Inputs: 
+    //   V  #V by 3 list of 3D vertex positions 
+    //   F  #F by 3 list of mesh faces 
+    //   VS #VS by 1 vector specifying indices of source vertices 
+    //   FS #FS by 1 vector specifying indices of source faces 
+    //   VT #VT by 1 vector specifying indices of target vertices 
+    //   FT #FT by 1 vector specifying indices of target faces 
+    // Output: 
+    //   D  #VT+#FT by 1 vector of geodesic distances of each target w.r.t. the nearest one in the source set 
+    // 
+    // Note:  
+    //      Specifying a face as target/source means its center.  
+    //)igl_Qu8mg5v7";
 const char *__doc_igl_find_cross_field_singularities = R"igl_Qu8mg5v7(// Inputs:
 const char *__doc_igl_find_cross_field_singularities = R"igl_Qu8mg5v7(// Inputs:
   //   V                #V by 3 eigen Matrix of mesh vertex 3D positions
   //   V                #V by 3 eigen Matrix of mesh vertex 3D positions
   //   F                #F by 3 eigen Matrix of face (quad) indices
   //   F                #F by 3 eigen Matrix of face (quad) indices

+ 1 - 0
python/py_doc.h

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

+ 2 - 0
python/py_igl.cpp

@@ -44,6 +44,7 @@
 #include <igl/edge_lengths.h>
 #include <igl/edge_lengths.h>
 #include <igl/edge_topology.h>
 #include <igl/edge_topology.h>
 #include <igl/eigs.h>
 #include <igl/eigs.h>
+#include <igl/exact_geodesic.h>
 #include <igl/find_cross_field_singularities.h>
 #include <igl/find_cross_field_singularities.h>
 #include <igl/fit_rotations.h>
 #include <igl/fit_rotations.h>
 #include <igl/floor.h>
 #include <igl/floor.h>
@@ -141,6 +142,7 @@ void python_export_igl(py::module &m)
 #include "py_igl/py_edge_lengths.cpp"
 #include "py_igl/py_edge_lengths.cpp"
 #include "py_igl/py_edge_topology.cpp"
 #include "py_igl/py_edge_topology.cpp"
 #include "py_igl/py_eigs.cpp"
 #include "py_igl/py_eigs.cpp"
+#include "py_igl/py_exact_geodesic.cpp"
 #include "py_igl/py_find_cross_field_singularities.cpp"
 #include "py_igl/py_find_cross_field_singularities.cpp"
 #include "py_igl/py_fit_rotations.cpp"
 #include "py_igl/py_fit_rotations.cpp"
 #include "py_igl/py_floor.cpp"
 #include "py_igl/py_floor.cpp"

+ 24 - 0
python/py_igl/py_exact_geodesic.cpp

@@ -0,0 +1,24 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2018 Zhongshi Jiang <jiangzs@nyu.edu>
+//
+// 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("exact_geodesic", []
+(
+    const Eigen::MatrixXd &V,
+    const Eigen::MatrixXi &F,
+    const Eigen::MatrixXi &VS,
+    const Eigen::MatrixXi &FS,
+    const Eigen::MatrixXi &VT,
+    const Eigen::MatrixXi &FT,
+    Eigen::MatrixXd &D
+)
+{
+  return igl::exact_geodesic(V, F, VS,FS,VT,FT, D);
+}, __doc_igl_exact_geodesic,
+py::arg("V"), py::arg("F"), py::arg("VS"), py::arg("FS"), py::arg("VT"), py::arg("FT"), py::arg("D"));
+