Learn R Programming

Momocs (version 0.2-6)

tfourier: Calculates tangent angle Fourier analysis.

Description

tfourier computes tangent angle Fourier analysis from a matrix or a list of coordinates.

Usage

tfourier(coo, nb.h, smooth.it=0, norm = FALSE, silent = 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
norm
logical. Whether to scale and register new coordinates so that the first point used is sent on the origin.
silent
logical. Whether to display diagnosis messages.

Value

  • A list with these components:
  • aoao Harmonic coefficient.
  • anvector of $a_{1->n}$ harmonic coefficients.
  • bnvector of $b_{1->n}$ harmonic coefficients.
  • phivector of variation of the tangent angle.
  • tvector of distance along the perimeter expressed in radians.
  • perimeternumeric. The perimeter of the outline.
  • thetaonumeric. The first tangent angle.
  • x1The x-coordinate of the first point.
  • y1The y-coordinate of the first point.

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 for the other members of the Fourier's family.

Examples

Run this code
data(bot)
coo <- bot@coo[[1]]
coo.plot(coo)
tf  <- tfourier(coo, 12)
tf
tfi <- tfourier.i(tf)
l2m(tfi)
coo.draw(tfi, border="red", col=NA) # the outline is not closed...
coo.draw(tfourier.i(tf, force2close=TRUE), border="blue", col=NA) # we force it to close.

Run the code above in your browser using DataLab