I am trying to construct a
HalfEdge data structure with the vertices data of my
Using the implementation in
examples/Quickhull.js, I managed to construct an array of
Faces that each contain a starting
HalfEdge. I can then call
HalfEdge.next() and again to find all three
HalfEdge that make up a given
The problem is, given a
Face, I can find out what
HalfEdges compose that face, but I cannot find any adjacent faces because my
HalfEdges are missing the “twin” data.
How can I traverse through my
HalfEdges and match a “twin”
HalfEdge for each?
Here is a fiddle that I made to illustrate my problem.
You have to set the
twin reference by yourself when constructing objects that represent the topology our your geometry. That means you have to know what faces are adjacent and should logically be connected. Setting a twin edge is done via
Thank you for the reply. I was aware of the
setTwin method, but I was wondering how I should find the
HalfEdge to set as a twin.
I thought of looping over all
HalfEdges, and try to match up those that share any two vertices. Is this the only way to find the
twin for a given
There might be situations in algorithms where you know that two faces are adjacent so you can connect them via half edges. In all other cases, it is actually necessary to do it like you suggested. So comparing edges based on their
You might want to perform the compare operation with an epsilon value in order to mitigate floating point precision issues.
Alright. Thank you for the responses!
Thanks for the reminder! Totally forgot about this.