Skip to content

Commit

Permalink
updated FPS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek47kashyap committed Nov 30, 2024
1 parent cdc00cb commit 9f7627d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
12 changes: 8 additions & 4 deletions cpp/tests/geometry/PointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,14 +876,18 @@ TEST(PointCloud, FarthestPointDownSample) {
{1.0, 0, 1.0},
{0, 1.0, 1.0},
{1.0, 1.0, 1.5}});
std::vector<Eigen::Vector3d> expected = {
{0, 2.0, 0}, {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}};
std::shared_ptr<geometry::PointCloud> pcd_down =
pcd.FarthestPointDownSample(4);
std::vector<Eigen::Vector3d> expected = {
{0, 2.0, 0}, {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}};

std::shared_ptr<geometry::PointCloud> pcd_down_2 =
pcd.FarthestPointDownSample(4, 0);
pcd.FarthestPointDownSample(4, 4);
std::vector<Eigen::Vector3d> expected_2 = {
{0, 2.0, 0}, {1.0, 1.0, 0}, {0, 0, 1.0}, {1.0, 1.0, 1.5}};

ExpectEQ(pcd_down->points_, expected);
ExpectEQ(pcd_down_2->points_, expected);
ExpectEQ(pcd_down_2->points_, expected_2);
}

TEST(PointCloud, Crop_AxisAlignedBoundingBox) {
Expand Down
10 changes: 7 additions & 3 deletions cpp/tests/t/geometry/PointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,12 +955,16 @@ TEST_P(PointCloudPermuteDevices, FarthestPointDownSample) {
{1.0, 1.0, 1.5}},
device));

auto pcd_small_down = pcd_small.FarthestPointDownSample(4);
auto expected = core::Tensor::Init<float>(
{{0, 2.0, 0}, {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}}, device);
auto pcd_small_down = pcd_small.FarthestPointDownSample(4);
auto pcd_small_down_2 = pcd_small.FarthestPointDownSample(4, 0);

auto pcd_small_down_2 = pcd_small.FarthestPointDownSample(4, 4);
auto expected_2 = core::Tensor::Init<float>(
{{0, 2.0, 0}, {1.0, 1.0, 0}, {0, 0, 1.0}, {1.0, 1.0, 1.5}}, device);

EXPECT_TRUE(pcd_small_down.GetPointPositions().AllClose(expected));
EXPECT_TRUE(pcd_small_down_2.GetPointPositions().AllClose(expected));
EXPECT_TRUE(pcd_small_down_2.GetPointPositions().AllClose(expected_2));
}

TEST_P(PointCloudPermuteDevices, RemoveRadiusOutliers) {
Expand Down

0 comments on commit 9f7627d

Please sign in to comment.