struct ColorUtil::BakedPalette
- ColorUtil::BakedPalette
- Struct
- Value
- Object
Defined in:
colorutil/baked_palette.crConstant Summary
-
EXPLORATION_TOLERANCE =
50
-
ITERATIONS =
500
-
NEIGHBOUR_COEFFICIENT =
1_f64
Constructors
Class Method Summary
-
.acceptance_probability(energy, new_energy, temp)
Returns the probability of accepting a new state given the annealing temperatue and the energy of the new state.
-
.d_contrast(fixed, wrt) : Float64
Returns the partial derivative of the WCAG contrast function in the variable
wrt
(with respect to) when the other lightness isfixed
. -
.energy(state, rules, max_error)
Returns the energy for a state.
- .error(lightness : Tensor(Float64), rules : Array(Array(Float))) : Float64
-
.error_gradient(lightness : Tensor(Float64), rules : Array(Array(Float64))) : Tensor(Float64)
Returns a tensor of the same size as the input storing the analytic solution for the error gradient in each variable.
-
.max_error(rules)
Returns an upper bound on how large the error in a system could be given a set of rules.
-
.neighbour(state, temp)
Returns a modified version of the state according to the annealing temperature.
-
.temperature(completion)
Returns the annealing temperature at a certain completion step in the domain [0, 1].
Constructor Detail
Class Method Detail
Returns the probability of accepting a new state given the annealing temperatue and the energy of the new state. Requires normalized energies on [0, 1]
Returns the partial derivative of the WCAG contrast function in the variable
wrt
(with respect to) when the other lightness is fixed
.
Returns the energy for a state. This is quite wishy-washy - for a random set of lightnesses, I found that almost all of them had miniscule energy compared to the maximum error possible. So, i played with tanh to try to normalize the outputs into a more uniform range. The coefficient 51 gave me a mean energy of 0.5, so that's what i stuck with.
Returns a tensor of the same size as the input storing the analytic solution for the error gradient in each variable.
Returns an upper bound on how large the error in a system could be given a set of rules. This upper bound is not exact - it assumes that the contrast error is always the largest that it could be, which for some rule sets, may be contradictory. For example, if there are two rules between two colors, dictating that they contraast fully and not at all, this method will return an unattainable error level.
Returns a modified version of the state according to the annealing temperature.
Returns the annealing temperature at a certain completion step in the domain [0, 1]. This function, too, returns a number in the range [0, 1].