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

◆ makeCorkScrew()

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

Definition at line 59 of file old.h.

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

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

+ Here is the call graph for this function: