From 3426570903054f46ea85e87fa7f06a1867cde938 Mon Sep 17 00:00:00 2001 From: Davis King Date: Mon, 28 May 2018 18:53:22 -0400 Subject: [PATCH] More overloads for rectangle.contains() --- tools/python/src/rectangles.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/python/src/rectangles.cpp b/tools/python/src/rectangles.cpp index 7e45561d5..feae1e3c1 100644 --- a/tools/python/src/rectangles.cpp +++ b/tools/python/src/rectangles.cpp @@ -41,8 +41,8 @@ point center(const rect_type& r) { return center(r); } template point dcenter(const rect_type& r) { return dcenter(r); } -template -bool contains(const rect_type& r, const point& p) { return r.contains(p); } +template +bool contains(const rect_type& r, const ptype& p) { return r.contains(p); } template bool contains_xy(const rect_type& r, const long x, const long y) { return r.contains(point(x, y)); } @@ -113,7 +113,8 @@ void bind_rectangles(py::module& m) .def("is_empty", &::is_empty) .def("center", &::center) .def("dcenter", &::dcenter) - .def("contains", &::contains, py::arg("point")) + .def("contains", &::contains, py::arg("point")) + .def("contains", &::contains, py::arg("point")) .def("contains", &::contains_xy, py::arg("x"), py::arg("y")) .def("contains", &::contains_rec, py::arg("rectangle")) .def("intersect", &::intersect, py::arg("rectangle")) @@ -148,7 +149,8 @@ void bind_rectangles(py::module& m) .def("tr_corner", &type::tr_corner, "Returns the top right corner of the rectangle.") .def("bl_corner", &type::bl_corner, "Returns the bottom left corner of the rectangle.") .def("br_corner", &type::br_corner, "Returns the bottom right corner of the rectangle.") - .def("contains", &::contains, py::arg("point")) + .def("contains", &::contains, py::arg("point")) + .def("contains", &::contains, py::arg("point")) .def("contains", &::contains_xy, py::arg("x"), py::arg("y")) .def("contains", &::contains_rec, py::arg("rectangle")) .def("intersect", &::intersect, py::arg("rectangle"))