Learn R Programming

Momocs (version 0.2-03)

rfourier.shape: Calculates and draw "rfourier" shapes.

Description

rfourier.shape calculates a "Fourier radii variation shape" given Fourier coefficients (see Details) or can generate some "rfourier" shapes.

Usage

rfourier.shape(an, bn, nb.h, nb.pts=80, alpha=2, plot=TRUE)

Arguments

an
numeric. The $a_n$ Fourier coefficients on which to calculate a shape.
bn
numeric. The $b_n$ Fourier coefficients on which to calculate a shape.
nb.h
integer. The number of harmonics to use.
nb.pts
integer. The number of points to calculate.
alpha
numeric. The power coefficient associated with the (usually decreasing) amplitude of the Fourier coefficients (see Details).
plot
logical. Whether to plot or not the shape.

Value

  • A list with components:
  • xvector of x-coordinates.
  • yvector of y-coordinates.

Details

rfourier.shape can be used by specifying nb.h and alpha. The coefficients are then sampled in an uniform distribution $(-\pi ; \pi)$ and this amplitude is then divided by $harmonicrank^alpha$. If alpha is lower than 1, consecutive coefficients will thus increase. See rfourier for the mathematical background.

References

Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.

See Also

rfourier.i.

Examples

Run this code
data(bot)
rf <- rfourier(bot@coo[[1]], 24)
rfourier.shape(rf$an, rf$bn) # equivalent to rfourier.i(rf)
rfourier.shape() # not very interesting

rfourier.shape(nb.h=12) # better
rfourier.shape(nb.h=6, alpha=0.4, nb.pts=500)

panel(Coo(replicate(100, l2m(rfourier.shape(nb.h=6, alpha=0.4, nb.pts=200, plot=FALSE))))) # Butterflies

Run the code above in your browser using DataLab