Skip to content

Rust implementation of the treemap squarify algorithm

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

dweb0/squarify-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Squarify-rs

Build Status License

Rust implementation of the squarify algorithm.

This is a direct translation of the python implementation here. All credit goes to these developers.

Usage

Add this to your Cargo.toml:

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

Will eventually publish to crates.io when ready.

Example

use squarify::squarify;

fn main() {
    let values = vec![500.0, 433.0, 78.0, 25.0, 25.0, 7.0];
    let rects = squarify(&values, 0.0, 0.0, 1000.0, 1000.0, None);

    for rect in rects {
        println!("{:?}", rect);
    }
    
    // Output
    // Rect { x: 0.0, y: 0.0, dx: 1000.0000000000001, dy: 468.16479400749057 }
    // Rect { x: 0.0, y: 468.16479400749057, dx: 1000.0000000000001, dy: 405.43071161048687 }
    // Rect { x: 0.0, y: 873.5955056179774, dx: 1000.0000000000001, dy: 73.03370786516854 }
    // Rect { x: 0.0, y: 946.629213483146, dx: 1000.0000000000001, dy: 23.40823970037453 }
    // Rect { x: 0.0, y: 970.0374531835206, dx: 1000.0000000000001, dy: 23.40823970037453 }
    // Rect { x: 0.0, y: 993.4456928838952, dx: 1000.0000000000001, dy: 6.5543071161048685 }
}

About

Rust implementation of the treemap squarify algorithm

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages