geosets-rs 0.1.1

A Rust library for continuous set arithmetic.
docs.rs failed to build geosets-rs-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

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.