Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 65 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,81 @@ on:

jobs:
Build:
if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')"
if: ${{ !contains(github.event.pull_request.labels.*.name, 'docs-only') }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python }}
channels: conda-forge
activate-environment: "compas_123-dev"

- name: Configure conda channels
shell: bash -el {0}
run: |
conda config --add channels defaults
conda config --set channel_priority strict

- uses: compas-dev/compas-actions.build@v4
with:
invoke_lint: true
use_conda: true
check_import: true
python: ${{ matrix.python }}

build_wheels:
name: cibuildwheel on ${{ matrix.platform }}
needs: [Build] # Only run if Build job succeeds
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: manylinux
- os: macos-latest
platform: mac
- os: windows-latest
platform: windows

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install cibuildwheel
run: pipx install cibuildwheel==2.23.1

- name: Build wheels
run: cibuildwheel --output-dir wheelhouse .

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform }}
path: wheelhouse/*.whl

build_sdist:
name: Test source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- GA for cibuildwheel, bring back the tessagon test.

### Removed


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CMAKE_POLICY_DEFAULT_CMP0135 = "NEW"

[tool.cibuildwheel]
build-verbosity = 3
test-requires = ["numpy", "compas", "pytest", "build"]
test-requires = ["numpy", "compas", "pytest", "build", "tessagon"]
test-command = "pip install numpy compas && pip list && pytest {project}/tests"
build-frontend = "pip"
manylinux-x86_64-image = "manylinux2014"
Expand Down
104 changes: 52 additions & 52 deletions tests/test_mapping.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# import compas
# from compas_libigl.mapping import map_mesh
# from compas.datastructures import Mesh


# def test_map_mesh():
# # Create target mesh (using a mesh we know exists)
# mesh = Mesh.from_off(compas.get("tubemesh.off"))
# mesh.quads_to_triangles() # Ensure we have a triangle mesh
# v, f = mesh.to_vertices_and_faces()

# # Create simple pattern mesh manually (grid pattern)
# # Use a smaller UV range to ensure pattern falls within target's parameterization
# u_num, v_num = 5, 5
# # Use a smaller central region of the UV space
# u_range = [0.2, 0.8] # Avoid edges of UV space
# v_range = [0.2, 0.8] # Avoid edges of UV space

# # Generate grid vertices
# pv = []
# for j in range(v_num + 1):
# v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num
# for i in range(u_num + 1):
# u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num
# pv.append([u_param, v_param, 0])

# # Create faces (triangulated quads)
# pf = []
# for j in range(v_num):
# for i in range(u_num):
# # Calculate vertex indices for this quad
# v0 = j * (u_num + 1) + i
# v1 = j * (u_num + 1) + i + 1
# v2 = (j + 1) * (u_num + 1) + i + 1
# v3 = (j + 1) * (u_num + 1) + i

# # Split quad into two triangles
# pf.append([v0, v1, v2])
# pf.append([v0, v2, v3])

# # Map pattern onto target mesh
# mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf))
# mesh_mapped = Mesh.from_vertices_and_faces(mv, mf)

# # Verify the result is a valid mesh
# assert mesh_mapped is not None
# assert mesh_mapped.number_of_vertices() > 0
# assert mesh_mapped.number_of_faces() > 0
# assert isinstance(mesh_mapped, Mesh)

# # Check that at least some faces were mapped
# assert mesh_mapped.number_of_faces() > 0
import compas
from compas_libigl.mapping import map_mesh
from compas.datastructures import Mesh


def test_map_mesh():
# Create target mesh (using a mesh we know exists)
mesh = Mesh.from_off(compas.get("tubemesh.off"))
mesh.quads_to_triangles() # Ensure we have a triangle mesh
v, f = mesh.to_vertices_and_faces()

# Create simple pattern mesh manually (grid pattern)
# Use a smaller UV range to ensure pattern falls within target's parameterization
u_num, v_num = 5, 5
# Use a smaller central region of the UV space
u_range = [0.2, 0.8] # Avoid edges of UV space
v_range = [0.2, 0.8] # Avoid edges of UV space

# Generate grid vertices
pv = []
for j in range(v_num + 1):
v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num
for i in range(u_num + 1):
u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num
pv.append([u_param, v_param, 0])

# Create faces (triangulated quads)
pf = []
for j in range(v_num):
for i in range(u_num):
# Calculate vertex indices for this quad
v0 = j * (u_num + 1) + i
v1 = j * (u_num + 1) + i + 1
v2 = (j + 1) * (u_num + 1) + i + 1
v3 = (j + 1) * (u_num + 1) + i

# Split quad into two triangles
pf.append([v0, v1, v2])
pf.append([v0, v2, v3])

# Map pattern onto target mesh
mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf))
mesh_mapped = Mesh.from_vertices_and_faces(mv, mf)

# Verify the result is a valid mesh
assert mesh_mapped is not None
assert mesh_mapped.number_of_vertices() > 0
assert mesh_mapped.number_of_faces() > 0
assert isinstance(mesh_mapped, Mesh)

# Check that at least some faces were mapped
assert mesh_mapped.number_of_faces() > 0
Loading