1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! This crate implements Elliptical Fourier Descriptor (EFD) and its related functions.
//!
//! Simple usage of resampling circle:
//!
//! ```
//! use efd::Efd;
//! use ndarray::{stack, Array1, Axis};
//! use std::f64::consts::TAU;
//!
//! const N: usize = 10;
//! let circle = stack![
//!     Axis(1),
//!     Array1::linspace(0., TAU, N).mapv(f64::cos),
//!     Array1::linspace(0., TAU, N).mapv(f64::sin)
//! ];
//! # assert_eq!(circle.shape(), &[10, 2]);
//! let curve = circle
//!     .axis_iter(Axis(0))
//!     .map(|c| [c[0], c[1]])
//!     .collect::<Vec<_>>();
//! let new_curve = Efd::from_curve(&curve, None).generate(20);
//! # assert_eq!(new_curve.len(), 20);
//! ```
//!
//! # Features
//!
//! This crate support no-std solution via using "libm",
//! a crate provide pure-rust math functions, please enable it if disabled the "std" feature.
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
#[cfg(not(feature = "std"))]
extern crate core as std;

#[cfg(not(any(feature = "std", feature = "libm")))]
compile_error!("please enable math function from either \"std\" or \"libm\"");

pub use crate::{efd::*, geo_info::*};

mod efd;
mod geo_info;
mod math;
pub mod tests;