For each triangle of a mesh, computes the average of the values
associated with its three vertices. This is useful for going from a
per-vertex value to a per-face value (for example, to use
meshColor = "faces" in rgl::shade3d() starting from a quantity
defined at the vertices).
Arguments
- x
triangular mesh (
mesh3dobject with anitcomponent, seergl::mesh3d()).- s
vector of values associated with the vertices of
x(same length as the number of columns ofx$vb).
Value
Numeric vector with one value per triangle (column of x$it), equal to
the average of the values of s at its vertices.