MCPcopy Create free account
hub / github.com/FastLED/FastLED / makeRingScreenMap

Function makeRingScreenMap

examples/AnimartrixRing/ring_screenmap.cpp:10–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#endif
9
10fl::ScreenMap makeRingScreenMap(int numLeds, int gridWidth, int gridHeight,
11 float diameter) {
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}

Callers

nothing calls this directly

Calls 3

ScreenMapClass · 0.50
cosFunction · 0.50
sinFunction · 0.50

Tested by

no test coverage detected