geometry_pybind.cpp
Go to the documentation of this file.
1 
2 
3 #include <pybind11/eigen.h>
4 #include <pybind11/stl_bind.h>
5 #include <pybind11/pybind11.h>
6 #include <pybind11/operators.h>
7 #include "gtsam/nonlinear/utilities.h" // for RedirectCout.
8 
10 #include "gtsam/geometry/Point3.h"
11 
12 #include "wrap/serialization.h"
13 #include <boost/serialization/export.hpp>
14 
17 
18 
19 
20 
21 using namespace std;
22 
23 namespace py = pybind11;
24 
25 PYBIND11_MODULE(geometry_py, m_) {
26  m_.doc() = "pybind11 wrapper of geometry_py";
27 
28  pybind11::module m_gtsam = m_.def_submodule("gtsam", "gtsam submodule");
29 
30  py::class_<gtsam::Point2, std::shared_ptr<gtsam::Point2>>(m_gtsam, "Point2")
31  .def(py::init<>())
32  .def(py::init<double, double>(), py::arg("x"), py::arg("y"))
33  .def("x",[](gtsam::Point2* self){return self->x();})
34  .def("y",[](gtsam::Point2* self){return self->y();})
35  .def("dim",[](gtsam::Point2* self){return self->dim();})
36  .def("returnChar",[](gtsam::Point2* self){return self->returnChar();})
37  .def("argChar",[](gtsam::Point2* self, char a){ self->argChar(a);}, py::arg("a"))
38  .def("argChar",[](gtsam::Point2* self, std::shared_ptr<char> a){ self->argChar(a);}, py::arg("a"))
39  .def("argChar",[](gtsam::Point2* self, char& a){ self->argChar(a);}, py::arg("a"))
40  .def("argChar",[](gtsam::Point2* self, char* a){ self->argChar(a);}, py::arg("a"))
41  .def("argChar",[](gtsam::Point2* self, const std::shared_ptr<char> a){ self->argChar(a);}, py::arg("a"))
42  .def("argChar",[](gtsam::Point2* self, const char& a){ self->argChar(a);}, py::arg("a"))
43  .def("argChar",[](gtsam::Point2* self, const char* a){ self->argChar(a);}, py::arg("a"))
44  .def("argUChar",[](gtsam::Point2* self, unsigned char a){ self->argUChar(a);}, py::arg("a"))
45  .def("eigenArguments",[](gtsam::Point2* self, const gtsam::Vector& v, const gtsam::Matrix& m){ self->eigenArguments(v, m);}, py::arg("v"), py::arg("m"))
46  .def("vectorConfusion",[](gtsam::Point2* self){return self->vectorConfusion();})
47  .def("serialize", [](gtsam::Point2* self){ return gtsam::serialize(*self); })
48  .def("deserialize", [](gtsam::Point2* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
49  .def(py::pickle(
50  [](const gtsam::Point2 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
51  [](py::tuple t){ /* __setstate__ */ gtsam::Point2 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }));
52 
53  py::class_<gtsam::Point3, std::shared_ptr<gtsam::Point3>>(m_gtsam, "Point3")
54  .def(py::init<double, double, double>(), py::arg("x"), py::arg("y"), py::arg("z"))
55  .def("norm",[](gtsam::Point3* self){return self->norm();})
56  .def("serialize", [](gtsam::Point3* self){ return gtsam::serialize(*self); })
57  .def("deserialize", [](gtsam::Point3* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
58  .def(py::pickle(
59  [](const gtsam::Point3 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
60  [](py::tuple t){ /* __setstate__ */ gtsam::Point3 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }))
61  .def_static("staticFunction",[](){return gtsam::Point3::staticFunction();})
62  .def_static("StaticFunctionRet",[](double z){return gtsam::Point3::StaticFunctionRet(z);}, py::arg("z"));
63 
64 
65 #include "python/specializations.h"
66 
67 }
68 
Matrix3f m
module_ module
Definition: pybind11.h:943
module_ def_submodule(const char *name, const char *doc=nullptr)
Definition: pybind11.h:903
std::string serialize(const T &input)
serializes to a string
Vector2 Point2
Definition: Point2.h:27
ArrayXcf v
Definition: Cwise_arg.cpp:1
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
Definition: Half.h:150
BOOST_CLASS_EXPORT(gtsam::noiseModel::Isotropic)
Array33i a
Eigen::VectorXd Vector
Definition: Vector.h:38
Tuple< Args... > make_tuple(Args...args)
Creates a tuple object, deducing the target type from the types of arguments.
detail::initimpl::pickle_factory< GetState, SetState > pickle(GetState &&g, SetState &&s)
Definition: pybind11.h:1479
PYBIND11_MODULE(geometry_py, m_)
traits
Definition: chartTesting.h:28
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
void deserialize(const std::string &serialized, T &output)
deserializes from a string
3D Point
Vector3 Point3
Definition: Point3.h:35
2D Point
Point2 t(10, 10)


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:08