vertex_areas: Compute per-vertex surface areas

View source: R/image-utils.R

vertex_areasR Documentation

Compute per-vertex surface areas

Description

Each triangle distributes one-third of its area to each of its three vertices. Triangle area is computed via the cross-product formula.

Usage

vertex_areas(vertices, faces)

Arguments

vertices

Numeric matrix (n x 3) of vertex coordinates.

faces

Integer matrix (m x 3) of face indices (1-indexed).

Value

Numeric vector of length nrow(vertices).

Examples

vertices <- matrix(c(0, 1, 0, 0, 0, 1, 0, 0, 0), nrow = 3, byrow = TRUE)
faces <- matrix(c(1L, 2L, 3L), nrow = 1)
vertex_areas(vertices, faces)

neuromapr documentation built on Feb. 27, 2026, 5:08 p.m.