|
1 |
| - |
| 1 | +/** |
| 2 | + * @file AxisAlignedBoundingBox.h |
| 3 | + * @author Quoc-Minh Ton-That ([email protected]) |
| 4 | + * @brief Axis-aligned bounding box class |
| 5 | + * @version 0.1 |
| 6 | + * @date 2025-02-12 |
| 7 | + * |
| 8 | + * @copyright Copyright (c) 2025 |
| 9 | + * |
| 10 | + */ |
2 | 11 | #ifndef PBAT_GEOMETRY_AXISALIGNEDBOUNDINGBOX_H
|
3 | 12 | #define PBAT_GEOMETRY_AXISALIGNEDBOUNDINGBOX_H
|
4 | 13 |
|
|
13 | 22 | namespace pbat {
|
14 | 23 | namespace geometry {
|
15 | 24 |
|
| 25 | +/** |
| 26 | + * @brief Axis-aligned bounding box class |
| 27 | + * |
| 28 | + * @note This class is a thin wrapper around Eigen::AlignedBox |
| 29 | + * |
| 30 | + * @tparam Dims Number of dimensions |
| 31 | + */ |
16 | 32 | template <int Dims>
|
17 | 33 | class AxisAlignedBoundingBox : public Eigen::AlignedBox<Scalar, Dims>
|
18 | 34 | {
|
19 | 35 | public:
|
20 |
| - using BaseType = Eigen::AlignedBox<Scalar, Dims>; |
21 |
| - using SelfType = AxisAlignedBoundingBox; |
| 36 | + using BaseType = Eigen::AlignedBox<Scalar, Dims>; ///< Base type |
| 37 | + using SelfType = AxisAlignedBoundingBox; ///< Self type |
22 | 38 |
|
23 |
| - static auto constexpr kDims = Dims; |
| 39 | + static auto constexpr kDims = Dims; ///< Number of dimensions |
24 | 40 |
|
25 | 41 | AxisAlignedBoundingBox() = default;
|
26 | 42 |
|
| 43 | + /** |
| 44 | + * @brief Copy construct AxisAlignedBoundingBox from Eigen::AlignedBox |
| 45 | + * @param box Eigen::AlignedBox |
| 46 | + */ |
27 | 47 | AxisAlignedBoundingBox(BaseType const& box);
|
| 48 | + /** |
| 49 | + * @brief Move construct AxisAlignedBoundingBox from Eigen::AlignedBox |
| 50 | + * @param box Eigen::AlignedBox |
| 51 | + */ |
28 | 52 | AxisAlignedBoundingBox(BaseType&& box);
|
| 53 | + /** |
| 54 | + * @brief Copy assign AxisAlignedBoundingBox from Eigen::AlignedBox |
| 55 | + * @param box Eigen::AlignedBox |
| 56 | + * @return AxisAlignedBoundingBox& Reference to this |
| 57 | + */ |
29 | 58 | AxisAlignedBoundingBox& operator=(BaseType const& box);
|
| 59 | + /** |
| 60 | + * @brief Move assign AxisAlignedBoundingBox from Eigen::AlignedBox |
| 61 | + * @param box Eigen::AlignedBox |
| 62 | + * @return AxisAlignedBoundingBox& Reference to this |
| 63 | + */ |
30 | 64 | AxisAlignedBoundingBox& operator=(BaseType&& box);
|
31 |
| - |
| 65 | + /** |
| 66 | + * @brief Construct AxisAlignedBoundingBox from min and max endpoints |
| 67 | + * @tparam TDerivedMin Eigen dense expression type |
| 68 | + * @tparam TDerivedMax Eigen dense expression type |
| 69 | + * @param min Min endpoint |
| 70 | + * @param max Max endpoint |
| 71 | + * @pre `min.rows() == Dims` and `max.rows() == Dims` |
| 72 | + */ |
32 | 73 | template <class TDerivedMin, class TDerivedMax>
|
33 | 74 | AxisAlignedBoundingBox(
|
34 | 75 | Eigen::DenseBase<TDerivedMin> const& min,
|
35 | 76 | Eigen::DenseBase<TDerivedMax> const& max);
|
36 |
| - |
| 77 | + /** |
| 78 | + * @brief Construct AxisAlignedBoundingBox over a set of points |
| 79 | + * @tparam TDerived Eigen dense expression type |
| 80 | + * @param P Points |
| 81 | + * @pre `P.rows() == Dims` |
| 82 | + */ |
37 | 83 | template <class TDerived>
|
38 | 84 | AxisAlignedBoundingBox(Eigen::DenseBase<TDerived> const& P);
|
39 |
| - |
| 85 | + /** |
| 86 | + * @brief Get indices of points in P contained in the bounding box |
| 87 | + * @tparam TDerived Eigen dense expression type |
| 88 | + * @param P Points |
| 89 | + * @return std::vector<Index> Indices of points in P contained in the bounding box |
| 90 | + */ |
40 | 91 | template <class TDerived>
|
41 | 92 | std::vector<Index> contained(Eigen::MatrixBase<TDerived> const& P) const;
|
42 | 93 | };
|
|
0 commit comments