py_igl.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #include <Eigen/Dense>
  2. #include "python.h"
  3. #include <igl/readOFF.h>
  4. #include <igl/writeOBJ.h>
  5. #include <igl/per_face_normals.h>
  6. void python_export_igl(py::module &m) {
  7. // readOFF.h
  8. m.def("readOFF", []
  9. (
  10. const std::string str,
  11. Eigen::MatrixXd& V,
  12. Eigen::MatrixXi& F
  13. )
  14. {
  15. return igl::readOFF(str,V,F);
  16. }, __doc_readOFF,
  17. py::arg("str"), py::arg("V"), py::arg("F"));
  18. m.def("readOFF", []
  19. (
  20. const std::string str,
  21. Eigen::MatrixXd& V,
  22. Eigen::MatrixXi& F,
  23. Eigen::MatrixXd& N
  24. )
  25. {
  26. return igl::readOFF(str,V,F,N);
  27. }, __doc_readOFF,
  28. py::arg("str"), py::arg("V"), py::arg("F"), py::arg("N"));
  29. // writeOBJ.h
  30. m.def("writeOBJ", []
  31. (
  32. const std::string str,
  33. const Eigen::MatrixXd& V,
  34. const Eigen::MatrixXi& F,
  35. const Eigen::MatrixXd& CN,
  36. const Eigen::MatrixXi& FN,
  37. const Eigen::MatrixXd& TC,
  38. const Eigen::MatrixXi& FTC
  39. )
  40. {
  41. return igl::writeOBJ(str,V,F,CN,FN,TC,FTC);
  42. }, __doc_writeOBJ,
  43. py::arg("str"), py::arg("V"), py::arg("F"), py::arg("CN"), py::arg("FN"), py::arg("TC"), py::arg("FTC"));
  44. m.def("writeOBJ", []
  45. (
  46. const std::string str,
  47. const Eigen::MatrixXd& V,
  48. const Eigen::MatrixXi& F
  49. )
  50. {
  51. return igl::writeOBJ(str,V,F);
  52. }, __doc_writeOBJ,
  53. py::arg("str"), py::arg("V"), py::arg("F"));
  54. // per_face_normals
  55. m.def("per_face_normals", []
  56. (
  57. const Eigen::MatrixXd& V,
  58. const Eigen::MatrixXi& F,
  59. const Eigen::VectorXd& Z,
  60. Eigen::MatrixXd& N
  61. )
  62. {
  63. return igl::per_face_normals(V,F,Z,N);
  64. }, __doc_per_face_normals,
  65. py::arg("V"), py::arg("F"), py::arg("Z"), py::arg("N"));
  66. m.def("per_face_normals", []
  67. (
  68. const Eigen::MatrixXd& V,
  69. const Eigen::MatrixXi& F,
  70. Eigen::MatrixXd& N
  71. )
  72. {
  73. return igl::per_face_normals(V,F,N);
  74. }, __doc_per_face_normals,
  75. py::arg("V"), py::arg("F"), py::arg("N"));
  76. m.def("per_face_normals_stable", []
  77. (
  78. const Eigen::MatrixXd& V,
  79. const Eigen::MatrixXi& F,
  80. Eigen::MatrixXd& N
  81. )
  82. {
  83. return igl::per_face_normals_stable(V,F,N);
  84. }, __doc_per_face_normals,
  85. py::arg("V"), py::arg("F"), py::arg("N"));
  86. }