mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added operator + support for dlib.rectangle.
This commit is contained in:
parent
4e01b7790b
commit
1c26be904c
@ -68,6 +68,30 @@ string print_rectangle_repr(const rect_type& r)
|
||||
return sout.str();
|
||||
}
|
||||
|
||||
rectangle add_point_to_rect(const rectangle& r, const point& p)
|
||||
{
|
||||
return r + p;
|
||||
}
|
||||
|
||||
rectangle add_rect_to_rect(const rectangle& r, const rectangle& p)
|
||||
{
|
||||
return r + p;
|
||||
}
|
||||
|
||||
rectangle& iadd_point_to_rect(rectangle& r, const point& p)
|
||||
{
|
||||
r += p;
|
||||
return r;
|
||||
}
|
||||
|
||||
rectangle& iadd_rect_to_rect(rectangle& r, const rectangle& p)
|
||||
{
|
||||
r += p;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
void bind_rectangles(py::module& m)
|
||||
@ -92,6 +116,10 @@ void bind_rectangles(py::module& m)
|
||||
.def("intersect", &::intersect<type>, py::arg("rectangle"))
|
||||
.def("__str__", &::print_rectangle_str<type>)
|
||||
.def("__repr__", &::print_rectangle_repr<type>)
|
||||
.def("__add__", &::add_point_to_rect)
|
||||
.def("__add__", &::add_rect_to_rect)
|
||||
.def("__iadd__", &::iadd_point_to_rect)
|
||||
.def("__iadd__", &::iadd_rect_to_rect)
|
||||
.def(py::self == py::self)
|
||||
.def(py::self != py::self)
|
||||
.def(py::pickle(&getstate<type>, &setstate<type>));
|
||||
|
Loading…
Reference in New Issue
Block a user