mesh.vertex.neighbors: Compute neighborhood of a vertex

View source: R/helpers.R

mesh.vertex.neighborsR Documentation

Compute neighborhood of a vertex

Description

Given a set of query vertex indices and a mesh *m*, compute all vertices which are adjacent to the query vertices in the mesh. A vertex *u* is *adjacent* to another vertex *v* iff there exists an edge *e = (u, v)* in *m*. While you could call this function repeatedly with the old output as its new input to extend the neighborhood, you should maybe use a proper graph library for this.

Usage

mesh.vertex.neighbors(
  surface,
  source_vertices,
  k = 1L,
  restrict_to_vertices = NULL
)

Arguments

surface

a surface as returned by functions like subject.surface or read.fs.surface.

source_vertices

Vector of source vertex indices.

k

positive integer, how often to repeat the procedure and grow the neighborhood, using the output 'vertices' as the 'source_vertices' for the next iteration. Warning: settings this to high values will be very slow for large meshes.

restrict_to_vertices

integer vector of vertex indices. If given, the neighborhood growth will be limited to the given vertex indices. Defaults to NULL, which means the neighborhood is not restricted.

Value

the neighborhood as a list with two entries: "faces": integer vector, the face indices of all faces the source_vertices are a part of. "vertices": integer vector, the unique vertex indices of all vertices of the faces in the 'faces' property. These vertex indices include the indices of the source_vertices themselves.

See Also

Other surface mesh functions: face.edges(), label.border(), mesh.vertex.included.faces(), subject.surface(), vis.path.along.verts()


fsbrain documentation built on July 9, 2023, 7:12 p.m.