py_typedefs.cpp 1.3 KB

1234567891011121314151617181920212223242526
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Sebastian Koch <[email protected]> and Daniele Panozzo <[email protected]>
  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::class_<RotationList>(m, "RotationList")
  9. .def(py::init<>())
  10. .def(py::init<size_t>())
  11. .def("pop_back", &RotationList::pop_back)
  12. /* There are multiple versions of push_back(), etc. Select the right ones. */
  13. .def("append", (void (RotationList::*)(const Eigen::Quaterniond &)) &RotationList::push_back)
  14. .def("back", (Eigen::Quaterniond &(RotationList::*)()) &RotationList::back)
  15. .def("__len__", [](const RotationList &v) { return v.size(); })
  16. .def("__getitem__", [](const RotationList &v, int b) { return v.at(b); })
  17. .def("__setitem__", [](RotationList &v, int b, Eigen::Quaterniond &c) { return v.at(b) = c; })
  18. .def("__iter__", [](RotationList &v) {
  19. return py::make_iterator(v.begin(), v.end());
  20. }, py::keep_alive<0, 1>());
  21. py::bind_vector<std::vector<int>>(m, "VectorInt");
  22. py::bind_vector<std::vector<std::vector<int>>>(m, "VectorVectorInt");