Skip to content

Commit 155147b

Browse files
committed
adding meshgrid test
1 parent 38a7049 commit 155147b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/compas/topology/test_unify_cycles.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import math
12
import os
3+
import random
4+
25
import compas
6+
from compas.datastructures import Mesh
7+
from compas.tolerance import TOL
38
from compas.topology import unify_cycles
49

510
HERE = os.path.dirname(__file__)
@@ -13,3 +18,17 @@ def test_unify_cycles():
1318
faces = test_data["faces"]
1419
unify_cycles(vertices, faces)
1520
unify_cycles(vertices, faces, nmax=29, radius=22.4) # anything below won't work
21+
22+
23+
def test_face_adjacency():
24+
if compas.IPY:
25+
return
26+
for _ in range(10):
27+
nx = random.randint(5, 20)
28+
ny = random.randint(5, 20)
29+
dx = 10
30+
dy = 10
31+
mesh = Mesh.from_meshgrid(dx, nx, dy, ny)
32+
vertices, faces = mesh.to_vertices_and_faces()
33+
radius = math.sqrt((dx / nx) ** 2 + (dy / ny) ** 2) + TOL.absolute
34+
unify_cycles(vertices, faces, radius=radius)

0 commit comments

Comments
 (0)