#05:三角関数 - cos()、sin()、atan2()
このチャプターでは、三角関数を利用して、図形を描画します。
線 - line()
https://paiza.jp/works/processing-java/primer/processing-java-primer-2/156002
円 - circle(), ellipse()、arc()、radians()
https://paiza.jp/works/processing-java/primer/processing-java-primer-2/156003
色の設定 - background()、colorMode()、stroke()、fill()
https://paiza.jp/works/processing-java/primer/processing-java-primer-2/156007
void setup() {
  size(600, 600);
  colorMode(HSB, 360, 100, 100);
}
void draw() {
  background(200, 70, 99);
  drawFlower(150, 400);
  drawFlower(450, 400);
}
void drawFlower(float ox, float oy) {
  
  strokeWeight(30);
  stroke(110, 99, 60);
  line(ox, oy, ox, 600);
  
  strokeWeight(80);
  strokeCap(ROUND);
  stroke(55, 99, 99);
  strokeWeight(10);
  fill(30, 99, 50);
  stroke(30, 99, 50);
  
  circle(ox, oy, 150);
}
void setup() {
  size(600, 600);
  colorMode(HSB, 360, 100, 100);
}
void draw() {
  background(200, 70, 99);
  drawFlower(150, 400);
  drawFlower(450, 400);
}
void drawFlower(float ox, float oy) {
  
  strokeWeight(30);
  stroke(110, 99, 60);
  line(ox, oy, ox, 600);
  
  strokeWeight(80);
  strokeCap(ROUND);
  stroke(55, 99, 99);
  
  float l = 100;
  float angle = atan2(mouseY - oy, mouseX - ox);
  
  ox = ox + cos(angle) * 30;
  oy = oy + sin(angle) * 30;
  
  line(
    ox + cos(PI) * l, 
    oy + sin(PI) * l, 
    ox + cos(0) * l,
    oy + sin(0) * l);
    
  line(
    ox + cos(PI + HALF_PI) * l, 
    oy + sin(PI + HALF_PI) * l, 
    ox + cos(HALF_PI) * l,
    oy + sin(HALF_PI) * l);
  line(
    ox + cos(PI + QUARTER_PI) * l, 
    oy + sin(PI + QUARTER_PI) * l, 
    ox + cos(QUARTER_PI) * l,
    oy + sin(QUARTER_PI) * l);
  
  line(
    ox + cos(PI + HALF_PI + QUARTER_PI) * l, 
    oy + sin(PI + HALF_PI + QUARTER_PI) * l, 
    ox + cos(HALF_PI + QUARTER_PI) * l,
    oy + sin(HALF_PI + QUARTER_PI) * l);
  strokeWeight(10);
  fill(30, 99, 50);
  stroke(30, 99, 50);
  
  circle(ox, oy, 150);
}