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

◆ makeRingScreenMap()

fl::ScreenMap makeRingScreenMap ( int numLeds,
int gridWidth,
int gridHeight,
float diameter )

Definition at line 10 of file ring_screenmap.cpp.

11 {
12 return fl::ScreenMap(numLeds, diameter, [=](int index, fl::vec2f &pt_out) {
13 float centerX = gridWidth / 2.0f;
14 float centerY = gridHeight / 2.0f;
15 float radius = fl::min(gridWidth, gridHeight) / 2.0f - 1;
16 float angle = (TWO_PI * index) / numLeds;
17 pt_out.x = centerX + fl::cos(angle) * radius;
18 pt_out.y = centerY + fl::sin(angle) * radius;
19 });
20}
#define TWO_PI
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Definition math.h:71
vec2< float > vec2f
Definition geometry.h:333
enable_if< is_fixed_point< T >::value, T >::type cos(T angle) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type sin(T angle) FL_NOEXCEPT
value_type y
Definition geometry.h:191
value_type x
Definition geometry.h:190

References fl::cos(), fl::min(), fl::sin(), TWO_PI, fl::vec2< T >::x, and fl::vec2< T >::y.

+ Here is the call graph for this function: