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

◆ makeCorkScrew()

fl::vector< vec3f > makeCorkScrew ( corkscrew_args args = corkscrew_args())

Definition at line 67 of file old.h.

67 {
68 // int num_leds, float leds_per_turn, float width_cm
69 int num_leds = args.num_leds;
70 float leds_per_turn = args.leds_per_turn;
71 float width_cm = args.width_cm;
72
73 const float circumference = leds_per_turn;
74 const float radius = circumference / (2.0 * PI); // radius in mm
75 const float angle_per_led = 2.0 * PI / leds_per_turn; // degrees per LED
76 const float total_angle_radians = angle_per_led * num_leds;
77 const float total_turns = total_angle_radians / (2.0 * PI); // total turns
78 const float height_per_turn_cm = width_cm; // 10cm height per turn
79 const float height_per_led =
80 height_per_turn_cm /
81 leds_per_turn; // this is the changing height per led.
82 const float total_height =
83 height_per_turn_cm * total_turns; // total height of the corkscrew
85 for (int i = 0; i < num_leds; i++) {
86 float angle = i * angle_per_led; // angle in radians
87 float height = (i / leds_per_turn) * height_per_turn_cm; // height in cm
88
89 // Calculate the x, y, z coordinates for the corkscrew
90 float x = radius * cos(angle); // x coordinate
91 float z = radius * sin(angle); // y coordinate
92 float y = height; // z coordinate
93
94 // Store the 3D coordinates in the vector
95 vec3f led_position(x, y, z);
96 // screenMap.set(i, led_position);
97 out.push_back(led_position);
98 }
99 return out;
100}
int y
Definition simple.h:93
int x
Definition simple.h:92
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:94
void push_back(const T &value)
Definition vector.h:552
#define PI
Definition math_macros.h:89
vec3< float > vec3f
Definition geometry.h:185
HeapVector< T, Allocator > vector
Definition vector.h:1214
corkscrew_args args
Definition old.h:150

References args, PI, fl::HeapVector< T, Allocator >::push_back(), x, y, and z.

+ Here is the call graph for this function: