Crate geosets_rs

Source
Expand description

§geosets-rs

CI Coverage Status Crates.io docs.rs License

A Rust library for continuous set arithmetic.

§Features

The following set representations are supported

  • H-Polytopes (Half-space representation)
  • V-Polytopes (Vertex representation)
  • Zonotopes
  • Intervals

§Installation

Add this to your Cargo.toml:

cargo add geosets-rs

§System Dependencies

This library depends on several system libraries that need to be installed:

§Ubuntu/Debian
sudo apt-get install libcdd-dev libopenblas-dev liblapack-dev pkg-config clang libclang-dev coinor-cbc coinor-libcbc-dev
§macOS
brew install cddlib openblas lapack

§Usage

use geosets_rs::{HPolytope, sets::GeoSet};

let set = HPolytope::from_random(2, 4).unwrap();

// Convert to vertices
let _vertices = set.to_vertices().unwrap();

// Calculate volume
let volume = set.volume().unwrap();
println!("Volume: {}", volume);

// Translate the set
let translation = ndarray::Array1::ones(2);
let translated = set.translate(&translation).unwrap();

// Plot
let mut plot = translated.plot((0, 1), true, false).unwrap();

// Plot with original
let original_trace = set
    .create_trace((0, 1), Some("Original VPolytope"))
    .unwrap();
plot.add_trace(original_trace);

// Uncomment to show
// plot.show();

§License

This project is licensed under the MIT License - see the LICENSE file for details.

§Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Re-exports§

pub use sets::GeoSet;
pub use sets::hpolytope::HPolytope;
pub use sets::interval::Interval;
pub use sets::vpolytope::VPolytope;
pub use sets::zonotope::Zonotope;

Modules§

sets

Functions§

compute_polytope_vertices
Computes the vertices of a polytope defined by the inequality Ax ≤ b.
order_vertices_clockwise