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

◆ makeCorkScrew()

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

Definition at line 66 of file old.h.

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

References args, fl::cos(), FL_PI, fl::vector< T >::push_back(), fl::sin(), x, y, and z.

+ Here is the call graph for this function: