24 std::shared_ptr<cloudViewer::OrientedBoundingBox>>
25 oriented_bounding_box_base(m,
"OrientedBoundingBox",
26 "The base OrientedBoundingBox class.");
27 py::detail::bind_default_constructor<cloudViewer::OrientedBoundingBox>(
28 oriented_bounding_box_base);
29 py::detail::bind_copy_functions<cloudViewer::OrientedBoundingBox>(
30 oriented_bounding_box_base);
31 oriented_bounding_box_base
32 .def(py::init<
const Eigen::Vector3d &,
const Eigen::Matrix3d &,
33 const Eigen::Vector3d &>(),
34 "Create OrientedBoundingBox from center, rotation R and "
36 "in x, y and z direction",
37 "center"_a,
"R"_a,
"extent"_a)
40 return std::string(
"OrientedBoundingBox");
43 "Returns the volume of the bounding box.")
45 "Get the extent/length of the bounding box in x, y, and z "
47 "in its frame of reference")
48 .def(
"get_half_extent",
50 "Returns the half extent of the bounding box in its frame of "
52 .def(
"get_max_extent",
54 "Returns the max extent of the bounding box in its frame of "
57 "``float64`` array of shape ``(3, )``",
"color"_a)
59 "``float64`` array of shape ``(3, )``")
61 "``float64`` array of shape ``(3, )``")
62 .def(
"get_box_points",
64 "Returns the eight points that define the bounding box.")
66 "Returns the eight points that define the bounding box.")
68 "Clear all elements in the geometry..")
69 .def(
"get_point_indices_within_bounding_box",
70 py::overload_cast<
const std::vector<Eigen::Vector3d> &>(
72 GetPointIndicesWithinBoundingBox,
74 "Return indices to points that are within the bounding box.",
77 "create_from_axis_aligned_bounding_box",
79 CreateFromAxisAlignedBoundingBox,
80 "Returns an oriented bounding box from the BoundingBox.",
83 "``float64`` array of shape ``(3, )``")
85 "``float64`` array of shape ``(3,3 )``")
87 "``float64`` array of shape ``(3, )``")
89 "``float64`` array of shape ``(3, )``");
103 "get_point_indices_within_bounding_box",
104 {{
"points",
"A list of points."}});
106 m,
"OrientedBoundingBox",
"create_from_axis_aligned_bounding_box",
108 "BoundingBox object from which OrientedBoundingBox is "
111 py::class_<ecvOrientedBBox, PyGeometry<ecvOrientedBBox>,
112 std::shared_ptr<ecvOrientedBBox>,
ccHObject,
114 oriented_bounding_box(m,
"ecvOrientedBBox",
115 "Class that defines an oriented box that can "
116 "be computed from 3D geometries.");
117 py::detail::bind_default_constructor<ecvOrientedBBox>(
118 oriented_bounding_box);
119 py::detail::bind_copy_functions<ecvOrientedBBox>(oriented_bounding_box);
120 oriented_bounding_box
121 .def(py::init<
const Eigen::Vector3d &,
const Eigen::Matrix3d &,
122 const Eigen::Vector3d &,
const std::string &>(),
123 "Create ecvOrientedBBox from center, rotation R and extent "
126 "center"_a,
"R"_a,
"extent"_a,
"name"_a =
"ecvOrientedBBox")
132 s <<
"ecvOrientedBBox: center: (" << c.x() <<
", " << c.y()
133 <<
", " << c.z() <<
"), extent: " << e.x() <<
", "
134 << e.y() <<
", " << e.z() <<
")";
138 "create_from_points",
139 py::overload_cast<
const std::vector<Eigen::Vector3d> &>(
141 "Creates the bounding box that encloses the set of points.",
143 .def_static(
"create_from_axis_aligned_bounding_box",
145 "Returns an oriented bounding box from the ccBBox.",
149 {{
"points",
"A list of points."}});
151 m,
"ecvOrientedBBox",
"create_from_axis_aligned_bounding_box",
153 "BoundingBox object from which OrientedBoundingBox is "
157 std::shared_ptr<cloudViewer::BoundingBox>>
158 axis_bounding_box_base(m,
"BoundingBox",
159 "Class that defines an axis_aligned box "
160 "that can be computed from 3D "
161 "geometries, The axis aligned bounding "
162 "box uses the coordinate axes for "
163 "bounding box generation.");
164 py::detail::bind_default_constructor<cloudViewer::BoundingBox>(
165 axis_bounding_box_base);
166 py::detail::bind_copy_functions<cloudViewer::BoundingBox>(
167 axis_bounding_box_base);
168 axis_bounding_box_base
169 .def(py::init<const Eigen::Vector3d &, const Eigen::Vector3d &>(),
170 "Create an BoundingBox from min bounds and max "
171 "bounds in x, y and z",
172 "bbMinCorner"_a,
"bbMaxCorner"_a)
175 return std::string(
"BoundingBox");
178 "Resets the bounding box.")
180 "``float64`` array of shape ``(3, )``",
"color"_a)
182 "``float64`` array of shape ``(3, )``")
184 "Returns whether bounding box is valid or not")
186 "Sets bonding box validity.",
"state"_a)
188 "Returns the bounding box volume.")
190 "'Enlarges' the bounding box with a point.",
"point"_a)
192 "Returns x Percentage.",
"x"_a)
194 "Returns y Percentage.",
"y"_a)
196 "Returns z Percentage.",
"z"_a)
198 "Returns diagonal length (double precision)")
200 "Returns minimal box dimension")
202 "Returns maximal box dimension")
204 "Returns the bounding-box volume")
206 "Returns the bounding-box bounds",
"bounds"_a)
208 "Computes min gap (absolute distance) between this "
209 "bounding-box and another one; return min gap (>=0) "
210 "or -1 if at least one of the box is not valid",
213 "Returns whether a points is inside the box or not",
"point"_a)
214 .def(
"get_point_indices_within_boundingbox",
215 py::overload_cast<
const std::vector<Eigen::Vector3d> &>(
217 GetPointIndicesWithinBoundingBox,
219 "Returns point indices Within bounding box.",
"points"_a);
238 "get_point_indices_within_boundingbox",
239 {{
"points",
"A list of points."}});
241 m,
"BoundingBox",
"get_bounds",
242 {{
"bounds",
"the output bounds with six double values."}});
244 py::class_<ccBBox, PyGeometry<ccBBox>, std::shared_ptr<ccBBox>,
ccHObject,
246 axis_aligned_bounding_box(m,
"ccBBox",
247 "Class that defines an axis_aligned box "
248 "that can be computed from 3D "
249 "geometries, The axis aligned bounding "
250 "box uses the coordinate axes for "
251 "bounding box generation.");
252 py::detail::bind_default_constructor<ccBBox>(axis_aligned_bounding_box);
253 py::detail::bind_copy_functions<ccBBox>(axis_aligned_bounding_box);
254 axis_aligned_bounding_box
255 .def(py::init<
const Eigen::Vector3d &,
const Eigen::Vector3d &,
256 const std::string &>(),
257 "Create an ccBBox from min bounds and max "
258 "bounds in x, y and z",
259 "min_bound"_a,
"max_bound"_a,
"name"_a =
"ccBBox")
263 auto mn = box.GetMinBound();
264 auto mx = box.GetMaxBound();
265 s <<
"ccBBox: min: (" << mn.x() <<
", " << mn.y() <<
", "
266 << mn.z() <<
"), max: (" << mx.x() <<
", " << mx.y()
267 <<
", " << mx.z() <<
")";
270 .def(py::self += py::self)
271 .def(py::self += Eigen::Vector3d())
272 .def(py::self -= Eigen::Vector3d())
273 .def(py::self *=
double())
274 .def(py::self *=
float())
275 .def(py::self *= Eigen::Matrix3d())
277 "Returns the eight points that define the bounding box.")
279 "Get the extent/length of the bounding box in x, y, and z "
282 "Returns the half extent of the bounding box.")
284 "Returns the maximum extent, i.e. the maximum of X, Y and Z "
287 "``float64`` array of shape ``(3, )``",
"minBound"_a)
289 "``float64`` array of shape ``(3, )``",
"maxBound"_a)
291 "Returns the 3D dimensions of the bounding box in string "
294 "create_from_points",
295 py::overload_cast<
const std::vector<Eigen::Vector3d> &>(
297 "Creates the bounding box that encloses the set of points.",
305 m,
"ccBBox",
"set_min_bound",
306 {{
"minBound",
"The minimum corner coordinate."}});
308 m,
"ccBBox",
"set_max_bound",
309 {{
"maxBound",
"The maximum corner coordinate."}});
311 {{
"points",
"A list of points."}});
PointCoordinateType GetMaxExtent() const
void SetMinBounds(const Eigen::Vector3d &minBound)
Eigen::Vector3d GetExtent() const
Get the extent/length of the bounding box in x, y, and z dimension.
std::string GetPrintInfo() const
Returns the 3D dimensions of the bounding box in string format.
Eigen::Vector3d GetHalfExtent() const
Returns the half extent of the bounding box.
static ccBBox CreateFromPoints(const std::vector< CCVector3 > &points)
void SetMaxBounds(const Eigen::Vector3d &maxBound)
std::vector< Eigen::Vector3d > GetBoxPoints() const
Returns the eight points that define the bounding box.
Hierarchical CLOUDVIEWER Object.
double getDiagNormd() const
Returns diagonal length (double precision)
double getZPercentage(double z) const
Eigen::Vector3d GetColor() const
Gets the bounding box color.
PointCoordinateType minDistTo(const BoundingBoxTpl< PointCoordinateType > &bbox) const
PointCoordinateType getMinBoxDim() const
Returns minimal box dimension.
void setValidity(bool state)
Sets bonding box validity.
double computeVolume() const
Returns the bounding-box volume.
void getBounds(double bounds[6]) const
PointCoordinateType getMaxBoxDim() const
Returns maximal box dimension.
void clear()
Resets the bounding box.
bool containsEigen(const Eigen::Vector3d &point) const
double getXPercentage(double x) const
void addEigen(const Eigen::Vector3d &point)
void SetColor(const Eigen::Vector3d &color)
Sets the bounding box color.
bool isValid() const
Returns whether bounding box is valid or not.
double getYPercentage(double y) const
A bounding box oriented along an arbitrary frame of reference.
OrientedBoundingBox & Clear()
Eigen::Vector3d color_
The color of the bounding box in RGB.
Eigen::Vector3d GetHalfExtent() const
Returns the half extent of the bounding box in its frame of reference.
Eigen::Vector3d extent_
The extent of the bounding box in its frame of reference.
const Eigen::Vector3d & GetExtent() const
std::vector< Eigen::Vector3d > GetBoxPoints() const
double volume() const
Returns the volume of the bounding box.
Eigen::Vector3d center_
The center point of the bounding box.
const Eigen::Vector3d & GetColor() const
Gets the bounding box color.
double GetMaxExtent() const
Returns the max extent of the bounding box in its frame of reference.
void SetColor(const Eigen::Vector3d &color)
Sets the bounding box color.
static ecvOrientedBBox CreateFromPoints(const std::vector< Eigen::Vector3d > &points)
static ecvOrientedBBox CreateFromAxisAlignedBoundingBox(const ccBBox &aabox)
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
::ecvOrientedBBox OrientedBoundingBox
void pybind_boundingvolume(py::module &m)
Generic file read and write utility for python interface.
BoundingBoxTpl< PointCoordinateType > BoundingBox
Default bounding-box type.