header

 

More links

Adobe Connect | Adobe Conect Custom Pods | AutoHotkey | Android | Arduino | Blog | COMM140Fractals | Grammar Checkers | Knots | a Million Dots |  Processing | RedBubble | Tutorials | Weather | World Time Meeting Planner |

Home > Tutorials > Processing > Processing Examples > Polar Flower v1

Polar Flower v1

Polar Flower

See http://www.physics.emory.edu/~weeks/ideas/rose.html

Code

processing code

// draws a Polar Flower
// Based on code from http://www.physics.emory.edu/~weeks/ideas/rose.html

int screenWidth = 606;
int screenHeight = 625;

void setup() {
  size(screenWidth, screenHeight);

    background(#cccccc);    // grey background
    strokeWeight(0.5);      // thin lines 
    smooth();               // antialias lines
}

float rad;
float theta;
float x;
float y;
float r;

void draw() {
  for (rad = 1; rad < 45; rad ++)  {
    for (theta = 0; theta <= 2.0 * PI; theta += 0.01)  {
      r = rad * (8 + sin(theta * 6 + rad / 10));
      x = r*cos(theta) + screenWidth / 2;
      y = r*sin(theta) + screenHeight / 2;
      ellipse(x,y,1,1);
    }
  }
}
  
// Save tif when mouse is clicked
void mouseClicked(){   
noLoop();
save("polar1_606.png");
}
code formatter

code formatter

 


APA citation:
Russell, R. (2016, July 05, 07:47 am). Polar Flower v1.
     Retrieved December 16, 2017, from http://www.rupert.id.au/tutorials/processing/examples/Lissajous/lissajou_v37.php

Last refreshed: December 16 2017. 12:30.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.


1740 visits since April 10, 2011