Colors
Linear interpolation
SolverTraces.safe_lerp
— Functionsafe_lerp(a, b, t)
Safe implementation of linear interpolation (lerp) between a
and b
, where t
is the linear parameter. If isnan(t)
, a
is returned, and if t
is infinite, a
or b
is returned, depending on the sign.
SolverTraces.ilerp
— Functionilerp(a, b, t)
Linear interpolation in integer steps.
SolverTraces.sat_ilerp
— Functionsat_ilerp(a, b, t)
Saturated linear interpolation in integer steps, clamped to the range 0:255
(the available colour space).
Color scales
SolverTraces.LinearColorant
— TypeLinearColorant(a, b, colors)
Helper structure to linearly interpolate between the possible values in colors
, where the scalar value a
corresponds to the first value and b
to the last. If colors
is a tuple of two triples, a continuous interpolation between the endpoints will be the result, whereas if it is a vector of Crayon
s, nearest neighbour interpolation will be performed instead.
SolverTraces.red_green_scale
— Functionred_green_scale()
Return a red–green colour scale; on Windows (with only 16 colours available), this is simply red, yellow, green, on other systems, the end-points are returned instead, for use with sat_ilerp
.