mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added more operators for dpoint and point in the Pyhton API.
This commit is contained in:
parent
81d57e72c0
commit
4f2f565cb8
@ -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>));
|
||||
}
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user