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

◆ makeScreenMap()

fl::ScreenMap makeScreenMap ( corkscrew_args args = corkscrew_args())

Definition at line 95 of file old.h.

95 {
96 // Create a ScreenMap for the corkscrew
97 fl::vector<vec2f> points(args.num_leds);
98
99 int num_leds = args.num_leds;
100 float leds_per_turn = args.leds_per_turn;
101 float width_cm = args.width_cm;
102
103
104 const float circumference = leds_per_turn;
105 const float radius = circumference / (2.0 * PI); // radius in mm
106 const float angle_per_led = 2.0 * PI / leds_per_turn; // degrees per LED
107 const float height_per_turn_cm = width_cm; // 10cm height per turn
108 const float height_per_led =
109 height_per_turn_cm /
110 leds_per_turn * 1.3; // this is the changing height per led.
111
112
113
114 for (int i = 0; i < num_leds; i++) {
115 float angle = i * angle_per_led; // angle in radians
116 float r = radius + 10 + i * height_per_led; // height in cm
117
118 // Calculate the x, y coordinates for the corkscrew
119 float x = r * cos(angle); // x coordinate
120 float y = r * sin(angle); // y coordinate
121
122 // Store the 2D coordinates in the vector
123 points[i] = vec2f(x, y);
124 }
125
126 FASTLED_WARN("Creating ScreenMap with:\n" << points);
127
128 // Create a ScreenMap from the points
129 fl::ScreenMap screenMap(points.data(), num_leds, .5);
130 return screenMap;
131}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
fl::ScreenMap screenMap
Definition curr.h:119
#define PI
Definition math_macros.h:63
vec2< float > vec2f
Definition geometry.h:318
HeapVector< T, Allocator > vector
Definition vector.h:1074
fl::ScreenMap screenMap
Definition old.h:144
corkscrew_args args
Definition old.h:142
#define FASTLED_WARN
Definition warn.h:7

References args, fl::HeapVector< T, Allocator >::data(), FASTLED_WARN, PI, screenMap, x, and y.

+ Here is the call graph for this function: