From 9ae3e39c666980ba00dd998443d5bee42616e3fe Mon Sep 17 00:00:00 2001 From: Sameer Sheorey Date: Wed, 27 Sep 2023 14:21:01 -0700 Subject: [PATCH] Style fix. --- cpp/open3d/geometry/PointCloud.cpp | 16 ++++++++-------- cpp/open3d/geometry/PointCloud.h | 6 ++++-- cpp/pybind/geometry/pointcloud.cpp | 2 +- cpp/tests/geometry/PointCloud.cpp | 25 +++++++++---------------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/cpp/open3d/geometry/PointCloud.cpp b/cpp/open3d/geometry/PointCloud.cpp index 7ac0442a04f..b0b6e0130ae 100644 --- a/cpp/open3d/geometry/PointCloud.cpp +++ b/cpp/open3d/geometry/PointCloud.cpp @@ -541,25 +541,25 @@ std::shared_ptr PointCloud::FarthestPointDownSample( return SelectByIndex(selected_indices); } -std::shared_ptr PointCloud::Crop( - const AxisAlignedBoundingBox &bbox, - bool invert) const { +std::shared_ptr PointCloud::Crop(const AxisAlignedBoundingBox &bbox, + bool invert) const { if (bbox.IsEmpty()) { utility::LogError( "AxisAlignedBoundingBox either has zeros size, or has wrong " "bounds."); } - return SelectByIndex(bbox.GetPointIndicesWithinBoundingBox(points_),invert); + return SelectByIndex(bbox.GetPointIndicesWithinBoundingBox(points_), + invert); } -std::shared_ptr PointCloud::Crop( - const OrientedBoundingBox &bbox, - bool invert) const { +std::shared_ptr PointCloud::Crop(const OrientedBoundingBox &bbox, + bool invert) const { if (bbox.IsEmpty()) { utility::LogError( "AxisAlignedBoundingBox either has zeros size, or has wrong " "bounds."); } - return SelectByIndex(bbox.GetPointIndicesWithinBoundingBox(points_),invert); + return SelectByIndex(bbox.GetPointIndicesWithinBoundingBox(points_), + invert); } std::tuple, std::vector> diff --git a/cpp/open3d/geometry/PointCloud.h b/cpp/open3d/geometry/PointCloud.h index d42753e118e..334bdc9f0f5 100644 --- a/cpp/open3d/geometry/PointCloud.h +++ b/cpp/open3d/geometry/PointCloud.h @@ -186,7 +186,8 @@ class PointCloud : public Geometry3D { /// /// \param bbox AxisAlignedBoundingBox to crop points. /// \param invert Optional boolean to invert cropping. - std::shared_ptr Crop(const AxisAlignedBoundingBox &bbox, bool invert=false) const; + std::shared_ptr Crop(const AxisAlignedBoundingBox &bbox, + bool invert = false) const; /// \brief Function to crop pointcloud into output pointcloud /// @@ -195,7 +196,8 @@ class PointCloud : public Geometry3D { /// /// \param bbox OrientedBoundingBox to crop points. /// \param invert Optional boolean to invert cropping. - std::shared_ptr Crop(const OrientedBoundingBox &bbox, bool invert=false) const; + std::shared_ptr Crop(const OrientedBoundingBox &bbox, + bool invert = false) const; /// \brief Function to remove points that have less than \p nb_points in a /// sphere of a given radius. diff --git a/cpp/pybind/geometry/pointcloud.cpp b/cpp/pybind/geometry/pointcloud.cpp index 304c1c59c08..835ec3123b1 100644 --- a/cpp/pybind/geometry/pointcloud.cpp +++ b/cpp/pybind/geometry/pointcloud.cpp @@ -290,7 +290,7 @@ camera. Given depth value d at (u, v) image coordinate, the corresponding 3d poi docstring::ClassMethodDocInject( m, "PointCloud", "crop", {{"bounding_box", "AxisAlignedBoundingBox to crop points"}, - {"invert", "optional boolean to invert cropping"}}); + {"invert", "optional boolean to invert cropping"}}); docstring::ClassMethodDocInject( m, "PointCloud", "remove_non_finite_points", {{"remove_nan", "Remove NaN values from the PointCloud"}, diff --git a/cpp/tests/geometry/PointCloud.cpp b/cpp/tests/geometry/PointCloud.cpp index 06888f06eb0..21bfe5659bf 100644 --- a/cpp/tests/geometry/PointCloud.cpp +++ b/cpp/tests/geometry/PointCloud.cpp @@ -1003,22 +1003,15 @@ TEST(PointCloud, Crop_AxisAlignedBoundingBox_Invert) { 5.0 * Eigen::Matrix3d::Identity(), }; std::shared_ptr pc_crop = pcd.Crop(aabb, true); - ExpectEQ(pc_crop->points_, std::vector({ - {3, 1, 1}, - {-1, 1, 1} - })); - ExpectEQ(pc_crop->normals_, std::vector({ - {4, 0, 0}, - {5, 0, 0} - })); - ExpectEQ(pc_crop->colors_, std::vector({ - {0.4, 0.0, 0.0}, - {0.5, 0.0, 0.0} - })); - ExpectEQ(pc_crop->covariances_, std::vector({ - 4.0 * Eigen::Matrix3d::Identity(), - 5.0 * Eigen::Matrix3d::Identity() - })); + ExpectEQ(pc_crop->points_, + std::vector({{3, 1, 1}, {-1, 1, 1}})); + ExpectEQ(pc_crop->normals_, + std::vector({{4, 0, 0}, {5, 0, 0}})); + ExpectEQ(pc_crop->colors_, + std::vector({{0.4, 0.0, 0.0}, {0.5, 0.0, 0.0}})); + ExpectEQ(pc_crop->covariances_, + std::vector({4.0 * Eigen::Matrix3d::Identity(), + 5.0 * Eigen::Matrix3d::Identity()})); } TEST(PointCloud, EstimateNormals) {