Skip to content

Commit

Permalink
Style fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Sep 27, 2023
1 parent 1be10fe commit 9ae3e39
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
16 changes: 8 additions & 8 deletions cpp/open3d/geometry/PointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,25 +541,25 @@ std::shared_ptr<PointCloud> PointCloud::FarthestPointDownSample(
return SelectByIndex(selected_indices);
}

std::shared_ptr<PointCloud> PointCloud::Crop(
const AxisAlignedBoundingBox &bbox,
bool invert) const {
std::shared_ptr<PointCloud> 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> PointCloud::Crop(
const OrientedBoundingBox &bbox,
bool invert) const {
std::shared_ptr<PointCloud> 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::shared_ptr<PointCloud>, std::vector<size_t>>
Expand Down
6 changes: 4 additions & 2 deletions cpp/open3d/geometry/PointCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ class PointCloud : public Geometry3D {
///
/// \param bbox AxisAlignedBoundingBox to crop points.
/// \param invert Optional boolean to invert cropping.
std::shared_ptr<PointCloud> Crop(const AxisAlignedBoundingBox &bbox, bool invert=false) const;
std::shared_ptr<PointCloud> Crop(const AxisAlignedBoundingBox &bbox,
bool invert = false) const;

/// \brief Function to crop pointcloud into output pointcloud
///
Expand All @@ -195,7 +196,8 @@ class PointCloud : public Geometry3D {
///
/// \param bbox OrientedBoundingBox to crop points.
/// \param invert Optional boolean to invert cropping.
std::shared_ptr<PointCloud> Crop(const OrientedBoundingBox &bbox, bool invert=false) const;
std::shared_ptr<PointCloud> 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.
Expand Down
2 changes: 1 addition & 1 deletion cpp/pybind/geometry/pointcloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
25 changes: 9 additions & 16 deletions cpp/tests/geometry/PointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,22 +1003,15 @@ TEST(PointCloud, Crop_AxisAlignedBoundingBox_Invert) {
5.0 * Eigen::Matrix3d::Identity(),
};
std::shared_ptr<geometry::PointCloud> pc_crop = pcd.Crop(aabb, true);
ExpectEQ(pc_crop->points_, std::vector<Eigen::Vector3d>({
{3, 1, 1},
{-1, 1, 1}
}));
ExpectEQ(pc_crop->normals_, std::vector<Eigen::Vector3d>({
{4, 0, 0},
{5, 0, 0}
}));
ExpectEQ(pc_crop->colors_, std::vector<Eigen::Vector3d>({
{0.4, 0.0, 0.0},
{0.5, 0.0, 0.0}
}));
ExpectEQ(pc_crop->covariances_, std::vector<Eigen::Matrix3d>({
4.0 * Eigen::Matrix3d::Identity(),
5.0 * Eigen::Matrix3d::Identity()
}));
ExpectEQ(pc_crop->points_,
std::vector<Eigen::Vector3d>({{3, 1, 1}, {-1, 1, 1}}));
ExpectEQ(pc_crop->normals_,
std::vector<Eigen::Vector3d>({{4, 0, 0}, {5, 0, 0}}));
ExpectEQ(pc_crop->colors_,
std::vector<Eigen::Vector3d>({{0.4, 0.0, 0.0}, {0.5, 0.0, 0.0}}));
ExpectEQ(pc_crop->covariances_,
std::vector<Eigen::Matrix3d>({4.0 * Eigen::Matrix3d::Identity(),
5.0 * Eigen::Matrix3d::Identity()}));
}

TEST(PointCloud, EstimateNormals) {
Expand Down

0 comments on commit 9ae3e39

Please sign in to comment.