()
| 453 | |
| 454 | @withPackage('trimesh') |
| 455 | def test_to_trimesh(): |
| 456 | import trimesh |
| 457 | |
| 458 | pos = torch.tensor([[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0]]) |
| 459 | face = torch.tensor([[0, 1, 2], [2, 1, 3]]).t() |
| 460 | data = Data(pos=pos, face=face) |
| 461 | |
| 462 | obj = to_trimesh(data) |
| 463 | |
| 464 | assert isinstance(obj, trimesh.Trimesh) |
| 465 | assert obj.vertices.shape == (4, 3) |
| 466 | assert obj.faces.shape == (2, 3) |
| 467 | assert obj.vertices.tolist() == data.pos.tolist() |
| 468 | assert obj.faces.tolist() == data.face.t().contiguous().tolist() |
| 469 | |
| 470 | |
| 471 | @withPackage('trimesh') |
nothing calls this directly
no test coverage detected