Crates.io | catenary |
lib.rs | catenary |
version | |
source | src |
created_at | 2025-02-21 10:26:23.514615+00 |
updated_at | 2025-03-31 12:44:44.710404+00 |
description | A library for catenary curves |
homepage | https://gitlab.com/youbihub/catenary |
repository | https://gitlab.com/youbihub/catenary |
max_upload_size | |
id | 1563911 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
Add this to your Cargo.toml
:
[dependencies]
catenary = "0.1.0"
In order to quickly find catenary, with 2 points and a length, we can interpolate between catenaries that have been saved into a table. To regenerate this table, do:
cargo run --bin generate_table -- --help
Getting the desired catenary by interpolation from the table is done with this function:
let cat = table.get_catenary::<f64>(&p0, &p1, &l).unwrap();
let path = get_dataset_path().await.unwrap();
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 = 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);
}
This project is licensed under the MIT or Apache-2.0 Licenses.
Contributions are welcome! Please open an issue or submit a pull request on GitLab.