# NLMrs
A Rust crate for building Neutral Landscape Models.
Inspired by [nlmpy](https://pypi.org/project/nlmpy/) and [nlmr](https://github.com/ropensci/NLMR).
## Installation
```bash
cargo add nlmrs
```
## Example
```rs
use nlmrs;
fn main() {
let arr: Vec> = 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.
```rs
use nlmrs::{distance_gradient, export::write_to_csv};
fn main() {
let arr: Vec> = 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