FastLED 3.9.15
Loading...
Searching...
No Matches
corkscrew.h File Reference

Detailed Description

Corkscrew projection utilities.

You want to draw on a rectangular surface, and have it map to a GOD DAMN CORKSCREW! Well guess what, this is the file for you.

Corkscrew projection maps from Corkscrew angle height, (θ, h) to Cylindrical cartesian (w, h) space, where w = one turn of the Corkscrew. The corkscrew at (0) will map to the first index in the cylinder map at (0, 0). The last value is probly not at the max pixel value at (width - 1, height - 1), but could be.

Inputs:

  • Total Height of the Corkscrew in centimeters
  • Total angle of the Corkscrew (number of veritcal segments × 2π)
  • Optional offset circumference (default 0)
    • Allows pixel-perfect corkscrew with gaps via circumference offsetting
    • Example (accounting for gaps):
      • segment 0: offset circumference = 0, circumference = 100
      • segment 1: offset circumference = 100.5, circumference = 100
      • segment 2: offset circumference = 101, circumference = 100

Outputs:

  • Width and Height of the cylindrical map
    • Width is the circumference of one turn
    • Height is the total number of vertical segments
  • Vector of vec2f {width, height} mapping corkscrew (r,c) to cylindrical {w,h}

Definition in file corkscrew.h.

#include "fl/allocator.h"
#include "fl/geometry.h"
#include "fl/math_macros.h"
#include "fl/pair.h"
#include "fl/tile2x2.h"
#include "fl/vector.h"
+ Include dependency graph for corkscrew.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  fl::Corkscrew
 
struct  fl::CorkscrewInput
 Generates a mapping from corkscrew to cylindrical coordinates. More...
 
struct  fl::CorkscrewState
 
class  fl::CorkscrewState::iterator
 

Namespaces

namespace  fl
 Implements a simple red square effect for 2D LED grids.