Skip to contents

efourier_shape calculates a 'Fourier elliptical shape' given Fourier coefficients (see Details) or can generate some 'efourier' shapes. Mainly intended to generate shapes and/or to understand how efourier works.

Usage

efourier_shape(an, bn, cn, dn, nb.h, nb.pts = 60, 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.

cn

numeric. The \(c_n\) Fourier coefficients on which to calculate a shape.

dn

numeric. The \(d_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:

  • x vector of x-coordinates

  • y vector of y-coordinates.

Details

efourier_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 efourier for the mathematical background.

References

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

Ferson S, Rohlf FJ, Koehn RK. 1985. Measuring shape variation of two-dimensional outlines. Systematic Biology 34: 59-68.

See also

Other efourier: efourier_i(), efourier()

Examples

ef <- efourier(bot[1], 24)
efourier_shape(ef$an, ef$bn, ef$cn, ef$dn) # equivalent to efourier_i(ef)

#>                 x          y
#>  [1,] -139.292006   52.55414
#>  [2,] -136.616807   10.69211
#>  [3,] -131.350271  -30.94211
#>  [4,] -125.199336  -72.07640
#>  [5,] -118.953152 -113.78248
#>  [6,] -113.609682 -155.07182
#>  [7,] -110.814096 -196.99594
#>  [8,] -110.406802 -238.82588
#>  [9,] -114.448576 -280.46843
#> [10,] -121.291958 -321.87890
#> [11,] -128.793705 -362.93618
#> [12,] -133.799480 -404.68963
#> [13,] -133.459946 -446.39242
#> [14,] -121.381226 -485.99486
#> [15,]  -90.225043 -512.97786
#> [16,]  -49.878625 -523.21089
#> [17,]   -8.353210 -526.12066
#> [18,]   33.911396 -525.08469
#> [19,]   74.759609 -519.43972
#> [20,]  113.051448 -502.25491
#> [21,]  136.285584 -468.52283
#> [22,]  141.399365 -427.41134
#> [23,]  140.746409 -385.31652
#> [24,]  138.719031 -343.56495
#> [25,]  136.547192 -301.87577
#> [26,]  132.884166 -259.94004
#> [27,]  128.335128 -218.62173
#> [28,]  123.859620 -176.68909
#> [29,]  118.283114 -135.32263
#> [30,]  115.872309  -93.60856
#> [31,]  116.738256  -51.46991
#> [32,]  121.746650  -10.34707
#> [33,]  130.044438   31.28459
#> [34,]  135.215555   72.30011
#> [35,]  135.968480  114.36171
#> [36,]  127.773756  155.43284
#> [37,]  110.008193  192.61949
#> [38,]   91.059514  230.59227
#> [39,]   78.417823  270.00689
#> [40,]   72.336775  311.64758
#> [41,]   67.126887  353.28501
#> [42,]   63.718346  394.51271
#> [43,]   58.801472  437.18028
#> [44,]   54.675788  477.22927
#> [45,]   57.783825  520.56987
#> [46,]   46.279411  554.26720
#> [47,]    8.173233  561.94185
#> [48,]  -37.145543  559.89637
#> [49,]  -64.096831  541.62656
#> [50,]  -64.927840  500.81669
#> [51,]  -64.170645  459.21723
#> [52,]  -69.796352  417.94924
#> [53,]  -72.732679  375.54798
#> [54,]  -77.369097  334.76587
#> [55,]  -80.882096  292.41632
#> [56,]  -87.983533  251.76743
#> [57,] -103.969321  212.65038
#> [58,] -121.348549  174.68203
#> [59,] -136.478064  135.92288
#> [60,] -141.748300   94.09730
efourier_shape() # is autonomous

#>                 x            y
#>  [1,] -0.15480069 -1.973007909
#>  [2,] -0.22809026 -1.818420231
#>  [3,] -0.27032753 -1.617424063
#>  [4,] -0.29533144 -1.379645958
#>  [5,] -0.31810038 -1.115840290
#>  [6,] -0.35332863 -0.837066371
#>  [7,] -0.41396840 -0.553906111
#>  [8,] -0.50997009 -0.275789459
#>  [9,] -0.64731572 -0.010481905
#> [10,] -0.82743225  0.236229469
#> [11,] -1.04703483  0.460635732
#> [12,] -1.29840910  0.660997728
#> [13,] -1.57010032  0.837256167
#> [14,] -1.84793879  0.990604033
#> [15,] -2.11630003  1.122977481
#> [16,] -2.35947761  1.236527684
#> [17,] -2.56303702  1.333135713
#> [18,] -2.71502309  1.414025714
#> [19,] -2.80690968  1.479519099
#> [20,] -2.83420662  1.528955598
#> [21,] -2.79667422  1.560787525
#> [22,] -2.69813421  1.572833685
#> [23,] -2.54590625  1.562660872
#> [24,] -2.34993539  1.528046001
#> [25,] -2.12170552  1.467461982
#> [26,] -1.87305376  1.380526662
#> [27,] -1.61500882  1.268356875
#> [28,] -1.35677236  1.133778649
#> [29,] -1.10494596  0.981359078
#> [30,] -0.86308017  0.817243778
#> [31,] -0.63158802  0.648804395
#> [32,] -0.40802730  0.484121281
#> [33,] -0.18771750  0.331344943
#> [34,]  0.03537770  0.197994496
#> [35,]  0.26759916  0.090260326
#> [36,]  0.51448708  0.012380671
#> [37,]  0.77974312 -0.033842603
#> [38,]  1.06437497 -0.049334829
#> [39,]  1.36612060 -0.037808467
#> [40,]  1.67922192 -0.005575404
#> [41,]  1.99458198  0.038882082
#> [42,]  2.30030138  0.085552509
#> [43,]  2.58255024  0.123698665
#> [44,]  2.82669741  0.142757057
#> [45,]  3.01859091  0.133256549
#> [46,]  3.14586632  0.087675830
#> [47,]  3.19915458  0.001163238
#> [48,]  3.17306813 -0.127946593
#> [49,]  3.06686342 -0.297867638
#> [50,]  2.88470784 -0.503375634
#> [51,]  2.63551577 -0.736101825
#> [52,]  2.33235949 -0.985084971
#> [53,]  1.99150137 -1.237536583
#> [54,]  1.63113051 -1.479755629
#> [55,]  1.26991586 -1.698116048
#> [56,]  0.92550660 -1.880044476
#> [57,]  0.61311653 -2.014907112
#> [58,]  0.34432245 -2.094733481
#> [59,]  0.12618734 -2.114720168
#> [60,] -0.03921072 -2.073477807

panel(Out(a2l(replicate(100,
efourier_shape(nb.h=6, alpha=2.5, plot=FALSE))))) # Bubble family