py_signed_distance.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. py::enum_<igl::SignedDistanceType>(m, "SignedDistanceType")
  9. .value("SIGNED_DISTANCE_TYPE_PSEUDONORMAL", igl::SIGNED_DISTANCE_TYPE_PSEUDONORMAL)
  10. .value("SIGNED_DISTANCE_TYPE_WINDING_NUMBER", igl::SIGNED_DISTANCE_TYPE_WINDING_NUMBER)
  11. .value("SIGNED_DISTANCE_TYPE_DEFAULT", igl::SIGNED_DISTANCE_TYPE_DEFAULT)
  12. .value("SIGNED_DISTANCE_TYPE_UNSIGNED", igl::SIGNED_DISTANCE_TYPE_UNSIGNED)
  13. .value("NUM_SIGNED_DISTANCE_TYPE", igl::NUM_SIGNED_DISTANCE_TYPE)
  14. .export_values();
  15. m.def("signed_distance", []
  16. (
  17. const Eigen::MatrixXd& P,
  18. const Eigen::MatrixXd& V,
  19. const Eigen::MatrixXi& F,
  20. const igl::SignedDistanceType sign_type,
  21. Eigen::MatrixXd& S,
  22. Eigen::MatrixXi& I,
  23. Eigen::MatrixXd& C,
  24. Eigen::MatrixXd& N
  25. )
  26. {
  27. Eigen::VectorXd Sv;
  28. Eigen::VectorXi Iv;
  29. igl::signed_distance(P, V, F, sign_type, Sv, Iv, C, N);
  30. S = Sv;
  31. I = Iv;
  32. }, __doc_igl_signed_distance,
  33. py::arg("P"), py::arg("V"), py::arg("F"), py::arg("sign_type"), py::arg("S"), py::arg("I"), py::arg("C"), py::arg("N"));
  34. //m.def("signed_distance_pseudonormal", []
  35. //(
  36. // const AABB<Eigen::MatrixXd, 3> & tree,
  37. // const Eigen::MatrixXd& V,
  38. // const Eigen::MatrixXi& F,
  39. // const Eigen::MatrixXd& FN,
  40. // const Eigen::MatrixXd& VN,
  41. // const Eigen::MatrixXd& EN,
  42. // const Eigen::MatrixXi& EMAP,
  43. // const Eigen::MatrixXd& q
  44. //)
  45. //{
  46. // assert_is_VectorX("q", q);
  47. // assert_is_VectorX("EMAP",EMAP);
  48. // return igl::signed_distance_pseudonormal(tree, V, F, FN, VN, EN, EMAP, q);
  49. //}, __doc_igl_signed_distance_pseudonormal,
  50. //py::arg("tree"), py::arg("V"), py::arg("F"), py::arg("FN"), py::arg("VN"), py::arg("EN"), py::arg("EMAP"), py::arg("q"));
  51. m.def("signed_distance_pseudonormal", []
  52. (
  53. const Eigen::MatrixXd& P,
  54. const Eigen::MatrixXd& V,
  55. const Eigen::MatrixXi& F,
  56. const igl::AABB<Eigen::MatrixXd, 3> & tree,
  57. const Eigen::MatrixXd& FN,
  58. const Eigen::MatrixXd& VN,
  59. const Eigen::MatrixXd& EN,
  60. const Eigen::MatrixXi& EMAP,
  61. Eigen::MatrixXd& S,
  62. Eigen::MatrixXi& I,
  63. Eigen::MatrixXd& C,
  64. Eigen::MatrixXd& N
  65. )
  66. {
  67. assert_is_VectorX("EMAP", EMAP);
  68. Eigen::VectorXi EMAPv;
  69. if (EMAP.size() != 0)
  70. EMAPv = EMAP;
  71. Eigen::VectorXd Sv;
  72. Eigen::VectorXi Iv;
  73. igl::signed_distance_pseudonormal(P, V, F, tree, FN, VN, EN, EMAPv, Sv, Iv, C, N);
  74. S = Sv;
  75. I = Iv;
  76. }, __doc_igl_signed_distance_pseudonormal,
  77. py::arg("P"), py::arg("V"), py::arg("F"), py::arg("tree"), py::arg("FN"), py::arg("VN"), py::arg("EN"), py::arg("EMAP"), py::arg("S"), py::arg("I"), py::arg("C"), py::arg("N"));
  78. //m.def("signed_distance_pseudonormal", []
  79. //(
  80. // const AABB<Eigen::MatrixXd, 3> & tree,
  81. // const Eigen::MatrixXd& V,
  82. // const Eigen::MatrixXi& F,
  83. // const Eigen::MatrixXd& FN,
  84. // const Eigen::MatrixXd& VN,
  85. // const Eigen::MatrixXd& EN,
  86. // const Eigen::MatrixXi & EMAP,
  87. // const Eigen::MatrixXd & q,
  88. // double & s,
  89. // double & sqrd,
  90. // int & i,
  91. // Eigen::MatrixXd & c,
  92. // Eigen::MatrixXd & n
  93. //)
  94. //{
  95. // assert_is_VectorX("EMAP",EMAP);
  96. // assert_is_VectorX("q",q);
  97. // return igl::signed_distance_pseudonormal(tree, V, F, FN, VN, EN, EMAP, q, s, sqrd, i, c, n);
  98. //}, __doc_igl_signed_distance_pseudonormal,
  99. //py::arg("tree"), py::arg("V"), py::arg("F"), py::arg("FN"), py::arg("VN"), py::arg("EN"), py::arg("EMAP"), py::arg("q"), py::arg("s"), py::arg("sqrd"), py::arg("i"), py::arg("c"), py::arg("n"));
  100. //m.def("signed_distance_pseudonormal", []
  101. //(
  102. // const AABB<Eigen::MatrixXd, 2> & tree,
  103. // const Eigen::MatrixXd& V,
  104. // const Eigen::MatrixXi& F,
  105. // const Eigen::MatrixXd& FN,
  106. // const Eigen::MatrixXd& VN,
  107. // const Eigen::MatrixXd & q,
  108. // double & s,
  109. // double & sqrd,
  110. // int & i,
  111. // Eigen::MatrixXd & c,
  112. // Eigen::MatrixXd & n
  113. //)
  114. //{
  115. // assert_is_VectorX("q",q);
  116. // return igl::signed_distance_pseudonormal(tree, V, F, FN, VN, q, s, sqrd, i, c, n);
  117. //}, __doc_igl_signed_distance_pseudonormal,
  118. //py::arg("tree"), py::arg("V"), py::arg("F"), py::arg("FN"), py::arg("VN"), py::arg("q"), py::arg("s"), py::arg("sqrd"), py::arg("i"), py::arg("c"), py::arg("n"));
  119. //m.def("signed_distance_winding_number", []
  120. //(
  121. // AABB<Eigen::MatrixXd, 3> & tree,
  122. // const Eigen::MatrixXd& V,
  123. // const Eigen::MatrixXi& F,
  124. // igl::WindingNumberAABB<Eigen::Vector3d> & hier,
  125. // Eigen::RowVector3d & q
  126. //)
  127. //{
  128. // return igl::signed_distance_winding_number(tree, V, F, hier, q);
  129. //}, __doc_igl_signed_distance_winding_number,
  130. //py::arg("tree"), py::arg("V"), py::arg("F"), py::arg("hier"), py::arg("q"));