mod from_raw;
mod from_tuples;
mod opts;
#[cfg(test)]
mod test;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
pub use opts::SplineOpts;
pub struct Spline();
impl Spline {
pub fn from_flatten_points(points: &[f64], opts: &SplineOpts) -> Vec<f64> {
from_raw::get_curve_points(points, opts)
}
pub fn from_tuples(points: &[(f64, f64)], opts: &SplineOpts) -> Vec<(f64, f64)> {
from_tuples::get_curve_points(points, opts)
}
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn getCurvePoints(pts: Vec<f64>, tension: f64, num_of_segments: u32) -> Vec<f64> {
let opts = SplineOpts {
tension,
num_of_segments,
disallow_x_stepping_back: true,
};
Spline::from_flatten_points(&pts, &opts)
}