File tree Expand file tree Collapse file tree 5 files changed +38
-1
lines changed
Expand file tree Collapse file tree 5 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ namespace diffCheck::geometry
7171 this ->Cvt2DFMesh (O3DTriangleMesh);
7272 }
7373
74+ std::vector<Eigen::Vector3d> DFMesh::GetTightBoundingBox ()
75+ {
76+ auto O3DTriangleMesh = this ->Cvt2O3DTriangleMesh ();
77+ open3d::geometry::OrientedBoundingBox tightOOBB = O3DTriangleMesh->GetMinimalOrientedBoundingBox ();
78+ std::vector<Eigen::Vector3d> bboxPts = tightOOBB.GetBoxPoints ();
79+ return bboxPts;
80+ }
81+
7482 void DFMesh::LoadFromPLY (const std::string &path)
7583 {
7684 std::shared_ptr<diffCheck::geometry::DFMesh> tempMesh_ptr = diffCheck::io::ReadPLYMeshFromFile (path);
Original file line number Diff line number Diff line change @@ -62,6 +62,15 @@ namespace diffCheck::geometry
6262 */
6363 void ApplyTransformation (const diffCheck::transformation::DFTransformation &transformation);
6464
65+ public: // /< Utils
66+ /* *
67+ * @brief Get the mesh tight bounding box
68+ *
69+ * @return std::vector<Eigen::Vector3d> A vector of two Eigen::Vector3d, with the first one being the minimum
70+ * point and the second one the maximum point of the bounding box.
71+ */
72+ std::vector<Eigen::Vector3d> GetTightBoundingBox ();
73+
6574 public: // /< I/O loader
6675 /* *
6776 * @brief Read a mesh from a file
Original file line number Diff line number Diff line change @@ -53,7 +53,15 @@ namespace diffCheck::geometry
5353 extremePoints.push_back (boundingBox.GetMinBound ());
5454 extremePoints.push_back (boundingBox.GetMaxBound ());
5555 return extremePoints;
56- }
56+ }
57+
58+ std::vector<Eigen::Vector3d> DFPointCloud::GetTightBoundingBox ()
59+ {
60+ open3d::geometry::OrientedBoundingBox tightOOBB = this ->Cvt2O3DPointCloud ()->GetMinimalOrientedBoundingBox ();
61+ std::vector<Eigen::Vector3d> bboxPts = tightOOBB.GetBoxPoints ();
62+ return bboxPts;
63+ }
64+
5765 void DFPointCloud::ApplyTransformation (const diffCheck::transformation::DFTransformation &transformation)
5866 {
5967 auto O3DPointCloud = this ->Cvt2O3DPointCloud ();
Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ namespace diffCheck::geometry
5858 */
5959 std::vector<Eigen::Vector3d> ComputeBoundingBox ();
6060
61+ /* *
62+ * @brief Get the tight bounding box of the point cloud
63+ *
64+ * @return std::vector<Eigen::Vector3d> A vector of two Eigen::Vector3d, with the first one being the minimum
65+ * point and the second one the maximum point of the bounding box.
66+ */
67+ std::vector<Eigen::Vector3d> GetTightBoundingBox ();
68+
6169 public: // /< Transformers
6270 /* *
6371 * @brief Apply a transformation to the point cloud
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ PYBIND11_MODULE(diffcheck_bindings, m) {
3434
3535 .def (" load_from_PLY" , &diffCheck::geometry::DFPointCloud::LoadFromPLY)
3636
37+ .def (" get_tight_bounding_box" , &diffCheck::geometry::DFPointCloud::GetTightBoundingBox)
38+
3739 .def (" get_num_points" , &diffCheck::geometry::DFPointCloud::GetNumPoints)
3840 .def (" get_num_colors" , &diffCheck::geometry::DFPointCloud::GetNumColors)
3941 .def (" get_num_normals" , &diffCheck::geometry::DFPointCloud::GetNumNormals)
@@ -60,6 +62,8 @@ PYBIND11_MODULE(diffcheck_bindings, m) {
6062
6163 .def (" sample_points_uniformly" , &diffCheck::geometry::DFMesh::SampleCloudUniform)
6264
65+ .def (" get_tight_bounding_box" , &diffCheck::geometry::DFMesh::GetTightBoundingBox)
66+
6367 .def (" get_num_vertices" , &diffCheck::geometry::DFMesh::GetNumVertices)
6468 .def (" get_num_faces" , &diffCheck::geometry::DFMesh::GetNumFaces)
6569
You can’t perform that action at this time.
0 commit comments