8 releases
0.1.7 | Jan 18, 2023 |
---|---|
0.1.6 | Jan 9, 2023 |
#362 in Images
50 downloads per month
33KB
763 lines
NLMrs
A Rust crate for building Neutral Landscape Models.

Installation
cargo add nlmrs
Example
use nlmrs;
fn main() {
let arr: Vec<Vec<f64>> = nlmrs::midpoint_displacement(10, 10, 1.);
println!("{:?}", arr);
}
Export
The export
module holds a collection of user-friendly functions to export your 2D NLM vector.
use nlmrs::{distance_gradient, export::write_to_csv};
fn main() {
let arr: Vec<Vec<f64>> = distance_gradient(50, 50);
write_to_csv(arr, "./data/data.csv");
}
Visualization
Running script/viz.py
will read any contents of data/data.csv
and render them as a matplotlib plot.
Algorithms
Random
random(100, 100)

Random Element
random_element(100, 100, 50000.)

Planar Gradient
planar_gradient(100, 100, Some(60.))

Edge Gradient
edge_gradient(100, 100, Some(140.))

Distance Gradient
distance_gradient(100, 100)

Wave Gradient
wave_gradient(100, 100, 2.5, Some(90.))

Midpoint Displacement
midpoint_displacement(100, 100, 1.)

Hill Grow
hill_grow(100, 100, 10000, true)

Contributions
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
Dependencies
~1.4–2MB
~25K SLoC