Skip to content

Commit 61b6fc1

Browse files
ADD: bounding box member for DFPointCloud class
1 parent a48aa4d commit 61b6fc1

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/diffCheck/geometry/DFPointCloud.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ namespace diffCheck::geometry
4545
return distances;
4646
}
4747

48+
std::vector<Eigen::Vector3d> DFPointCloud::ComputeBoundingBox()
49+
{
50+
auto O3DPointCloud = this->Cvt2O3DPointCloud();
51+
auto boundingBox = O3DPointCloud->GetAxisAlignedBoundingBox();
52+
std::vector<Eigen::Vector3d> extremePoints;
53+
extremePoints.push_back(boundingBox.GetMinBound());
54+
extremePoints.push_back(boundingBox.GetMaxBound());
55+
this->BoundingBox = extremePoints;
56+
return extremePoints;
57+
}
4858
void DFPointCloud::ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation)
4959
{
5060
auto O3DPointCloud = this->Cvt2O3DPointCloud();

src/diffCheck/geometry/DFPointCloud.hh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ namespace diffCheck::geometry
4444
*/
4545
std::vector<double> ComputeP2PDistance(std::shared_ptr<geometry::DFPointCloud> target);
4646

47+
/**
48+
* @brief Compute the bounding box of the point cloud and stores it as member of the DFPointCloud object
49+
*
50+
* @return std::vector<Eigen::Vector3d> A vector of two Eigen::Vector3d, with the first one being the minimum point and the second one the maximum point of the bounding box.
51+
*/
52+
std::vector<Eigen::Vector3d> ComputeBoundingBox();
53+
4754
public: ///< Transformers
4855
/**
4956
* @brief Apply a transformation to the point cloud
@@ -75,5 +82,7 @@ namespace diffCheck::geometry
7582
std::vector<Eigen::Vector3d> Colors;
7683
/// @brief Eigen vector of 3D normals
7784
std::vector<Eigen::Vector3d> Normals;
85+
/// @brief Eigen vector of two 3D vectors forming the bounnding box.
86+
std::vector<Eigen::Vector3d> BoundingBox;
7887
};
7988
} // namespace diffCheck::geometry

0 commit comments

Comments
 (0)