(self)
| 70 | self.assertEqual(mesh.num_faces, mesh2.num_faces) |
| 71 | |
| 72 | def test_attributes(self): |
| 73 | mesh = pymesh.generate_icosphere(1.0, np.zeros(3), 2) |
| 74 | mesh.add_attribute("vertex_index") |
| 75 | mesh.add_attribute("vertex_normal") |
| 76 | mesh.add_attribute("face_index") |
| 77 | mesh.add_attribute("face_normal") |
| 78 | data = pymesh.compress(mesh) |
| 79 | mesh2 = pymesh.decompress(data) |
| 80 | |
| 81 | self.assertEqual(mesh.num_vertices, mesh2.num_vertices) |
| 82 | self.assertEqual(mesh.num_faces, mesh2.num_faces) |
| 83 | self.assert_array_almost_equal(mesh.bbox, mesh2.bbox) |
| 84 | self.assertTrue(mesh2.has_attribute("vertex_index")) |
| 85 | self.assertTrue(mesh2.has_attribute("vertex_normal")) |
| 86 | #self.assertTrue(mesh2.has_attribute("face_index")) |
| 87 | #self.assertTrue(mesh2.has_attribute("face_normal")) |
| 88 | |
| 89 | vertex_index_map = mesh2.get_attribute("vertex_index").ravel().astype(int) |
| 90 | out_vertices = mesh2.vertices |
| 91 | in_vertices = mesh.vertices[vertex_index_map] |
| 92 | self.assert_array_equal(in_vertices, out_vertices) |
| 93 | |
| 94 | #face_index_map = mesh2.get_attribute("face_index").ravel().astype(int) |
| 95 | #self.assertEqual(mesh.num_faces, len(face_index_map)) |
| 96 |
nothing calls this directly
no test coverage detected