19inline float clampf(
float v,
float lo,
float hi) {
20 return v < lo ? lo : (v > hi ? hi : v);
31 RGBf(
float r_,
float g_,
float b_) :
r(r_),
g(g_),
b(b_) {}
51float falloff(
float distance,
float sigma);
70 int size()
const {
return static_cast<int>(
mPx.size()); }
75 void lobe(
float pos,
float sigma,
const RGBf &color,
float gain);
79 void ring(
float origin,
float radius,
float sigma,
const RGBf &color,
83 void fill(
const RGBf &color,
float gain);
86 void pixel(
int i,
const RGBf &color,
float gain);
89 float posOf(
int i)
const;
float posOf(int i) const
Position of pixel i in turns.
void pixel(int i, const RGBf &color, float gain)
Add to one pixel, index wrapped.
void lobe(float pos, float sigma, const RGBf &color, float gain)
Add a smooth lobe centred at pos (turns) with half-width sigma (turns).
void fill(const RGBf &color, float gain)
Add the same colour to every pixel.
void ring(float origin, float radius, float sigma, const RGBf &color, float gain)
Add a band at distance radius (turns, 0..0.5) from origin, on both sides of it at once: an expanding ...
RingCanvas(fl::span< RGBf > px)
float unit()
Uniform in [0, 1).
Xorshift(fl::u32 seed=0x9E3779B9u)
float smoothstepf(float e0, float e1, float x)
0 below e0, 1 above e1, smooth in between.
float ringDistance(float a, float b)
Shortest distance between two ring positions, in turns, in [0, 0.5].
CRGB toCRGB(const RGBf &p)
float clampf(float v, float lo, float hi)
float ringOffset(float a, float b)
Signed shortest offset from b to a on the ring, in (-0.5, 0.5].
float falloff(float distance, float sigma)
Smooth bump: 1 at distance 0, 0 at distance >= sigma.
float wrapTurns(float t)
Wrap into [0, 1).
RGBf(float r_, float g_, float b_)
Linear-light float pixel, nominal range [0, 1], may exceed 1 before clip.