Skip to content

Function: buildVertexAdjacency()

ts
function buildVertexAdjacency(faces, vertexCount): MeshAdjacency;

Defined in: src/utils/meshAdjacency.ts:37

Build vertex adjacency structure from mesh faces.

Constructs both vertex-to-vertex and vertex-to-face adjacency maps by iterating through all triangular faces once.

Time complexity: O(F) where F = faces.length / 3 (number of faces) Space complexity: O(V + E + F) where V = vertices, E = edges

Parameters

faces

Uint32Array<ArrayBufferLike> | number[]

Triangle face indices (length must be divisible by 3)

vertexCount

number

Total number of vertices in the mesh

Returns

MeshAdjacency

MeshAdjacency structure with neighbor and face incidence data

Throws

Error if vertexCount <= 0 or faces.length not divisible by 3

Released under the MIT License.