Giter VIP home page Giter VIP logo

qhull-rs's Introduction

qhull-rs

Safe Rust Qhull bindings

Crates.io Version Build Status docs.rs

Qhull computes the convex hull, Delaunay triangulation, Voronoi diagram, halfspace intersection about a point, furthest-site Delaunay triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d, 3-d, 4-d, and higher dimensions. Qhull implements the Quickhull algorithm for computing the convex hull. It handles roundoff errors from floating point arithmetic. It computes volumes, surface areas, and approximations to the convex hull.

Qhull does not support triangulation of non-convex surfaces, mesh generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay triangulations.

    - Qhull main page (retrieved 2024-09-02)

Quick start

cargo run --example hull

Binaries

qhull-rs provides some binary targets from the original Qhull source code:

  • qconvex
  • qdelaunay
  • qhalf
  • qhull
  • qvoronoi
  • rbox

To get them:

cargo install qhull
qhull

Usage

Add this to your Cargo.toml:

qhull = "0.3"

For the current development version:

[dependencies]
qhull = { git = "https://github.com/LucaCiucci/qhull-rs" }

Example

A 2D convex hull:

use qhull::Qh;

let qh = Qh::builder()
    .compute(true)
    .build_from_iter([
        [0.0, 0.0],
        [1.0, 0.0],
        [0.0, 1.0],
        [0.25, 0.25],
    ]).unwrap();

for simplex in qh.simplices() {
    let vertices = simplex
        .vertices().unwrap()
        .iter()
        .map(|v| v.id())
        .collect::<Vec<_>>();

    println!("{:?}", vertices);
}

See the [examples] module/folder for more examples.

License

This crate uses Qhull, please refer to the Qhull license for more information when using this crate.

qhull-rs's People

Contributors

lucaciucci avatar

Watchers

 avatar

Forkers

eniraa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.