[][src]Function geopattern::triangular_mesh

pub fn triangular_mesh(
    side: f32,
    (width, height): (usize, usize),
    entropy: &[(f32, f32)],
    fill: &[(&str, f32)],
    stroke: (f32, &str, f32),
    background_color: &str
) -> Document

Triangular Mesh

https://generativeartistry.com/tutorials/triangular-mesh/

fill has required size (4 * width - 2) * height

entropy has required size width * (height + 1)

use geopattern::triangular_mesh;

let c = triangular_mesh(
    60.0,
    (2, 2),
    &(0..6).map(|v| (0.02 + (v as f32) / 4.0, 0.02 + (v as f32) / 4.0)).collect::<Vec<(f32, f32)>>(),
    &(0..12).map(|v| ("#ddd", 0.2)).collect::<Vec<(&str, f32)>>(),
    (1.0, "#ddd", 0.2),
    "#987987",
);

println!("{}", c);