So I'm using the OpenMesh library for a project and I'm passed in an EdgeHandle e to a method. Is it possible to see what two faces are joined by this edge? I tried looking online but the documentation for openMesh is very sparse and the stuff for EdgeHandle is even sparser.
Asked
Active
Viewed 621 times
2 Answers
3
Yeah, the OpenMesh "documentation" is pretty aggravating. However, from searching for the face_handle
mentioned by tintin, I found this page hidden in it which gives a large number of useful functions:
http://openmesh.org/Documentation/OpenMesh-2.4-Documentation/classOpenMesh_1_1Concepts_1_1KernelT.html
Using the stuff found there, the following works for me:
FaceHandle a = mesh.face_handle(mesh.halfedge_handle(e,0));
FaceHandle b = mesh.face_handle(mesh.halfedge_handle(e,1));
(Technically, I enclosed the right hand sides in a function call, so I haven't tried this exactly as written. The right-hand sides should return some form of FaceHandle, at least.)
-
Just a side note, this assumes that the original mesh object is also passed as a parameter, or is a global variable. – Ren Aug 11 '15 at 20:26
-
2Your code assumes that your edge `e` has two incident faces. If it doesn't (i.e. if it is a boundary edge), `mesh.halfedge_handle()` returns an invalid handle causing undefined behavior when passed to `mesh.face_handle()`. So you might want to check `mesh.halfedge_handle(e, i).is_valid()`. – hc_ May 02 '16 at 14:00
0
It's not hard to deal with this,
HalfedgeHandle halfedge_handle(VertexHandle _vh) const {
return vertex(_vh).halfedge_handle_;
}
using this function, you will be able to generate a half edge handle with the edge_handle. and you can
mymesh.face_handle(_hh);
mesh.face_handle(mesh.opposite_halfedge_handle(_hh));
to get the two face_handle you need.

tintin
- 1,459
- 1
- 10
- 27