Skip to content

Commit 98b139a

Browse files
author
pv
committed
FIX update test_mapping without tessagon.
1 parent 4dffac5 commit 98b139a

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

tests/test_mapping.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import compas
22
import compas_libigl as igl
3+
import numpy as np
34
from compas.datastructures import Mesh
4-
from tessagon.adaptors.list_adaptor import ListAdaptor
5-
from tessagon.types.hex_tessagon import HexTessagon
65

76

87
def test_map_mesh():
@@ -11,21 +10,34 @@ def test_map_mesh():
1110
mesh.quads_to_triangles() # Ensure we have a triangle mesh
1211
v, f = mesh.to_vertices_and_faces()
1312

14-
# Create simple pattern mesh
15-
options = {
16-
"function": lambda u, v: [u, v, 0],
17-
"u_range": [0, 1.0],
18-
"v_range": [0, 1.0],
19-
"u_num": 4, # Small number for fast test
20-
"v_num": 3, # Small number for fast test
21-
"u_cyclic": False,
22-
"v_cyclic": False,
23-
"adaptor_class": ListAdaptor,
24-
}
25-
tessagon = HexTessagon(**options)
26-
tessagon_mesh = tessagon.create_mesh()
27-
pv = tessagon_mesh["vert_list"]
28-
pf = tessagon_mesh["face_list"]
13+
# Create simple pattern mesh manually (grid pattern)
14+
# Use a smaller UV range to ensure pattern falls within target's parameterization
15+
u_num, v_num = 5, 5
16+
# Use a smaller central region of the UV space
17+
u_range = [0.2, 0.8] # Avoid edges of UV space
18+
v_range = [0.2, 0.8] # Avoid edges of UV space
19+
20+
# Generate grid vertices
21+
pv = []
22+
for j in range(v_num + 1):
23+
v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num
24+
for i in range(u_num + 1):
25+
u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num
26+
pv.append([u_param, v_param, 0])
27+
28+
# Create faces (triangulated quads)
29+
pf = []
30+
for j in range(v_num):
31+
for i in range(u_num):
32+
# Calculate vertex indices for this quad
33+
v0 = j * (u_num + 1) + i
34+
v1 = j * (u_num + 1) + i + 1
35+
v2 = (j + 1) * (u_num + 1) + i + 1
36+
v3 = (j + 1) * (u_num + 1) + i
37+
38+
# Split quad into two triangles
39+
pf.append([v0, v1, v2])
40+
pf.append([v0, v2, v3])
2941

3042
# Map pattern onto target mesh
3143
mv, mf = igl.map_mesh((v, f), (pv, pf))

0 commit comments

Comments
 (0)