Skip to content

Conversation

@petrasvestartas
Copy link
Collaborator

@petrasvestartas petrasvestartas commented Apr 17, 2025

Mapping 2D mesh to a 3D mesh.

How it works:

  1. Get a mesh, with at least one open boundary ( solid closed objects are not considered in this implementation )
  2. Create a 2D mesh you want to map
  3. Parametrize 3D mesh to 2D
  4. Place pattern and parametrized mesh on top of each other.
  5. Then using barycentric mapping mesh vertices are mapped to 3D.
  6. If there is at least one mesh vertex of a pattern outside the 2D mesh, this mesh face skipped. To have a clear boundary you can clip your pattern initially.

Screenshot from 2025-04-17 16-01-13

Comment on lines 79 to 80
p_uv = igl.trimesh_simple((pv, pf))
mesh_mapped = igl.map_mesh(v, f, uv, pv, pf, p_uv)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

igl.trimesh_simple takes mesh info as a tuple of vertices and faces, whereas igl.map_mesh accepts vertices and faces individually. would perhaps be better to be consistent.

  • igl.map_mesh((v, f), (pv, pf), uv, p_uv)?
  • igl.map_mesh((v, f, uv), (pv, pf, p_uv))?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, igl.trimesh_simple doesn't really say what it does

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and perhaps it is more user-friendly to eliminate the in between step:

  • igl.map_mesh_simple((v, f), (pv, pf))
  • igl.map_mesh_lscm((v, f), (pv, pf))
  • ...

@petrasvestartas
Copy link
Collaborator Author

I will cleaning one more little thing to make it work with boundaries:

image

@petrasvestartas
Copy link
Collaborator Author

petrasvestartas commented Apr 17, 2025

Added a few examples for boundaries and exploration of Tessagon patterns:
https://github.com/petrasvestartas/compas_libigl/tree/pattern_mapping

Screenshot from 2025-04-17 22-30-36
Screenshot from 2025-04-17 22-29-28

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few small things but otherwise LGTM

setuptools
cibuildwheel==2.23.1
cibuildwheel==2.23.1
tessagon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed here

"trimesh_massmatrix",
"trimesh_harmonic",
"trimesh_lscm",
"trimesh_map_aabb",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps not to be changed now, but i still find these names not very intuitive. something like this might be better:

  • trimesh_harmonic_mapping
  • trimesh_lsc_mapping
  • triemsh_aabb_mapping

@petrasvestartas petrasvestartas merged commit f33be59 into compas-dev:main Apr 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants