-
Notifications
You must be signed in to change notification settings - Fork 8
Nanobind #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nanobind #20
Conversation
…_libigl # Conflicts: # CMakeLists.txt
added CGAL variable path to boost library removed MeshPattern temporarily rereferenced compas_plotters
added geodistance (heat and exact)
updated readme
|
the isolines are wrong... |
Is it related to building process or implementation? Isolines method has been slightly changed in the recent libigl source code. Now it takes isovalues to retrieve output. |
|
they are based on the OBJ coordinate direction instead of the orientation of the model |
|
Building libigl on all os works fine 🎉🥳🙌 Windows problem was this line in ToDo's before the final merge to align with compas_cgal workflow:
|
|
@tomvanmele I would like to ask for a review. Multiple files were changed, the simplest way, would be to check the branch: https://github.com/petrasvestartas/compas_libigl/tree/nb We see in this pull-request the whole history of commit. Should I leave it as is or should I create a new pull-request with the changes only? DependenciesC++ dependencies: eigen and libigl are handled via cmake. Note: Third party dependencies like CGAL, embree, tetgen, Triangle, OpenGL pipeline libraries, are skipped since they are either used in other compas bindings and are only highly specific use cases of libigl that we dont need. None of the binded methods use that, as a result maintaining this package will be much easier. Github ActionsGithub actions are changed to the actions used in compas_cgal. TestsMinimal tests were added to the test folder for each binded method. Tests are helpful in github actions. DocsDocumentation with tested examples: Aufzeichnung.2025-04-04.014330.mp4PYPI + Pending PublisherLocally I tested the PYPI building process on windows and docker for linux: For release to pypi we need the pending publisher: |
perhaps a bit annoying, but i think it would be better... |
done |
| ******************************************************************************** | ||
|
|
||
| Coming soon! | ||
| COMPAS libigl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps this subtitle is not needed?
| # Create two-color maps for negative and positive curvature | ||
| cmap_negative = ColorMap.from_two_colors(Color.blue(), Color.yellow()) | ||
| cmap_positive = ColorMap.from_two_colors(Color.yellow(), Color.magenta()) | ||
|
|
||
| # Create vertex colors dictionary | ||
| vertex_colors = {} | ||
| for i, k in enumerate(gaussian_curvature): | ||
| if trimesh.is_vertex_on_boundary(i): | ||
| # Set boundary vertices to black | ||
| vertex_colors[i] = Color.black() | ||
| else: | ||
| if k < 0: | ||
| vertex_colors[i] = cmap_negative(k, minval=min_gaussian, maxval=0) | ||
| else: | ||
| vertex_colors[i] = cmap_positive(k, minval=0, maxval=max_gaussian) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not now, but we need to make things like this simpler
| normal_scale = -10 | ||
| for vertex in trimesh.vertices(): | ||
| if not trimesh.is_vertex_on_boundary(vertex): | ||
| point = Point(*trimesh.vertex_coordinates(vertex)) | ||
| normal = trimesh.vertex_normal(vertex) | ||
| k = gaussian_curvature[vertex] | ||
|
|
||
| scaled_normal = [n * normal_scale * k for n in normal] | ||
| end_point = Point(*(p + n for p, n in zip(point, scaled_normal))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Licini perhaps we can add a few special scene objects for making recurring visualisation patterns easier to execute
- mesh vertex normals
- mesh face normals
- mesh/graph paths
- ...
| @@ -1,10 +1,10 @@ | |||
| ******************************************************************************** | |||
| Ray/Mesh Intersections | |||
| Mesh-ray intersections | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is the ray that intersects the mesh
| from compas.colors import ColorMap | ||
| from compas.geometry import Rotation | ||
| from compas.geometry import Scale | ||
| import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't believe this passes ruff linting and formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please turn on sorting in the project config
| Several examples use the COMPAS Viewer for visualisation. | ||
| To install :mod:`compas_viewer` in the same environment | ||
|
|
||
| .. code-block:: bash | ||
| git clone --recursive https://github.com/compas-dev/compas_libigl.git | ||
| conda activate libigl | ||
| pip install compas_viewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
| Curvature Analysis | ||
| ------------------ | ||
|
|
||
| V, F = mesh.to_vertices_and_faces() | ||
| * :func:`compas_libigl.trimesh_gaussian_curvature` - Compute Gaussian curvature at vertices | ||
| * :func:`compas_libigl.trimesh_principal_curvature` - Compute principal curvatures and directions | ||
|
|
||
| source = trimesh.vertex_sample(size=1)[0] | ||
| distance = compas_libigl.trimesh_geodistance( | ||
| (V, F), | ||
| source, | ||
| method="heat", | ||
| ) | ||
| Geodesic Distances |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i would categorize this under analysis. for me this highlights why excessive structuring is not really helpful
| Parameters | ||
| ---------- | ||
| M : tuple[:class:`list`, :class:`list`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove :class:
| Parameters | ||
| ---------- | ||
| M : tuple[:class:`list`, :class:`list`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be tuple[list[list[float]], list[list[int]]]
| Parameters | ||
| ---------- | ||
| M : tuple[list[list[float]], list[list[int]]] | :class:`compas.datastructures.Mesh` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it is still true that the mesh unpacks into vertices and faces in current compas versions
|
@tomvanmele thank you for the corrections, I fixed them and added a new pull-request to avoid commit history. Also found the right command for ruff: |



This is pull request to change pybind11 build system of C++ to Python binding to nanobind.
Following methods are wrapped:
Boundary loops

Curvature (gaussian - normals, principal, in-plane vectors)

Geodesic Distance

Ray/Mesh Intersections

Isolines

Mesh Mass Matrix

Mesh Parametrisations

Quad Mesh Planarisation

Remeshing from isolines


