Skip to content
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

feat: add method to compute number of handles for meshes with & without boundary #2249

Open
keenancrane opened this issue Aug 23, 2023 · 4 comments
Labels

Comments

@keenancrane
Copy link

During an SGI project, we discovered that the euler_characteristic method does not return the right result for meshes with boundary. The standard Euler characteristic formula is

V - E + F + B = (2-2g) = χ,

but the current implementation of euler_characteristic does not compute the number of boundary loops. This number could be computed via the boundary_loops method.

Compare with the Geometry Central implementation found here:

https://github.com/nmwsharp/geometry-central/blob/071756157a6122ead8fa978a35b06d1acc16451f/src/surface/manifold_surface_mesh.cpp#L515

@alecjacobson
Copy link
Contributor

Thanks for the question, Keenan. Could you please provide a reference for V - E + F + B = χ being standard?

I've always seen V - E + F = χ, as on wikipedia which also states

the lone triangle has V = 3, E = 3, F =1, so that V-E+F=1

χ = 1 is also what I expect for the Euler characteristic of a disk. Adding the number of boundary loops (B=1) would produce χ=2 causing a single triangle to have the same Euler characteristic as a tetrahedron (4 - 6 + 4 = 2).

The V - E + F = χ formula (and specifically (3-3+1=1 for a single triangle) is used throughout David Eppstein's proofs.

@keenancrane
Copy link
Author

Yeah, you’re right—the definition you cite also agrees with the definition based on Betti numbers. (Perhaps I should file an issue on Geometry Central instead…)

The practical issue is that the Euler characteristic alone is ambiguous when trying to perform some reasonably common tasks. For instance a double torus and a disk with two holes both have characteristic -1. In the context of the SGI project, students were trying to extract patches that can be flattened, and checking the Euler characteristic alone was giving them the wrong answer (patches could have handles).

It looks like you can get the number of handles h by calling euler_characteristic to get e, then boundary_loops to get b; h is then 1-(e+b)/2. But this is pretty indirect, requiring a bit of “expert knowledge.”

So, perhaps a more constructive suggestion for this is to make a feature request:

Request: add a method handles that returns the number of topological handles, for meshes with or without boundary.

(Will change the issue title also.)

Thanks!

@keenancrane keenancrane changed the title Bug: euler_characteristic doesn't give right result for meshes with boundary feat: add method to compute number of handles for meshes with & without boundary Aug 23, 2023
@alecjacobson
Copy link
Contributor

That's a nice feature request. I have that in matlab gptoolbox's statistics and in C++ in gp-cli. Might as well add it to libigl sometime.

@alecjacobson
Copy link
Contributor

See also #1331 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants