diff --git a/tdcgal/plane/plane.cpp b/tdcgal/plane/plane.cpp index 7d2e1cb..5910fd0 100644 --- a/tdcgal/plane/plane.cpp +++ b/tdcgal/plane/plane.cpp @@ -262,6 +262,21 @@ void init_plane(py::module_ &m) { .def("area", &Iso_rectangle_2::area, "返回矩形的面积") .def("transform", &Iso_rectangle_2::transform, "返回经过变换后的矩形"); + py::class_(m, "Bbox_2") + .def(py::init<>()) + .def(py::init()) + .def(py::self == py::self) + .def(py::self != py::self) + .def("dimension", &Bbox_2::dimension, "返回边界框的维数") + .def("xmin", &Bbox_2::xmin, "返回左下角顶点的x坐标") + .def("ymin", &Bbox_2::ymin, "返回左下角顶点的y坐标") + .def("xmax", &Bbox_2::xmax, "返回右上角顶点的x坐标") + .def("ymax", &Bbox_2::ymax, "返回右上角顶点的y坐标") + .def("min", &Bbox_2::min, "参数`i`, 如果`i=0`返回`xmin()`, 如果`i=1`返回`ymin()`") + .def("max", &Bbox_2::max, "参数`i`, 如果`i=0`返回`xmax()`, 如果`i=1`返回`ymax()`") + .def(py::self + py::self) + .def(py::self += py::self) + .def("dilate", &Bbox_2::dilate, "扩大边界框"); m.def("squared_distance", &squared_distance, "返回两个点的平方距离");