Skip to content

Commit

Permalink
test: add basic chunking test
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Nov 6, 2024
1 parent 723c725 commit 2e38ceb
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,41 @@ def test_chunk_shape():
m.is_empty() for m in meshes.values()
])

def test_chunk_mesh_triangle():
vertices = [
[0,0,0],
[0,1,0],
[1,0,0],
]
faces = [[0,1,2]]

mesh = zmesh.Mesh(vertices=vertices, faces=faces, normals=None)

meshes = zmesh.chunk_mesh(mesh, [.5,.5,.5])

meshes = [ m for m in meshes.values() if not m.is_empty() ]

assert len(meshes) == 3

m = zmesh.Mesh.concatenate(*meshes).consolidate()

assert m.vertices.shape[0] == 6

assert [0,0,0] in m.vertices
assert [1,0,0] in m.vertices
assert [0,1,0] in m.vertices
assert [0,0.5,0] in m.vertices
assert [0.5,0,0] in m.vertices
assert [0.5,0.5,0] in m.vertices












0 comments on commit 2e38ceb

Please sign in to comment.