Learn R Programming

Momocs (version 0.1-03)

Outline: tfourier: Fourier Tangent angle core functions.

Description

Provide facilities for tangent angle Fourier analysis. tfourier computes Fourier coefficients from a set of coordinates; tfourier.i calculates a shape given a set of Fourier coefficients computed with tfourier; tfourier.shape calculates a "Fourier tangent angle shape" given Fourier coefficients (see Details).

Usage

tfourier(coo, nb.h=32, smooth.it=0)
tfourier.i(tf, nb.pts, nb.h=length(tf$an), thetao=0)
tfourier.shape(an, bn, ao = 0, nb.h, nb.pts = 80, alpha = 2, plot = TRUE)

Arguments

coo
A list or matrix of coordinates
nb.h
integer. The number of harmonics to calculate/use
smooth.it
integer. The number of smoothing iterations to perform
tf
a list with ao, an and bn components, typically as returned by tfourier
an
numeric. A vector of harmonic coefficient(s).
bn
numeric. A vector of harmonic coefficient(s).
ao
numeric. radius angle to the reference (in radians)
nb.pts
integer. The number of points to calculate
thetao
numeric. radius angle to the reference (in radians)
alpha
numeric. The power coefficient associated with the (usually decreasing) amplitude of the Fourier coefficients (see efourier - Details)
plot
logical. Whether to plot the shape or only return the list of coordinates.

Value

  • Returns a list of coordinates.

Details

Given a closed outline which the outline has been scaled to $2\pi$, $\phi(t)$ can be expressed as follows: $$\phi(t) = \theta(t) - \theta(0) - t$$ where $t$ is the distance along the outline, $\theta(t)$ the angle of the tangent vector at $t$ and $\theta(0)$ the angle of the tangent vector taken for the first point. It can be removed for normalizing the coefficients obtained. Two coefficients per harmonics can be estimated as follow: $$a_n = \frac{2}{p}\sum\limits_{n=1}^{p}\phi(t)\cos n \theta_i$$ $$b_n = \frac{2}{p}\sum\limits_{n=1}^{p}\phi(t)\sin n \theta_i$$ with $$a_0 = \sqrt{\frac{2}{p}}\sum\limits_{n=1}^{p}\phi(t)$$

References

Zahn CT, Roskies RZ. 1972. Fourier Descriptors for Plane Closed Curves. IEEE Transactions on Computers C-21: 269-281. Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.

See Also

efourier, rfourier.

Examples

Run this code
data(bot)
tfourier(bot@coo[[1]])
tfourier.shape()

Run the code above in your browser using DataLab