Calculates a 'Fourier elliptical shape' given Fourier coefficients
Usage
efourier_shape(
an = NULL,
bn = NULL,
cn = NULL,
dn = NULL,
n = 1,
nharm = NULL,
npoints = 150,
alpha = 4,
plot = TRUE
)
Arguments
- an
The \(a_n\) Fourier coefficients on which to calculate a shape.
- bn
The \(b_n\) Fourier coefficients on which to calculate a shape.
- cn
The \(c_n\) Fourier coefficients on which to calculate a shape.
- dn
The \(d_n\) Fourier coefficients on which to calculate a shape.
- 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
*_n
coefficients.- 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`
Details
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.
Examples
if (interactive() && requireNamespace("EBImage")) {
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))
}