View source: R/utils_efourier.R
efourier_shape | R Documentation |
Calculates a 'Fourier elliptical shape' given Fourier coefficients
efourier_shape(
an = NULL,
bn = NULL,
cn = NULL,
dn = NULL,
n = 1,
nharm = NULL,
npoints = 150,
alpha = 4,
plot = TRUE
)
an |
The |
bn |
The |
cn |
The |
dn |
The |
n |
The number of shapes to generate. Defaults to 1. If more than one shape is used, a list of coordinates is returned. |
nharm |
The number of harmonics to use. It must be less than or equal to
the length of |
npoints |
The number of points to calculate. |
alpha |
The power coefficient associated with the (usually decreasing) amplitude of the Fourier coefficients. |
plot |
Logical indicating Whether to plot the shape. Defaults to ´TRUE' |
efourier_shape
can be used by specifying nharm
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 Claude (2008) pp.223 for the maths behind inverse ellipitical
Fourier
Adapted from Claude (2008). pp. 223.
A list with components:
x
vector of x-coordrdinates
y
vector of y-coordrdinates.
Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.
library(pliman)
# approximation of the third leaf's perimeter
# 4 harmonics
image_pliman("potato_leaves.jpg", plot = TRUE)
efourier_shape(an = c(-7.34, 1.81, -1.32, 0.50),
bn = c(-113.88, 21.90, -0.31, -6.14),
cn = c(-147.51, -20.89, 0.66, -14.06),
dn = c(-0.48, 2.36, -4.36, 3.03))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.