orient_outward for non-convex shapes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 5.1k
- Forks
- 1.2k
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 8
Description
I was looking at the code for igl::orient_outward() and it strikes me as odd to use the centroid to decide the orientation of the patch. I should work only for convex shapes, or at least surfaces whose centroid lies in its interior (also why isn't the centroid simply computed as V.colwise().mean()? Am I missing anything?).
My suggestion would be to first orient the patch coherently using bfs_orient(), and then use the signed volume of the mesh to decide whether to flip or not. Computing the signed volume of the mesh can be done by summing up the signed volume of the tets made by each triangle and the origin (or maybe the centroid for better stability).
Also the formula for the signed volume of a tet is pretty simple dot(p2 - p1, cross(p3 - p1, p4 - p1)) / 6.0;. Is there a reason for igl::volume() to compute a lot of square roots? Better stability maybe?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the implementations of igl::orient_outward(), bfs_orient(), and igl::volume(), focusing on how centroid-based orientation and volume are currently handled. Compare the suggested coherent-orientation and signed-volume approach, and clarify the expected behavior for non-convex surfaces and the volume calculation before making changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100