Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
Post image 6
Post image 7
Post image 8
Post image 9
Post image 10
Post image 11
Post image 12
Post image 13
1 / 13
0

Phyllotaxis: An audio-reactive LED display

Hacker News·about 16 hours ago
#N0DDvSgO
#jagi#phyllotaxis#led#neopixel#voronoi#photo
Reading 0:00
15s threshold

I’ve been fascinated by understanding patterns that appear in nature, through code. Communing with the inherent emergent patterns that exist in the universe. The phyllotaxis is one such pattern, the expanding double-spiral shape that appears in the center of sunflowers, succulents, other plants. It’s surprisingly simple code: // Inner and outer are throw-away, // just for spacing the cells that are used float [][] points = new float [ numCells + numOuter + numInner ][ 2 ] ; float outerRadius = width / 2 ; final int total = numCells + numInner + numOuter ; for ( int i = 0 ; i < total ; i ++ ) { float f = i / float ( total ); float a = i * 1 . 6180339887 ; float distance = f * outerRadius ; float x = - cos ( a * TWO_PI ) * distance ; float y = sin ( a * TWO_PI ) * distance ; points [ i ][ 0 ] = x ; points [ i ][ 1 ] = y ; } Take a number of linear points on a radial line of a circle, and rotate each one by an increasing multiple of the golden ratio.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More