๐Ÿ‘ท

RandomLogos.Affine โ€” Type

Type for an affine transformation

$\textrm{Affine}(x) = Wx + b$

Example

julia> using RandomLogos: Affine
julia> using StaticArrays
julia> W = @SMatrix rand(2, 2)
julia> b = @SVector rand(2)
julia> aff = Affine(W, b)
julia> x = @SVector rand(2)
julia> aff(x)
source
RandomLogos.SigmaFactorIFS โ€” Type

Type for sampling IFS based on SVD approach proposed on this page

Examples

julia> using RandomLogos: SigmaFactorIFS
julia> using RandomLogos: generate_points, render!
julia> using Random, ImageInTerminal, ImageCore
julia> rng = Xoshiro(0)
julia> ifs = rand(rng, SigmaFactorIFS{2}) # create an instance of SigmaFactorIFS
julia> npoints = 100_000; H = W = 384
julia> xs, ys = generate_points(rng, ifs, npoints, H, W)
julia> canvas = zeros(RGB{N0f8}, H, W)
julia> render!(rng, canvas, xs, ys, ifs)

See also generate_points, generate_points!, render and render!

source
RandomLogos.generate_points โ€” Method
generate_points(rng::AbstractRNG, ifs::SigmaFactorIFS{2,T}, n::Integer, H::Integer, W::Integer) where {T<:AbstractFloat}

Generate a sequence of 2D points based on a given Iterated Function System (IFS) and return the coordinates in two separate arrays, xs and ys. The function uses the provided random number generator rng, IFS object ifs, and three integer parameters: n (the number of points to generate), H (height), and W (width).

Arguments

  • rng::AbstractRNG: An object that generates random numbers.
  • ifs::SigmaFactorIFS{2,T}: An Iterated Function System (IFS) to be used in generating points.
  • n::Integer: The number of points to generate.
  • H::Integer: The height of the output space.
  • W::Integer: The width of the output space.

Returns

  • xs: The x-coordinates of the generated points.
  • ys: The y-coordinates of the generated points.
source
RandomLogos.render โ€” Method
render(configpath::AbstractString)

Load TOML configuration file from configpath and convert to config::Config. Then call render(config)

source
RandomLogos.render โ€” Method
render(config::Config)

Generates a geometry object according to config to be used in generating one.

source
RandomLogos.render โ€” Method
render(rng::AbstractRNG, ifs::AbstractIFS{2,T}, config::Config) where {T}

Generates a graphical rendering of 2D points based on a given Iterated Function System (IFS) and configuration. The rendering is created within the bounds defined by the height H and width W parameters provided in config.

Arguments

  • rng::AbstractRNG: An object that generates random numbers.
  • ifs::AbstractIFS{2,T}: An Iterated Function System (IFS) to be used in generating points.
  • config::Config: A configuration object with the following properties:
    • npoints::Integer: The number of points to generate for the rendering.
    • H::Integer: The height of the output space (canvas).
    • W::Integer: The width of the output space (canvas).

Returns

  • canvas: The generated image as an array of RGB values.
source
RandomLogos.sample_svs โ€” Method
sample_svs(rng::AbstractRNG, ฮฑ::T, N::Integer) where {T <: AbstractFloat}

Given ฮฑ so called ฯƒ-factor, create N tuples in the form of (ฯƒโ‚–โ‚, ฯƒโ‚–โ‚‚) for k โˆˆ 1:N such that

$\alpha = \sum_{k=1}^N \sigma_{k1} + 2\sigma_{k2}$

Returns N by 2 matrix ฮฃ::Matrix{T}(N, 2) that satisfies ฮฃ[k, 1] is ฯƒโ‚–โ‚ and ฮฃ[k, 2] is ฯƒโ‚–โ‚‚.

source