A Rust crate for building Neutral Landscape Models.
cargo add nlmrs
use nlmrs;
fn main() {
let arr: Vec<Vec<f64>> = nlmrs::midpoint_displacement(10, 10, 1.);
println!("{:?}", arr);
}
The export
module holds a collection of user-friendly functions to export your 2D NLM vector.
use nlmrs::{distance_gradient, export};
fn main() {
let arr: Vec<Vec<f64>> = distance_gradient(50, 50);
export::write_to_csv(arr, "./data/data.csv");
}
Running scripts/visualize.py
will read any contents of data/data.csv
and render them as a matplotlib plot.
random(rows: 100, cols: 100)
random_element(rows: 100, cols: 100, n: 50000.)
planar_gradient(rows: 100, cols: 100, direction: Some(60.))
edge_gradient(rows: 100, cols: 100, direction: Some(140.))
distance_gradient(rows: 100, cols: 100)
wave_gradient(rows: 100, cols: 100, period: 2.5, direction: Some(90.))
midpoint_displacement(rows: 100, cols: 100, h: 1.)
hill_grow(rows: 100, cols: 100, n: 10000, runaway: true, kernel: None, only_grow: false)
Contributions, issues and feature requests are welcome.
- Fork it (https://github.com/tom-draper/nlmrs)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request