Răsfoiți Sursa

add pyigl seam_edges


Former-commit-id: ea005c91e099adb1bfe9fa8cb87291b39c23fe8f
Zhongshi Jiang 7 ani în urmă
părinte
comite
e067d8d7b5
4 a modificat fișierele cu 54 adăugiri și 0 ștergeri
  1. 30 0
      python/py_doc.cpp
  2. 1 0
      python/py_doc.h
  3. 2 0
      python/py_igl.cpp
  4. 21 0
      python/py_igl/py_seam_edges.cpp

+ 30 - 0
python/py_doc.cpp

@@ -1470,3 +1470,33 @@ const char *__doc_igl_readPLY= R"igl_Qu8mg5v7(// Read a mesh from an ascii ply f
   //   N  double matrix of corner normals #N by 3
   //   UV #V by 2 texture coordinates
   // Returns true on success, false on errors)igl_Qu8mg5v7";
+const char *__doc_igl_seam_edges=R"igl_Qu8mg5v7(// Finds all UV-space boundaries of a mesh.
+  //
+  // Inputs:
+  //   V  #V by dim list of positions of the input mesh.
+  //   TC  #TC by 2 list of 2D texture coordinates of the input mesh
+  //   F  #F by 3 list of triange indices into V representing a
+  //     manifold-with-boundary triangle mesh
+  //   FTC  #F by 3 list of indices into TC for each corner
+  // Outputs:
+  //   seams  Edges where the forwards and backwards directions have different
+  //     texture coordinates, as a #seams-by-4 matrix of indices. Each row is
+  //     organized as [ forward_face_index, forward_face_vertex_index,
+  //     backwards_face_index, backwards_face_vertex_index ] such that one side
+  //     of the seam is the edge:
+  //         F[ seams( i, 0 ), seams( i, 1 ) ], F[ seams( i, 0 ), (seams( i, 1 ) + 1) % 3 ]
+  //     and the other side is the edge:
+  //         F[ seams( i, 2 ), seams( i, 3 ) ], F[ seams( i, 2 ), (seams( i, 3 ) + 1) % 3 ]
+  //   boundaries  Edges with only one incident triangle, as a #boundaries-by-2
+  //     matrix of indices. Each row is organized as 
+  //         [ face_index, face_vertex_index ]
+  //     such that the edge is:
+  //         F[ boundaries( i, 0 ), boundaries( i, 1 ) ], F[ boundaries( i, 0 ), (boundaries( i, 1 ) + 1) % 3 ]
+  //   foldovers  Edges where the two incident triangles fold over each other
+  //     in UV-space, as a #foldovers-by-4 matrix of indices.
+  //     Each row is organized as [ forward_face_index, forward_face_vertex_index,
+  //     backwards_face_index, backwards_face_vertex_index ]
+  //     such that one side of the foldover is the edge:
+  //       F[ foldovers( i, 0 ), foldovers( i, 1 ) ], F[ foldovers( i, 0 ), (foldovers( i, 1 ) + 1) % 3 ]
+  //     and the other side is the edge:
+  //       F[ foldovers( i, 2 ), foldovers( i, 3 ) ], F[ foldovers( i, 2 ), (foldovers( i, 3 ) + 1) % 3 ])igl_Qu8mg5v7";

+ 1 - 0
python/py_doc.h

@@ -127,3 +127,4 @@ extern const char *__doc_igl_writeMESH;
 extern const char *__doc_igl_writeOBJ;
 extern const char *__doc_igl_writePLY;
 extern const char *__doc_igl_readPLY;
+extern const char *__doc_igl_seam_edges;

+ 2 - 0
python/py_igl.cpp

@@ -103,6 +103,7 @@
 #include <igl/writeOBJ.h>
 #include <igl/writePLY.h>
 #include <igl/readPLY.h>
+#include <igl/seam_edges.h>
 
 void python_export_igl(py::module &m)
 {
@@ -201,4 +202,5 @@ void python_export_igl(py::module &m)
 #include "py_igl/py_writeOBJ.cpp"
 #include "py_igl/py_writePLY.cpp"
 #include "py_igl/py_readPLY.cpp"
+#include "py_igl/py_seam_edges.cpp"
 }

+ 21 - 0
python/py_igl/py_seam_edges.cpp

@@ -0,0 +1,21 @@
+m.def("seam_edges", []
+(
+  const Eigen::MatrixXd& V,
+  const Eigen::MatrixXd& TC,
+  const Eigen::MatrixXi& F,
+  const Eigen::MatrixXi& FTC,
+  Eigen::MatrixXi& seams,
+  Eigen::MatrixXi& boundaries,
+  Eigen::MatrixXi& foldovers
+)
+{
+return igl::seam_edges( V, TC, F, FTC, seams, boundaries, foldovers);
+}, __doc_igl_seam_edges,
+py::arg("V"),
+py::arg("TC"),
+py::arg("F"),
+py::arg("FTC"),
+py::arg("seams"),
+py::arg("boundaries"),
+py::arg("foldovers"));
+