-
Notifications
You must be signed in to change notification settings - Fork 136
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
Improve the halfedges API #116
base: main
Are you sure you want to change the base?
Conversation
Let me know if something should be tweaked. I particular in-code documentation about 'next' and 'prev' whose meaning I must have missed. I can share the Excalidraw file if it is useful. |
halfedge_movements.webmHere is a small app (can be appended to the PR) that showcase this behavior:
Maybe prev/next make more sense around facets, but I think (counter)clockwise makes more sense around vertices. |
in halfedges interface
PLOT TWIST : I still don't understand everything but it seems like I was wrong about the halfedges representation.
Incoming fix |
@BrunoLevy my modifications are now ready for review Addition:
|
There were inconsistencies in the facet normals direction of the meshes I tested (some inward, some outward). This leads us to a design choice:
|
Hi there ! |
+ add gettters for facet corners
Now this PR doesn't assume any orientation (3rd design choice of my last message). No more In-code documentation
Allow to check if facet regions are defined🆕 To be asserted at the beginning of functions receiving a Allow to ignore borders when facet regions are usedwith a new argument for Useful when we need to keep track of all the facets between two border segments Allow sub-classes to access class attributes
Getters for the index of the halfedge's origin/extremity verticesCurrently we can have their 3D coordinates ( Because I'm used to the "point" naming from
But inside, the coordinates getters use
Getters for both facets
Getters for facet corners
|
Summary
This PR extends the halfedges API without breaking existing functions. The only modified files are
src/lib/geogram/mesh/mesh_halfedges.h
/.cpp
.Motivation
I need to move on surface meshes and the halfedges API of Geogram allowed me to implement the operators I wanted. But I had several issues:
H.facet
andH.corner
in relation toH
, the meaning of next and previous is unclear)Because my code relies more and more on halfedges, I plunge into the original class to understand what was already done and to add what I needed. I found that 'next' and 'prev' don't seem to follow the same convention around facets and vertices...
Notes on existing functions
Could be helpful in the wiki
New functions
halfedge_vertex_index_from()
: because before the user could access the 3D coordinates of the origin but not the vertex indexhalfedge_vertex_index_to()
: because before the user could access the 3D coordinates of the extremity but not the vertex indexhalfedge_facet_left()
which is basicallyH.facet
but now the user doesn't need to know the underlying structurehalfedge_facet_right()
, to improve readability of the user's codemove_clockwise_around_facet()
which is more explicit thanmove_to_prev_around_facet()
move_counterclockwise_around_facet()
which is more explicit thanmove_to_next_around_facet()
move_clockwise_around_vertex()
which is more explicit thanmove_to_next_around_vertex()
move_counterclockwise_around_vertex()
which is more explicit thanmove_to_prev_around_vertex()
I hope those modifications are in line with your vision for Geogram.