header

 

More links

AutoHotkey | Android | Arduino | COMM140Fractals | Grammar Checkers | Knots | A Million Dots Activity |  Processing | Processing for Scratch Users | RedBubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.

Home > Processing > examples > Phyllotaxis

Phyllotaxis

 

Processing is an open source programming language and environment for people who want to create images, animations, and interactions. Initially developed to serve as a software sketchbook and to teach fundamentals of computer programming within a visual context, Processing also has evolved into a tool for generating finished professional work. Today, tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production.

 

// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/KWoJgHFYWxY
// Coding Challenge #30: Phyllotaxis
// http://algorithmicbotany.org/papers/abop/abop-ch4.pdf
// https://raw.githubusercontent.com/CodingTrain/Rainbow-Code/master/challenges/CC_30_Phyllotaxis/CC_30_Phyllotaxis.pde


int n = 200016;
float c = 8.5;
float start = 0;
float hu ;
float radius = 0;

float rrr, ggg, bbb;
int x = 0;

void setup() {
  size(800, 600);
  // size(13500, 13500);

  background(0);
  stroke(0);
  strokeWeight(.5);
  println("Running");
}


void draw() {
  dot(x);
  x ++;
}

void dot (int i) {
  translate(width / 2, height / 2);
  float a = i * radians(137.51);
  float r = c * sqrt(i);
  float x = r * cos(a);
  float y = r * sin(a);

  rrr = ((a + r) * 3) % 260;
  ggg = ((a) * r + 155) % 260;
  bbb = (a - 50) % 260;


  fill(rrr, ggg, bbb);

  println(rrr + " " + ggg + " "  + bbb);
  noStroke();

  radius = 2  + log(i) * 3; // increase dot size as you move outwards
  ellipse(x, y, radius, radius);
}

 


APA citation:
Russell, R. (2017, January 30, 03:48 am). Phyllotaxis.
     Retrieved May 06, 2024, from
     http://www.rupert.id.au/processing/examples/phyllotaxis/index.php

Last refreshed: May 06 2024. 10:27.13 pm

rupert dot russell at acu dot edu dot au Support Wikipedia

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.


1653 Visits since January 30, 2017