Isotope.Utils (Isotope v0.5.0)

Copy Markdown View Source

Utility functions for working with noise maps.

Visualization

{:ok, noise} = Isotope.Noise.new(%Isotope.Options{seed: 42})
nm = Isotope.Noise.noise_map(noise, {80, 40})
Isotope.Utils.show_noisemap(nm)

This renders the noise map to the terminal using ANSI 256-color codes. Each value is mapped to a color index and displayed as a character. Requires a terminal with ANSI color support.

Summary

Functions

Shows the given noise map on the stdout using ANSI color codes.

Functions

show_noisemap(noisemap)

@spec show_noisemap(Isotope.NoiseMap.t()) :: :ok

Shows the given noise map on the stdout using ANSI color codes.

This won't work if your terminal doesn't support ANSI color codes.

{:ok, noise} = Isotope.Noise.new()
noise |> Isotope.Noise.noise_map({50, 50})
      |> Isotope.Utils.show_noisemap()
# Outputs noise visualization
:ok