feat(tdcgal/plane/plane.cpp): class Bbox_2

BREAKING CHANGE:
This commit is contained in:
songsenand 2024-03-11 22:33:04 +08:00
parent c703017487
commit 477658c5aa
1 changed files with 15 additions and 0 deletions

View File

@ -262,6 +262,21 @@ void init_plane(py::module_ &m) {
.def("area", &Iso_rectangle_2::area, "返回矩形的面积")
.def("transform", &Iso_rectangle_2::transform, "返回经过变换后的矩形");
py::class_<Bbox_2>(m, "Bbox_2")
.def(py::init<>())
.def(py::init<double, double, double, double>())
.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<Point_2, Point_2>,
"返回两个点的平方距离");