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 > 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 April 27, 2024, from http://www.rupert.id.au/tutorials/processing/examples/Lissajous/lissajou_v37.php

Last refreshed: April 27 2024. 04:54.05 am

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.


421 visits since April 10, 2011