#空间 #景观 #中性 #生态 #图形 #nlm

nlmrs

A Rust crate for building Neutral Landscape Models

8个版本

0.1.7 2023年1月18日
0.1.6 2023年1月9日

#277 in 图像

MIT许可

33KB
763

NLMrs

A Rust crate for building Neutral Landscape Models.

Inspired by nlmpy and nlmr.

安装

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::write_to_csv};

fn main() {
    let arr: Vec<Vec<f64>> = distance_gradient(50, 50);
    write_to_csv(arr, "./data/data.csv");
}

可视化

Running script/viz.py will read any contents of data/data.csv and render them as a matplotlib plot.

算法

随机

random(100, 100)

随机元素

random_element(100, 100, 50000.)

平面梯度

planar_gradient(100, 100, 一些(60.))

边缘梯度

edge_gradient(100, 100, 一些(140.))

距离梯度

distance_gradient(100, 100)

波形梯度

wave_gradient(100, 100, 2.5, 一些(90.))

中点位移

midpoint_displacement(100, 100, 1.)

山丘生长

hill_grow(100, 100, 10000, true)

贡献

欢迎贡献、问题和功能请求。

  • Fork它 (https://github.com/tom-draper/nlmrs)
  • 创建你的功能分支 (git checkout -b my-new-feature)
  • 提交你的更改 (git commit -am 'Add some feature')
  • 推送到分支 (git push origin my-new-feature)
  • 创建新的Pull Request

依赖项

~1.5–2MB
~26K SLoC