Crate efd

Source
Expand description

§EFD Rust Library

dependency status documentation

Elliptical Fourier Descriptor (EFD) implementation in Rust. This crate implements 1D/2D/3D EFD and its related functions.

This implementation is totally safe and supports no-std + alloc environment.

Keyword Alias:

  • Elliptical Fourier Analysis (EFA)
  • Elliptical Fourier Function (EFF)

Example of re-describing a new closed curve:

let curve = vec![
    [0., 0.],
    [1., 1.],
    [2., 2.],
    [3., 3.],
    [2., 2.],
    [1., 1.],
];
assert!(efd::util::valid_curve(&curve).is_some());
let described_curve = efd::Efd2::from_curve(curve, false).recon(20);

The harmonic number can be set with efd::Efd::from_curve_harmonic() method. The following figures show the reconstruction of a 2D closed curve with 1-8 harmonics.

1h 2h 3h 4h
5h 6h 7h 8h

§Example Images

2D and 3D closed curve:

2d 3d

2D and 3D open curve:

2d 3d

Posed EFD combined a curve with a pose (unit vectors) to describe the orientation of each point.

2D open curve and its full reconstruction:

posed posed-full

§Citations

§Original

§My Applications

  • Chang, Y., Chang, JL., Lee, JJ. (2024). Atlas-Based Path Synthesis of Planar Four-Bar Linkages Using Elliptical Fourier Descriptors. In: Okada, M. (eds) Advances in Mechanism and Machine Science. IFToMM WC 2023. Mechanisms and Machine Science, vol 149. Springer, Cham. https://doi.org/10.1007/978-3-031-45709-8_20
  • Chang, Y., Chang, JL. & Lee, JJ. Path Synthesis of Planar Four-bar Linkages for Closed and Open Curves Using Elliptical Fourier Descriptors. J Mech Sci Technol (2024). http://doi.org/10.1007/s12206-024-0436-y

§Features

This crate supports no-std solution. Disable the “std” feature will enable it.

default-features = false

Re-exports§

pub extern crate nalgebra as na;

Modules§

posed
Posed EFD (Elliptic Fourier Descriptor) is a special shape to describe the pose of a curve. It is a combination of two curves, the first is the original curve, and the second is the pose unit vectors.
util
Utility functions for the library.

Structs§

Efd
Elliptical Fourier Descriptor coefficients. Provide transformation between discrete points and coefficients.
GeoVar
Geometric variables.
MotionSig
Motion signature with the target position.
PathSig
Path signature with the target position.
PosedEfd
An open-curve shape with a pose described by EFD.

Enums§

U
EFD dimension marker.

Traits§

Curve
Copy-on-write curve type.
Distance
Be able to calculate the distance between two instances.
EfdDim
Trait for the dimension U<D> of EFD.
RotHint
Rotation hint for GeoVar.

Functions§

get_norm_t
Get the normalized time parameters of the curve.
harmonic
Calculate the number of harmonics.
harmonic_nyquist
Calculate the number of harmonics with the Nyquist frequency.

Type Aliases§

Coeffs
Coefficients type.
Efd1
A 1D shape described by EFD.
Efd2
A 2D shape described by EFD.
Efd3
A 3D shape described by EFD.
GeoVar1
1D geometric type.
GeoVar2
2D geometric type.
GeoVar3
3D geometric type.
Kernel
An owned matrix of specific coefficients. (Dx2)
PosedEfd1
A 1D shape with a pose described by EFD.
PosedEfd2
A 2D shape with a pose described by EFD.
PosedEfd3
A 3D shape with a pose described by EFD.
Rot
Rotation type of the EFD.