Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

warpmovie3d

Creates a sequence of images showing predefined steps of warping two meshes or landmark configurations (2D and 3D) into each other


Description

Creates a sequence of images showing predefined steps of warping two meshes or landmark configurations (2D and 3D) into each other

Usage

warpmovie3d(x, y, n, col = "green", palindrome = FALSE,
  folder = NULL, movie = "warpmovie", ...)

## S3 method for class 'matrix'
warpmovie3d(x, y, n, col = "green",
  palindrome = FALSE, folder = NULL, movie = "warpmovie",
  add = FALSE, close = TRUE, countbegin = 0, ask = TRUE,
  radius = NULL, links = NULL, lwd = 1, ...)

warpmovie2d(x, y, n, col = "green", palindrome = FALSE,
  folder = NULL, movie = "warpmovie", links = NULL, lwd = 1,
  imagedim = "800x800", par = list(xaxt = "n", yaxt = "n", bty = "n"),
  ...)

## S3 method for class 'mesh3d'
warpmovie3d(x, y, n, col = NULL, palindrome = FALSE,
  folder = NULL, movie = "warpmovie", add = FALSE, close = TRUE,
  countbegin = 0, ask = TRUE, radius = NULL, xland = NULL,
  yland = NULL, lmcol = "black", ...)

Arguments

x

mesh to start with (object of class mesh3d)

y

resulting mesh (object of class mesh3d), having the same amount of vertices and faces than the starting mesh

n

integer: amount of intermediate steps.

col

color of the mesh

palindrome

logical: if TRUE, the procedure will go forth and back.

folder

character: output folder for created images (optional)

movie

character: name of the output files

...

additional arguments passed to shade3d (3D) or points (2D).

add

logical: if TRUE, the movie will be added to the focussed rgl-windows.

close

logical: if TRUE, the rgl window will be closed when finished. width and 200 the height of the image.

countbegin

integer: number to start image sequence.

ask

logical: if TRUE, the viewpoint can be selected manually.

radius

numeric: define size of spheres (overides atuomatic size estimation).

links

vector or list of vectors containing wireframe information to connect landmarks (optional).

lwd

numeric: controls width of lines defined by "links".

imagedim

character of pattern "100x200" where 100 determines the width and 200 the height of the image.

par

list of graphial parameters: details can be found here: par.

xland

optional argument: add landmarks on mesh x

yland

optional argument: add landmarks on mesh y

lmcol

optional argument: color of landmarks xland and yland

Details

given two landmark configurations or two meshes with the same amount of vertices and faces (e.g a mesh and its warped counterpart), the starting configuration/mesh will be subsequently transformed into the final configuration/mesh by splitting the differences into a predefined set of steps.

A series of png files will be saved to disk. These can be joined to animated gifs by external programs such as imagemagick or used to create animations in PDFs in a latex environment (e.g. latex package: aninmate).

Author(s)

Stefan Schlager

See Also

Examples

###3D example
 data(nose)##load data
## Not run: 
##warp a mesh onto another landmark configuration:
longnose.mesh <- tps3d(shortnose.mesh,shortnose.lm,longnose.lm,threads=1)

warpmovie3d(shortnose.mesh,longnose.mesh,n=15)## create 15 images.

### ad some landmarks
warpmovie3d(shortnose.mesh,longnose.mesh,n=15,xland=shortnose.lm,
            yland=longnose.lm)## create 15 images.


### restrict to landmarks
warpmovie3d(shortnose.lm,longnose.lm,n=15,movie="matrixmovie")## create 15 images.

### the images are now stored in your current working directory and can
### be concatenated to a gif using an external program such as
### imagemagick.

## End(Not run)
### 2D example
if (require(shapes)) {
bb <- procSym(gorf.dat)
### morph superimposed first specimen onto sample mean
warpmovie2d(bb$rotated[,,1],bb$mshape,n=20,links=c(1,5,4:2,8:6,1),imagedim="600x400")
## remove files
unlink("warpmovie00*")
}

Morpho

Calculations and Visualisations Related to Geometric Morphometrics

v2.8
GPL-2
Authors
Stefan Schlager [aut, cre, cph], Gregory Jefferis [ctb], Dryden Ian [cph]
Initial release
2020-02-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.