catenary 0.5.0

A library for catenary curves
Documentation
#![feature(iter_map_windows)]
//! This module provides functionality for working with catenary curves.
//!
//! A catenary curve is defined by the equation: `y(x) = a * cosh((x - c) / a) - a + h`
//! where:
//! - `a` is the parameter that controls the shape of the curve.
//! - `c` is the horizontal shift of the curve.
//! - `h` is the vertical shift of the curve.
//! - `s_0` and `s_1` are the arc lengths of the end points (negative on the left of the minimum, positive on the right).
//!
//! The module includes the following functionality:
//! - Representation of a catenary curve with the `Catenary` structure.
//! - Methods for creating and manipulating catenary curves.
//! - Methods for computing various properties of catenary curves, such as the y-coordinate from a given x-coordinate, the x-coordinate from a given y-coordinate, the length of the curve, and the end points of the curve.
//! - Methods for creating a catenary curve from two points and a specified length, with or without an initial guess.
//! - Methods for creating a catenary curve from a line segment.
//! - Implementation of the `LeastSquaresProblem` trait for solving catenary curve fitting problems using the Levenberg-Marquardt algorithm.
//!
//! The module also includes a sub-module for generating a table of catenaries (`table`) and a sub-module for working with roots (`roots`).
//!
//! # Examples
//!
//! ```rust
//! use catenary::{CatMaker, Catenary64};
//! use nalgebra::Point2;
//! use approx::assert_relative_eq;
//!
//! let catenary = CatMaker::a(1.1).c(2.2).h(3.3).s_0(-4.4).s_1(5.5);
//! let (p0, p1) = catenary.end_points();
//! let solved = Catenary64::from_points_length(&p0, &p1, catenary.length()).unwrap();
//!
//! assert_relative_eq!(catenary.a, solved.a, epsilon = 1e-5);
//! assert_relative_eq!(catenary.c, solved.c, epsilon = 1e-5);
//! assert_relative_eq!(catenary.h, solved.h, epsilon = 1e-5);
//! ```

/// Module for working with catenary curves.
pub mod catenary;

/// Module for generating a table of catenaries, so we can easily interpolate between them.
pub mod table;

/// Module for working with roots.
pub mod roots;

pub use catenary::{catmaker::CatMaker, Catenary, Catenary32, Catenary64};
pub use table::{Table, Table32, Table64};