Added more operators for dpoint and point in the Pyhton API.

This commit is contained in:
Davis King 2018-05-28 18:53:02 -04:00
parent 81d57e72c0
commit 4f2f565cb8

View File

@ -407,6 +407,9 @@ void bind_vector(py::module& m)
.def("__str__", &point__str__)
.def(py::self + py::self)
.def(py::self - py::self)
.def(py::self / double())
.def(py::self * double())
.def(double() * py::self)
.def("normalize", &type::normalize, "Returns a unit normalized copy of this vector.")
.def_property("x", &point_x, [](point& p, long x){p.x()=x;}, "The x-coordinate of the point.")
.def_property("y", &point_y, [](point& p, long y){p.x()=y;}, "The y-coordinate of the point.")
@ -436,6 +439,9 @@ void bind_vector(py::module& m)
.def_property("y", &dpoint_y, [](dpoint& p, double y){p.x()=y;}, "The y-coordinate of the dpoint.")
.def(py::self + py::self)
.def(py::self - py::self)
.def(py::self / double())
.def(py::self * double())
.def(double() * py::self)
.def(py::pickle(&getstate<type>, &setstate<type>));
}
{