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

◆ makeScreenMap()

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

Definition at line 103 of file old.h.

103 {
104 // Create a ScreenMap for the corkscrew
105 fl::vector<vec2f> points(args.num_leds);
106
107 int num_leds = args.num_leds;
108 float leds_per_turn = args.leds_per_turn;
109 float width_cm = args.width_cm;
110
111
112 const float circumference = leds_per_turn;
113 const float radius = circumference / (2.0 * PI); // radius in mm
114 const float angle_per_led = 2.0 * PI / leds_per_turn; // degrees per LED
115 const float height_per_turn_cm = width_cm; // 10cm height per turn
116 const float height_per_led =
117 height_per_turn_cm /
118 leds_per_turn * 1.3; // this is the changing height per led.
119
120
121
122 for (int i = 0; i < num_leds; i++) {
123 float angle = i * angle_per_led; // angle in radians
124 float r = radius + 10 + i * height_per_led; // height in cm
125
126 // Calculate the x, y coordinates for the corkscrew
127 float x = r * cos(angle); // x coordinate
128 float y = r * sin(angle); // y coordinate
129
130 // Store the 2D coordinates in the vector
131 points[i] = vec2f(x, y);
132 }
133
134 FASTLED_WARN("Creating ScreenMap with:\n" << points);
135
136 // Create a ScreenMap from the points
137 fl::ScreenMap screenMap(points.data(), num_leds, .5);
138 return screenMap;
139}
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::ScreenMap screenMap
Definition Corkscrew.h:103
#define PI
Definition math_macros.h:89
vec2< float > vec2f
Definition geometry.h:333
HeapVector< T, Allocator > vector
Definition vector.h:1214
fl::ScreenMap screenMap
Definition old.h:152
corkscrew_args args
Definition old.h:150
#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: