ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccBBox.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <pybind11/pybind11.h>
9 #include <pybind11/stl.h>
10 #include <pybind11/stl_bind.h>
11 
12 #include <ecvBBox.h>
13 #include <ecvGLMatrix.h>
14 
15 namespace py = pybind11;
16 using namespace pybind11::literals;
17 
18 void define_ccBBox(py::module &m)
19 {
20  py::class_<ccBBox, ccHObject, cloudViewer::BoundingBox>(m, "ccBBox")
21  .def(py::init<>())
22  .def(py::init<const CCVector3 &, const CCVector3 &, const std::string &>(),
23  "bbMinCorner"_a,
24  "bbMaxCorner"_a,
25  "name"_a = "ccBBox")
26  .def(
27  "__mul__", [](ccBBox &self, ccGLMatrix &mat) { return self * mat; }, py::is_operator())
28  .def(
29  "__mul__", [](ccBBox &self, ccGLMatrixd &mat) { return self * mat; }, py::is_operator())
30  // Expose both draw overloads: one with default color, one with custom color
31  .def("draw",
32  static_cast<void (ccBBox::*)(CC_DRAW_CONTEXT &)>(&ccBBox::draw),
33  "Draw bounding box using default color from context",
34  "context"_a)
35  .def("draw",
36  static_cast<void (ccBBox::*)(CC_DRAW_CONTEXT &, const ecvColor::Rgb &)>(&ccBBox::draw),
37  "Draw bounding box with custom color",
38  "context"_a,
39  "col"_a);
40 }
void define_ccBBox(py::module &m)
Definition: ccBBox.cpp:18
Bounding box structure.
Definition: ecvBBox.h:25
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
Double version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:56
RGB color structure.
Definition: ecvColorTypes.h:49
Display context.