shapeDiff {RRmorph}R Documentation

Shape difference between 3d meshes

Description

The function reconstructs two specimens' meshes (x) by using their superimposed configurations (from within pca), calculates the shape difference between them, and plots such differences on provided meshes (refsur).

Usage

shapeDiff(x,pca,refsur,refmat,mshape_sur = NULL,
  pal=NULL,NAcol="gray90",show.names=TRUE)

Arguments

x

a vector of specimens pair.

pca

the result of a relative warp analysis. Classes relwarps and nosymproc are both accepted.

refsur

a list of two mesh3d objects to be provided in the same order as x.

refmat

a list of two landmark sets related to refsur to be provided in the same order as x.

mshape_sur

a mesh3d object used as a reference for mesh reconstruction. The vertices of mshape_sur must be the consensus configuration. If NULL, it is automatically generated by applying vcgBallPivoting on the consensus configuration derived from pca.

pal

a vector of colors to be passed to colorRampPalette.

NAcol

the color associated to refsur vertices falling outside the range of refmat (not involved in interpolation).

show.names

logical: if TRUE, the names of the specimens as in x are displayed in the 3d plot.

Value

Two mesh3d objects colored according to shape differences. Additionally, the function returns 3d plots of the meshes.

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(Morpho)

  pca<-procSym(endo.set)
  ldm_homo<-endo.set[,,"Homo_sapiens"]
  sur_homo<-endo.sur[["Homo_sapiens"]]
  ldm_macaca<-endo.set[,,"Macaca_fuscata"]
  sur_macaca<-endo.sur[["Macaca_fuscata"]]

  diffs<-RRmorph::shapeDiff(x=c("Homo_sapiens","Macaca_fuscata"),
                   pca = pca,refsur = list(sur_homo,sur_macaca),
                   refmat = list(ldm_homo,ldm_macaca))
  

[Package RRmorph version 0.0.1 Index]