buildEdgeMateIndices MethodStatic

Build the edgeMate index array into the polyface's PolyfaceData. After this method:

  • The array polyface.data.edgeMateIndex is defined with the same length as the other PolyfaceData index arrays.
  • For each interior edge, polyface.data.edgeIndexToEdgeMateIndex returns the edge index on the other side of the edge in the adjacent facet.
  • The conditions for edgeMate matching are:
    • Given facetIndex f, let k0 = polyface.facetIndex0(f) and k1 = polyface.facetIndex1(f).
    • Every edge index k in the face loop of facet f satisfies k0 <= k < k1.
    • The edge with edge index k starts at the point with index polyface.data.pointIndex[k].
    • Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e., kB === (kA + 1 === k1) ? k0 : kA + 1.
    • Then polyface.data.pointIndex[kA] and polyface.data.pointIndex[kB] are the indices of the points at the start and end of an edge of that facet.
    • We call kA the edge index for that edge, and kB the edge index for the next edge around the facet.
    • If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse order, i.e.,
      • polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]
      • polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]
    • We call the edge indices kA and kC edge mates, denoted in the edgeMateIndex array by:
      • polyface.data.edgeMateIndex[kA] === kC
      • polyface.data.edgeMateIndex[kC] === kA
    • If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a null edge, and its edge mate is itself.
  • A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent facets, or 1 with the wrong orientation). These edges have no edge mate, represented as undefined in the edgeMateIndex array.
  • These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with opposite orientation in an adjacent facet.
  • After calling this method, the caller can construct IndexedPolyfaceWalker objects to traverse the mesh by walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the aforementioned edge indices:
    • walkerC = walkerA.edgeMate() moves across the edge to its other end, at kC.
    • walkerB = walkerA.nextAroundFacet() moves around the facet to the next edge, at kB.
    • walkerB.previousAroundFacet() moves from kB back to kA.
    • walkerD = walkerA.previousAroundVertex() moves around the vertex to the next edge kD.
    • walkerD1 = walkerC.nextAroundFacet() also moves to kD.
    • walkerD.nextAroundVertex() moves from kD back to kA.

buildEdgeMateIndices(polyface: IndexedPolyface): void

Parameter Type Description
polyface IndexedPolyface  

Returns - void

Defined in

Last Updated: 07 June, 2025