fn worley_noise(
    str_reg_size: &str,
    str_positive_threshold: &str,
    str_node_per_region_chance: &str,
    str_width: &str,
    str_height: &str,
) -> Result<String> {
    let region_size = str_reg_size.parse::<i32>()?;
    let positive_threshold = str_positive_threshold.parse::<f32>()?;
    let width = str_width.parse::<i32>()?;
    let height = str_height.parse::<i32>()?;
    let node_per_region_chance = str_node_per_region_chance.parse::<f32>()?;

    //i fucking mixed up width and height again. it really doesnt matter but here is a comment just warning you.
    let mut map = Map::new(region_size, height, width, node_per_region_chance);

    map.generate_noise(positive_threshold as f32);

    let mut output = String::new();

    for row in map.cell_map {
        for cell in row {
            if cell.value {
                let _ = write!(output, "1");
            } else {
                let _ = write!(output, "0");
            }
        }
    }
    Ok(output)
}
// This is a quite complex algorithm basically what it does is it creates 2 maps, one filled with cells and the other with 'regions' that map onto these cells.
// Each region can spawn 1 node, the cell then determines wether it is true or false depending on the distance from it to the nearest node in the region minus the second closest node.
// If this distance is greater than the threshold then the cell is true, otherwise it is false.
This is a quite complex algorithm basically what it does is it creates 2 maps, one filled with cells and the other with 'regions' that map onto these cells.
Each region can spawn 1 node, the cell then determines wether it is true or false depending on the distance from it to the nearest node in the region minus the second closest node.
If this distance is greater than the threshold then the cell is true, otherwise it is false.
This is a quite complex algorithm basically what it does is it creates 2 maps one filled with cells and the other with ' regions ' that map onto these cells . Each region can spawn 1 node the cell then determines wether it is true or false depending on the distance from it to the nearest node in the region minus the second closest node . If this distance is greater than the threshold then the cell is true otherwise it is false .
fn worley_noise(
    str_reg_size: &str,
    str_positive_threshold: &str,
    str_node_per_region_chance: &str,
    str_width: &str,
    str_height: &str,
) -> Result<String> {
    let region_size = str_reg_size.parse::<i32>()?;
    let positive_threshold = str_positive_threshold.parse::<f32>()?;
    let width = str_width.parse::<i32>()?;
    let height = str_height.parse::<i32>()?;
    let node_per_region_chance = str_node_per_region_chance.parse::<f32>()?;
    //i fucking mixed up width and height again. it really doesnt matter but here is a comment just warning you.
    let mut map = Map::new(region_size, height, width, node_per_region_chance);
    map.generate_noise(positive_threshold as f32);
    let mut output = String::new();
    for row in map.cell_map {
        for cell in row {
            if cell.value {
                let _ = write!(output, "1");
            } else {
                let _ = write!(output, "0");
            }
        }
    }
    Ok(output)
}
fn worley_noise ( str_reg_size : & str , str_positive_threshold : & str , str_node_per_region_chance : & str , str_width : & str , str_height : & str , ) -> Result < String > { let region_size = str_reg_size . parse :: < i32 > ( ) ? ; let positive_threshold = str_positive_threshold . parse :: < f32 > ( ) ? ; let width = str_width . parse :: < i32 > ( ) ? ; let height = str_height . parse :: < i32 > ( ) ? ; let node_per_region_chance = str_node_per_region_chance . parse :: < f32 > ( ) ? ; //i fucking mixed up width and height again. it really doesnt matter but here is a comment just warning you. let mut map = Map :: new ( region_size , height , width , node_per_region_chance ) ; map . generate_noise ( positive_threshold as f32 ) ; let mut output = String :: new ( ) ; for row in map . cell_map { for cell in row { if cell . value { let _ = write ! ( output " " ) ; } else { let _ = write ! ( output " " ) ; } } } Ok ( output ) }
This is a quite complex algorithm basically what it does is it creates 2 maps, one filled with cells and the other with 'regions' that map onto these cells.
This is a quite complex algorithm basically what it does is it creates 2 maps one filled with cells and the other with ' regions ' that map onto these cells .
str_reg_size
&str
str_positive_threshold
&str
str_node_per_region_chance
&str
str_width
&str
str_height
&str
str_reg_size
&str
str_positive_threshold
&str
str_node_per_region_chance
&str
str_width
&str
str_height
&str