FastLED 3.9.15
Loading...
Searching...
No Matches

◆ noiseRingHSV16()

HSV16 fl::noiseRingHSV16 ( float angle,
u32 time,
float radius = 1.0f )

Ring noise functions - sample three z-slices for independent component evolution.

Generate HSV16 noise for a ring pattern.

Samples three z-slices of 3D Perlin noise (at time, time+0x10000, time+0x20000) to create independent hue, saturation, and value components.

Parameters
anglePosition around the ring (radians, 0 to 2π)
timeAnimation time parameter
radiusNoise zoom level (level of detail). Larger values = coarser pattern, smaller = more detail (default 1.0)
Returns
HSV16 color with 16-bit components

Definition at line 27 of file noise.cpp.hpp.

27 {
28 // Convert angle to cartesian coordinates
29 float x = fl::cosf(angle);
30 float y = fl::sinf(angle);
31
32 // Map sin/cos values from [-1, 1] to [0, 0xFFFF]
33 // This ensures positive values for uint32_t conversion
34 u32 nx = static_cast<u32>((x + 1.0f) * 0.5f * radius * 0xffff);
35 u32 ny = static_cast<u32>((y + 1.0f) * 0.5f * radius * 0xffff);
36
37 // Sample three different z-slices for H, S, V components
38 // Using offsets 0x0, 0x10000, 0x20000 to separate them in noise space
39 u16 h_raw = inoise16(nx, ny, time);
40 u16 s_raw = inoise16(nx, ny, time + 0x10000);
41 u16 v_raw = inoise16(nx, ny, time + 0x20000);
42
43 // Rescale from observed noise range to full 0-65535 range using global extents
44 u16 h = rescaleNoiseValue16(h_raw);
45 u16 s = rescaleNoiseValue16(s_raw);
46 u16 v = rescaleNoiseValue16(v_raw);
47
48 return HSV16(h, s, v);
49}
fl::u16 inoise16(fl::u32 x, fl::u32 y, fl::u32 z, fl::u32 t)
FASTLED_FORCE_INLINE u16 rescaleNoiseValue16(u16 raw_value)
Rescale raw inoise16() output to full 16-bit range [0, 65535] Curries in the global NOISE16_EXTENT_MI...
Definition noise.cpp.hpp:21
fl::u64 time() FL_NOEXCEPT
Alias for millis64() - returns 64-bit millisecond time.
Definition chrono.h:346
float sinf(float value) FL_NOEXCEPT
Definition math.h:352
float cosf(float value) FL_NOEXCEPT
Definition math.h:358

References cosf(), inoise16(), rescaleNoiseValue16(), sinf(), time(), x, and y.

Referenced by noiseRingHSV8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: