python.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "python.h"
  2. #include <sstream>
  3. #include <string>
  4. #include <fstream>
  5. void assert_is_VectorXd(const std::string name, const Eigen::MatrixXd& v)
  6. {
  7. if (v.cols() != 1)
  8. throw std::runtime_error(name + " must be a column vector.");
  9. }
  10. void assert_is_RowVectorXd(const std::string name, const Eigen::MatrixXd& v)
  11. {
  12. if (v.rows() != 1)
  13. throw std::runtime_error(name + " must be a row vector.");
  14. }
  15. void assert_is_Vector3d(const std::string name, const Eigen::MatrixXd& v)
  16. {
  17. if ((v.cols() != 1) || (v.rows() != 3))
  18. throw std::runtime_error(name + " must be a column vector with 3 entries.");
  19. }
  20. void assert_is_RowVector3d(const std::string name, const Eigen::MatrixXd& v)
  21. {
  22. if ((v.cols() != 3) || (v.rows() != 1))
  23. throw std::runtime_error(name + " must be a row vector with 3 entries.");
  24. }
  25. extern void python_export_vector(py::module &);
  26. extern void python_export_igl(py::module &);
  27. extern void python_export_igl_viewer(py::module &);
  28. PYTHON_PLUGIN(igl) {
  29. py::init_threading();
  30. py::module m("igl", "Python wrappers for libigl");
  31. python_export_vector(m);
  32. python_export_igl(m);
  33. python_export_igl_viewer(m);
  34. return m.ptr();
  35. }