Skip to content

Commit e7ed598

Browse files
Merge pull request #28 from compas-dev/tessagon
Tessagon
2 parents 2983e9e + 3c56a46 commit e7ed598

File tree

4 files changed

+120
-54
lines changed

4 files changed

+120
-54
lines changed

.github/workflows/build.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,81 @@ on:
1010

1111
jobs:
1212
Build:
13-
if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')"
13+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'docs-only') }}
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
1818
python: ["3.10"]
1919

2020
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up conda
26+
uses: conda-incubator/setup-miniconda@v3
27+
with:
28+
python-version: ${{ matrix.python }}
29+
channels: conda-forge
30+
activate-environment: "compas_123-dev"
31+
32+
- name: Configure conda channels
33+
shell: bash -el {0}
34+
run: |
35+
conda config --add channels defaults
36+
conda config --set channel_priority strict
37+
2138
- uses: compas-dev/compas-actions.build@v4
2239
with:
2340
invoke_lint: true
2441
use_conda: true
2542
check_import: true
2643
python: ${{ matrix.python }}
44+
45+
build_wheels:
46+
name: cibuildwheel on ${{ matrix.platform }}
47+
needs: [Build] # Only run if Build job succeeds
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- os: ubuntu-latest
54+
platform: manylinux
55+
- os: macos-latest
56+
platform: mac
57+
- os: windows-latest
58+
platform: windows
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Install cibuildwheel
66+
run: pipx install cibuildwheel==2.23.1
67+
68+
- name: Build wheels
69+
run: cibuildwheel --output-dir wheelhouse .
70+
71+
- uses: actions/upload-artifact@v4
72+
with:
73+
name: wheels-${{ matrix.platform }}
74+
path: wheelhouse/*.whl
75+
76+
build_sdist:
77+
name: Test source distribution
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
84+
- name: Build SDist
85+
run: pipx run build --sdist
86+
87+
- uses: actions/upload-artifact@v4
88+
with:
89+
name: sdist
90+
path: dist/*.tar.gz

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
### Changed
2222

23+
- GA for cibuildwheel, bring back the tessagon test.
24+
2325
### Removed
2426

2527

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ CMAKE_POLICY_DEFAULT_CMP0135 = "NEW"
7575

7676
[tool.cibuildwheel]
7777
build-verbosity = 3
78-
test-requires = ["numpy", "compas", "pytest", "build"]
78+
test-requires = ["numpy", "compas", "pytest", "build", "tessagon"]
7979
test-command = "pip install numpy compas && pip list && pytest {project}/tests"
8080
build-frontend = "pip"
8181
manylinux-x86_64-image = "manylinux2014"

tests/test_mapping.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
# import compas
2-
# from compas_libigl.mapping import map_mesh
3-
# from compas.datastructures import Mesh
4-
5-
6-
# def test_map_mesh():
7-
# # Create target mesh (using a mesh we know exists)
8-
# mesh = Mesh.from_off(compas.get("tubemesh.off"))
9-
# mesh.quads_to_triangles() # Ensure we have a triangle mesh
10-
# v, f = mesh.to_vertices_and_faces()
11-
12-
# # Create simple pattern mesh manually (grid pattern)
13-
# # Use a smaller UV range to ensure pattern falls within target's parameterization
14-
# u_num, v_num = 5, 5
15-
# # Use a smaller central region of the UV space
16-
# u_range = [0.2, 0.8] # Avoid edges of UV space
17-
# v_range = [0.2, 0.8] # Avoid edges of UV space
18-
19-
# # Generate grid vertices
20-
# pv = []
21-
# for j in range(v_num + 1):
22-
# v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num
23-
# for i in range(u_num + 1):
24-
# u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num
25-
# pv.append([u_param, v_param, 0])
26-
27-
# # Create faces (triangulated quads)
28-
# pf = []
29-
# for j in range(v_num):
30-
# for i in range(u_num):
31-
# # Calculate vertex indices for this quad
32-
# v0 = j * (u_num + 1) + i
33-
# v1 = j * (u_num + 1) + i + 1
34-
# v2 = (j + 1) * (u_num + 1) + i + 1
35-
# v3 = (j + 1) * (u_num + 1) + i
36-
37-
# # Split quad into two triangles
38-
# pf.append([v0, v1, v2])
39-
# pf.append([v0, v2, v3])
40-
41-
# # Map pattern onto target mesh
42-
# mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf))
43-
# mesh_mapped = Mesh.from_vertices_and_faces(mv, mf)
44-
45-
# # Verify the result is a valid mesh
46-
# assert mesh_mapped is not None
47-
# assert mesh_mapped.number_of_vertices() > 0
48-
# assert mesh_mapped.number_of_faces() > 0
49-
# assert isinstance(mesh_mapped, Mesh)
50-
51-
# # Check that at least some faces were mapped
52-
# assert mesh_mapped.number_of_faces() > 0
1+
import compas
2+
from compas_libigl.mapping import map_mesh
3+
from compas.datastructures import Mesh
4+
5+
6+
def test_map_mesh():
7+
# Create target mesh (using a mesh we know exists)
8+
mesh = Mesh.from_off(compas.get("tubemesh.off"))
9+
mesh.quads_to_triangles() # Ensure we have a triangle mesh
10+
v, f = mesh.to_vertices_and_faces()
11+
12+
# Create simple pattern mesh manually (grid pattern)
13+
# Use a smaller UV range to ensure pattern falls within target's parameterization
14+
u_num, v_num = 5, 5
15+
# Use a smaller central region of the UV space
16+
u_range = [0.2, 0.8] # Avoid edges of UV space
17+
v_range = [0.2, 0.8] # Avoid edges of UV space
18+
19+
# Generate grid vertices
20+
pv = []
21+
for j in range(v_num + 1):
22+
v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num
23+
for i in range(u_num + 1):
24+
u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num
25+
pv.append([u_param, v_param, 0])
26+
27+
# Create faces (triangulated quads)
28+
pf = []
29+
for j in range(v_num):
30+
for i in range(u_num):
31+
# Calculate vertex indices for this quad
32+
v0 = j * (u_num + 1) + i
33+
v1 = j * (u_num + 1) + i + 1
34+
v2 = (j + 1) * (u_num + 1) + i + 1
35+
v3 = (j + 1) * (u_num + 1) + i
36+
37+
# Split quad into two triangles
38+
pf.append([v0, v1, v2])
39+
pf.append([v0, v2, v3])
40+
41+
# Map pattern onto target mesh
42+
mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf))
43+
mesh_mapped = Mesh.from_vertices_and_faces(mv, mf)
44+
45+
# Verify the result is a valid mesh
46+
assert mesh_mapped is not None
47+
assert mesh_mapped.number_of_vertices() > 0
48+
assert mesh_mapped.number_of_faces() > 0
49+
assert isinstance(mesh_mapped, Mesh)
50+
51+
# Check that at least some faces were mapped
52+
assert mesh_mapped.number_of_faces() > 0

0 commit comments

Comments
 (0)