MCPcopy
hub / github.com/pyg-team/pytorch_geometric / test_to_trimesh

Function test_to_trimesh

test/utils/test_convert.py:455–468  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

453
454@withPackage('trimesh')
455def 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')

Callers

nothing calls this directly

Calls 5

DataClass · 0.90
to_trimeshFunction · 0.90
tMethod · 0.80
tolistMethod · 0.45
contiguousMethod · 0.45

Tested by

no test coverage detected