@@ -125,24 +125,36 @@ def test_oriented_bounding_box_numpy(coords, expected):
125125 assert TOL .is_allclose (result , expected_values )
126126
127127
128- def test_oriented_bounding_box_numpy_from_fixtures ():
128+ @pytest .fixture
129+ def bbox_points_00 ():
130+ return compas .json_load (os .path .join (HERE , "fixtures" , "bbox_points_00.json" ))
131+
132+
133+ @pytest .mark .parametrize (
134+ "points,expected" ,
135+ [
136+ [
137+ "bbox_points_00" ,
138+ [
139+ [- 16.324597659837302 , 17.160372549942966 , 3.56729 ],
140+ [- 16.324597659837302 , 17.160372549942966 , 2.45 ],
141+ [- 15.960798521686625 , 13.229144025284555 , 2.45 ],
142+ [- 15.960798521686625 , 13.229144025284555 , 3.56729 ],
143+ [- 18.2385089496689 , 16.983257616692406 , 3.56729 ],
144+ [- 18.2385089496689 , 16.983257616692406 , 2.45 ],
145+ [- 17.874709811518226 , 13.052029092033992 , 2.45 ],
146+ [- 17.874709811518226 , 13.052029092033992 , 3.56729 ],
147+ ],
148+ ],
149+ ],
150+ )
151+ def test_oriented_bounding_box_numpy_from_fixtures (points , expected , request ):
129152 if compas .IPY :
130153 return
131154
132- coords = compas .json_load (os .path .join (HERE , "fixtures" , "bbox_points_00.json" ))
133- expected = [
134- [- 16.324597659837302 , 17.160372549942966 , 3.56729 ],
135- [- 16.324597659837302 , 17.160372549942966 , 2.45 ],
136- [- 15.960798521686625 , 13.229144025284555 , 2.45 ],
137- [- 15.960798521686625 , 13.229144025284555 , 3.56729 ],
138- [- 18.2385089496689 , 16.983257616692406 , 3.56729 ],
139- [- 18.2385089496689 , 16.983257616692406 , 2.45 ],
140- [- 17.874709811518226 , 13.052029092033992 , 2.45 ],
141- [- 17.874709811518226 , 13.052029092033992 , 3.56729 ],
142- ]
143-
144155 from compas .geometry import oriented_bounding_box_numpy
145156
146- results = oriented_bounding_box_numpy (coords )
157+ points = request .getfixturevalue (points )
158+ results = oriented_bounding_box_numpy (points )
147159 for result , expected_values in zip (results , expected ):
148160 assert TOL .is_allclose (result , expected_values )
0 commit comments