👷
RandomLogos.AffineRandomLogos.SigmaFactorIFSRandomLogos.generate_pointsRandomLogos.generate_points!RandomLogos.renderRandomLogos.renderRandomLogos.renderRandomLogos.render!RandomLogos.sample_svs
RandomLogos.Affine — TypeType 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)RandomLogos.SigmaFactorIFS — TypeType 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!
RandomLogos.generate_points! — Methodgenerate_points!(rng::AbstractRNG, xs::Vector, ys::Vector, ifs::SigmaFactorIFS{2,T}, H::Integer, W::Integer) where {T<:AbstractFloat}In-place version of generate_points
RandomLogos.generate_points — Methodgenerate_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.
RandomLogos.render! — Methodrender!In-place version of render
RandomLogos.render — Methodrender(configpath::AbstractString)Load TOML configuration file from configpath and convert to config::Config. Then call render(config)
RandomLogos.render — Methodrender(config::Config)Generates a geometry object according to config to be used in generating one.
RandomLogos.render — Methodrender(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.
RandomLogos.sample_svs — Methodsample_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 σₖ₂.