@@ -53,94 +53,94 @@ def test_DFPointCloud_init():
5353 pc = dfb .dfb_geometry .DFPointCloud (points , normals , colors )
5454 assert pc is not None , "DFPointCloud should be initialized successfully"
5555
56- def test_DFPointCloud_load_from_PLY ():
57- pc = dfb .dfb_geometry .DFPointCloud ()
58- pc .load_from_PLY (get_ply_cloud_roof_quarter_path ())
56+ # def test_DFPointCloud_load_from_PLY():
57+ # pc = dfb.dfb_geometry.DFPointCloud()
58+ # pc.load_from_PLY(get_ply_cloud_roof_quarter_path())
5959
60- assert pc .points .__len__ () == 7379 , "DFPointCloud should have 7379 points"
61- assert pc .normals .__len__ () == 7379 , "DFPointCloud should have 7379 normals"
62- assert pc .colors .__len__ () == 7379 , "DFPointCloud should have 7379 colors"
63-
64- @pytest .fixture
65- def create_DFPointCloudSampleRoof ():
66- df_pcd = dfb .dfb_geometry .DFPointCloud ()
67- df_pcd .load_from_PLY (get_ply_cloud_roof_quarter_path ())
68- yield df_pcd
69-
70- def test_DFPointCloud_properties (create_DFPointCloudSampleRoof ):
71- pc = create_DFPointCloudSampleRoof
72- assert pc .points .__len__ () == 7379 , "DFPointCloud should have 7379 points"
73- assert pc .normals .__len__ () == 7379 , "DFPointCloud should have 7379 normals"
74- assert pc .colors .__len__ () == 7379 , "DFPointCloud should have 7379 colors"
75-
76- assert pc .get_num_points () == 7379 , "get_num_points() should return 7379"
77- assert pc .get_num_normals () == 7379 , "get_num_normals() should return 7379"
78- assert pc .get_num_colors () == 7379 , "get_num_colors() should return 7379"
79-
80- assert pc .has_points () == True , "has_points() should return True"
81- assert pc .has_colors () == True , "has_colors() should return True"
82- assert pc .has_normals () == True , "has_normals() should return True"
83-
84- pc .points = []
85- pc .normals = []
86- pc .colors = []
87- assert pc .has_points () == False , "has_points() should return False"
88- assert pc .has_colors () == False , "has_colors() should return False"
89- assert pc .has_normals () == False , "has_normals() should return False"
90-
91- def test_DFPointCloud_apply_color (create_DFPointCloudSampleRoof ):
92- pc = create_DFPointCloudSampleRoof
93- pc .apply_color (255 , 0 , 0 )
94- for color in pc .colors :
95- assert (color [0 ] == 1 and color [1 ] == 0 and color [2 ] == 0 ), "All colors should be (255, 0, 0)"
96-
97- def test_DFPointCloud_voxel_func (create_DFPointCloudSampleRoof ):
98- pc = create_DFPointCloudSampleRoof
99- pc .voxel_downsample (0.01 )
100- assert pc .points .__len__ () == 7256 , "DFPointCloud should have 7256 points"
101- pc .uniform_downsample (3 )
102- assert pc .points .__len__ () == 2419 , "DFPointCloud should have 2419 points"
103- pc .downsample_by_size (1000 )
104- assert pc .points .__len__ () == 1000 , "DFPointCloud should have 1000 points"
105-
106- def test_DFPointCloud_compute_normals (create_DFPointCloudSampleRoof ):
107- pc = create_DFPointCloudSampleRoof
108- pc .normals .clear ()
109- pc .estimate_normals ()
110- assert pc .normals .__len__ () == 7379 , "DFPointCloud should have 7379 normals"
111-
112- def test_DFPointCloud_get_tight_bounding_box (create_DFPointCloudSampleRoof ):
113- pc = create_DFPointCloudSampleRoof
114- obb = pc .get_tight_bounding_box ()
115- assert obb [0 ][0 ] == 0.1955558282162114 , "The min x of the OBB should be 0.1955558282162114"
116-
117- # TODO: to implement DFMesh tests
118- def test_DFMesh_init ():
119- pass
120-
121- #------------------------------------------------------------------------------
122- # dfb_transformation namespace
123- #------------------------------------------------------------------------------
124-
125- def test_DFTransform_init ():
126- t = dfb .dfb_transformation .DFTransformation ()
127- assert t is not None , "DFTransformation should be initialized successfully"
128-
129- def test_DFTransform_read_write (create_DFPointCloudSampleRoof ):
130- pc = create_DFPointCloudSampleRoof
131- t = dfb .dfb_transformation .DFTransformation ()
132-
133- matrix = t .transformation_matrix
134- print (matrix )
135- assert matrix is not None , "Transformation matrix should be initialized"
136-
137- matrix_identity = [[1.0 , 0.0 , 0.0 , 0.0 ],
138- [0.0 , 1.0 , 0.0 , 0.0 ],
139- [0.0 , 0.0 , 1.0 , 0.0 ],
140- [0.0 , 0.0 , 0.0 , 1.0 ]]
141-
142- t .transformation_matrix = matrix_identity
143- assert (t .transformation_matrix == matrix_identity ).all (), "Transformation matrix should be set to identity"
60+ # assert pc.points.__len__() == 7379, "DFPointCloud should have 7379 points"
61+ # assert pc.normals.__len__() == 7379, "DFPointCloud should have 7379 normals"
62+ # assert pc.colors.__len__() == 7379, "DFPointCloud should have 7379 colors"
63+
64+ # @pytest.fixture
65+ # def create_DFPointCloudSampleRoof():
66+ # df_pcd = dfb.dfb_geometry.DFPointCloud()
67+ # df_pcd.load_from_PLY(get_ply_cloud_roof_quarter_path())
68+ # yield df_pcd
69+
70+ # def test_DFPointCloud_properties(create_DFPointCloudSampleRoof):
71+ # pc = create_DFPointCloudSampleRoof
72+ # assert pc.points.__len__() == 7379, "DFPointCloud should have 7379 points"
73+ # assert pc.normals.__len__() == 7379, "DFPointCloud should have 7379 normals"
74+ # assert pc.colors.__len__() == 7379, "DFPointCloud should have 7379 colors"
75+
76+ # assert pc.get_num_points() == 7379, "get_num_points() should return 7379"
77+ # assert pc.get_num_normals() == 7379, "get_num_normals() should return 7379"
78+ # assert pc.get_num_colors() == 7379, "get_num_colors() should return 7379"
79+
80+ # assert pc.has_points() == True, "has_points() should return True"
81+ # assert pc.has_colors() == True, "has_colors() should return True"
82+ # assert pc.has_normals() == True, "has_normals() should return True"
83+
84+ # pc.points = []
85+ # pc.normals = []
86+ # pc.colors = []
87+ # assert pc.has_points() == False, "has_points() should return False"
88+ # assert pc.has_colors() == False, "has_colors() should return False"
89+ # assert pc.has_normals() == False, "has_normals() should return False"
90+
91+ # def test_DFPointCloud_apply_color(create_DFPointCloudSampleRoof):
92+ # pc = create_DFPointCloudSampleRoof
93+ # pc.apply_color(255, 0, 0)
94+ # for color in pc.colors:
95+ # assert (color[0] == 1 and color[1] == 0 and color[2] == 0), "All colors should be (255, 0, 0)"
96+
97+ # def test_DFPointCloud_voxel_func(create_DFPointCloudSampleRoof):
98+ # pc = create_DFPointCloudSampleRoof
99+ # pc.voxel_downsample(0.01)
100+ # assert pc.points.__len__() == 7256, "DFPointCloud should have 7256 points"
101+ # pc.uniform_downsample(3)
102+ # assert pc.points.__len__() == 2419, "DFPointCloud should have 2419 points"
103+ # pc.downsample_by_size(1000)
104+ # assert pc.points.__len__() == 1000, "DFPointCloud should have 1000 points"
105+
106+ # def test_DFPointCloud_compute_normals(create_DFPointCloudSampleRoof):
107+ # pc = create_DFPointCloudSampleRoof
108+ # pc.normals.clear()
109+ # pc.estimate_normals()
110+ # assert pc.normals.__len__() == 7379, "DFPointCloud should have 7379 normals"
111+
112+ # def test_DFPointCloud_get_tight_bounding_box(create_DFPointCloudSampleRoof):
113+ # pc = create_DFPointCloudSampleRoof
114+ # obb = pc.get_tight_bounding_box()
115+ # assert obb[0][0] == 0.1955558282162114, "The min x of the OBB should be 0.1955558282162114"
116+
117+ # # TODO: to implement DFMesh tests
118+ # def test_DFMesh_init():
119+ # pass
120+
121+ # # ------------------------------------------------------------------------------
122+ # # dfb_transformation namespace
123+ # # ------------------------------------------------------------------------------
124+
125+ # def test_DFTransform_init():
126+ # t = dfb.dfb_transformation.DFTransformation()
127+ # assert t is not None, "DFTransformation should be initialized successfully"
128+
129+ # def test_DFTransform_read_write(create_DFPointCloudSampleRoof):
130+ # pc = create_DFPointCloudSampleRoof
131+ # t = dfb.dfb_transformation.DFTransformation()
132+
133+ # matrix = t.transformation_matrix
134+ # print(matrix)
135+ # assert matrix is not None, "Transformation matrix should be initialized"
136+
137+ # matrix_identity = [[1.0, 0.0, 0.0, 0.0],
138+ # [0.0, 1.0, 0.0, 0.0],
139+ # [0.0, 0.0, 1.0, 0.0],
140+ # [0.0, 0.0, 0.0, 1.0]]
141+
142+ # t.transformation_matrix = matrix_identity
143+ # assert (t.transformation_matrix == matrix_identity).all(), "Transformation matrix should be set to identity"
144144
145145
146146#------------------------------------------------------------------------------
0 commit comments