Commit 4f2f565c authored by Davis King's avatar Davis King

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

parent 81d57e72
...@@ -407,6 +407,9 @@ void bind_vector(py::module& m) ...@@ -407,6 +407,9 @@ void bind_vector(py::module& m)
.def("__str__", &point__str__) .def("__str__", &point__str__)
.def(py::self + py::self) .def(py::self + py::self)
.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("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("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.") .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) ...@@ -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_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 - 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>)); .def(py::pickle(&getstate<type>, &setstate<type>));
} }
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment