#curve #parameters #shape

catenary

A library for catenary curves

3 releases

new 0.1.2 Mar 14, 2025
0.1.1 Feb 21, 2025
0.1.0 Feb 21, 2025

#9 in #shape

Download history 214/week @ 2025-02-16 55/week @ 2025-02-23 26/week @ 2025-03-02 65/week @ 2025-03-09

360 downloads per month

MIT/Apache

52KB
921 lines

Catenary

Catenary is a Rust library for calculating catenary curves. It provides tools to model the shape of a hanging flexible chain or cable under its own weight.

Features

  • Calculate catenary curves from given parameters
  • Easy to integrate with other Rust projects

Installation

Add this to your Cargo.toml:

[dependencies]
catenary = "0.1.0"

Usage

Here is a simple example of how to use Catenary:

extern crate catenary;

use catenary::Catenary;

fn main() {
    let catenary = Catenary::new(1.1, 2.2, 3.3, -4.4, 5.5);
    let (p0, p1) = catenary.end_points();

    let solved = Catenary::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);
}

License

This project is licensed under the MIT or Apache-2.0 Licenses.

Contribution

Contributions are welcome! Please open an issue or submit a pull request on GitLab.

Dependencies

~8MB
~161K SLoC