Previous | Next --- Slide 23 of 36
Back to Lecture Thumbnails
Cats_Is_Always_Cute

Probably rewriting the while loop of visiting all neighbors of a vertex is more precise since some halfedges do not have their twins?

While(h!=v->halfedge && exist(h->twin))

zhaur

I was under the impression that every halfedge had to have a twin though?

motoole2

@Cats_Is_Always_Cute @zhaur Let's assume here that we are working with assignment 2's implementation of Halfedge meshes. The wiki page for assignment 2 provides more details on how boundaries are handled in the assignment. Specifically, we create "virtual" boundary faces whose edges form a boundary.

So in addition to our current class definitions for vertices, edges, faces, and halfedges, we also include a boolean boundary flag in the face class definition that indicates whether or not a face represents a "virtual" boundary face, i.e., a face which is not part of the mesh but whose edges represent a boundary loop.

Even though these "virtual" faces are not technically part of the mesh, they contain their own set of halfedges. So as a result, each halfedge has a twin, even if the halfedge is at a boundary.

Therefore, going back to the original question, the algorithms shown on this slide work just fine, though with one caveat: some of the faces neighboring a vertex may be "virtual" boundary faces and not part of the actual mesh. This information may come into play when performing certain operations (e.g., computing the total area of faces touching a particular vertex).