col2mesh {RRmorph} | R Documentation |
Color a mesh according to provided values
Description
The function colors a mesh
according to a vector of
continuous values
related to individual vertices.
Usage
col2mesh(mesh,values,pal,from=NULL,to=NULL,NAcol="gray90")
Arguments
mesh |
a |
values |
a vector of continuous values associated to individual vertices
of the |
pal |
a vector of colors to be passed to
|
from , to |
lower and upper |
NAcol |
the color associated to NA |
Value
A mesh3d
object colored according to values
.
Author(s)
Marina Melchionna, Silvia Castiglione
Examples
da<-"https://github.com/pasraia/RRmorph_example_data/raw/refs/heads/main/RRmorphdata.rda"
download.file(url=da,destfile = paste0(tempdir(),"/RRmorphdata.rda"))
load(paste0(tempdir(),"/RRmorphdata.rda"))
require(rgl)
require(Morpho)
require(Rvcg)
pca<-procSym(endo.set)
ldm<-endo.set[,,"Homo_sapiens"]
sur<-endo.sur[["Homo_sapiens"]]
rec<- vcgBallPivoting(pca$mshape, radius = 0)
rec$vb[1:3,]<-t(ldm)
val<-rnorm(ncol(rec$vb))
interp<-interpolMesh(sur = rec,refsur = sur,refmat = ldm,
values = val,element ="vertices",k = 4)
colmesh<-col2mesh(mesh = sur,values = interp,pal = heat.colors(5))
plotLegend(mesh = colmesh,values = interp, main = "Pan troglodytes")
open3d()
shade3d(colmesh,specular="black")
[Package RRmorph version 0.0.1 Index]