Skip to content

Commit 63ab712

Browse files
WIP-CI: test x 1
1 parent 44ffdaa commit 63ab712

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

tests/integration_tests/pybinds_tests/test_pybind_units.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def get_ply_cloud_roof_quarter_path():
2727
raise FileNotFoundError(f"PLY file not found at: {ply_file_path}")
2828
return ply_file_path
2929

30+
def get_ply_cloud_sphere_path():
31+
base_test_data_dir = os.getenv('DF_TEST_DATA_DIR', os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'test_data')))
32+
ply_file_path = os.path.join(base_test_data_dir, "sphere_5kpts_with_normals.ply")
33+
if not os.path.exists(ply_file_path):
34+
raise FileNotFoundError(f"PLY file not found at: {ply_file_path}")
35+
return ply_file_path
36+
3037
#------------------------------------------------------------------------------
3138
# dfb_geometry namespace
3239
#------------------------------------------------------------------------------
@@ -54,6 +61,12 @@ def create_DFPointCloudSampleRoof():
5461
df_pcd.load_from_PLY(get_ply_cloud_roof_quarter_path())
5562
yield df_pcd
5663

64+
@pytest.fixture
65+
def create_DFPointCloudSphere():
66+
df_pcd = dfb.dfb_geometry.DFPointCloud()
67+
df_pcd.load_from_PLY(get_ply_cloud_sphere_path())
68+
yield df_pcd
69+
5770
def test_DFPointCloud_properties(create_DFPointCloudSampleRoof):
5871
pc = create_DFPointCloudSampleRoof
5972
assert pc.points.__len__() == 7379, "DFPointCloud should have 7379 points"
@@ -134,8 +147,22 @@ def test_DFTransform_read_write(create_DFPointCloudSampleRoof):
134147
#------------------------------------------------------------------------------
135148
# dfb_registrations namespace
136149
#------------------------------------------------------------------------------
137-
# TODO: to be implemented
138-
150+
def test_DFRegistration_pure_translation(create_DFPointCloudSphere):
151+
pc = create_DFPointCloudSphere
152+
pc2 = create_DFPointCloudSphere
153+
t = dfb.dfb_transformation.DFTransformation()
154+
t.transformation_matrix = [[1.0, 0.0, 0.0, 20],
155+
[0.0, 1.0, 0.0, 20],
156+
[0.0, 0.0, 1.0, 20],
157+
[0.0, 0.0, 0.0, 1.0]]
158+
pc2.transform(t)
159+
160+
df_transformation_result = dfb.dfb_registrations.O3DFastGlobalRegistrationFeatureMatching(pc, pc2, 0.01, 100)
161+
assert df_transformation_result is not None, "DFRegistration should return a transformation matrix"
162+
assert abs(df_transformation_result[0][3] - 20) > 0.5, "The translation in x should be around 20"
163+
assert abs(df_transformation_result[1][3] - 20) > 0.5, "The translation in y should be around 20"
164+
assert abs(df_transformation_result[2][3] - 20) > 0.5, "The translation in z should be around 20"
165+
139166
#------------------------------------------------------------------------------
140167
# dfb_segmentation namespace
141168
#------------------------------------------------------------------------------
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:0374e977d8f8a23e99eb19682d1429a572b8a1f4db297d06afe8aeafdf389db9
3+
size 120891

0 commit comments

Comments
 (0)