From a8c55dd841cff3eca9b0eeef7eaf84439e4be27f Mon Sep 17 00:00:00 2001
From: kou029w <kou029w@gmail.com>
Date: Sun, 28 Oct 2012 03:39:43 +0900
Subject: [PATCH] processing

---
 processing/miku0/miku0.pde                 | 38 +++++++++++
 processing/sketch_nov19/sketch_nov19.pde   | 57 ++++++++++++++++
 processing/sketch_nov19a/sketch_nov19a.pde | 75 ++++++++++++++++++++++
 3 files changed, 170 insertions(+)
 create mode 100644 processing/miku0/miku0.pde
 create mode 100644 processing/sketch_nov19/sketch_nov19.pde
 create mode 100644 processing/sketch_nov19a/sketch_nov19a.pde

diff --git a/processing/miku0/miku0.pde b/processing/miku0/miku0.pde
new file mode 100644
index 0000000..9f1255e
--- /dev/null
+++ b/processing/miku0/miku0.pde
@@ -0,0 +1,38 @@
+void setup(){
+  size(361, 690);
+  background(0xff);
+  //face
+  translate(90,30);
+  //rinkaku
+  rect(0,0,180,180,60);
+  triangle(0,0,90,-30,180,0);
+  noStroke();
+  rect(0,0,185,60);
+  stroke(0);
+  //eyes
+  fill(0);
+  rect(60-2,90,4,60,2);
+  rect(120-2,90,4,60,2);
+  fill(0xff);
+  //hair
+  triangle(0,20,90,20,45,60);
+  triangle(90,20,180,20,135,60);
+  stroke(0xff);
+  rect(0,-1,180,22);
+  stroke(0);
+  translate(90,30);
+  triangle(-100,0,-180,180,-100,360);
+  triangle(100,0,180,180,100,360);
+  fill(0);
+  rect(-90-2-5,-45,4,90);
+  rect(90+5-2,-45,4,90);
+  fill(0xff);
+  //body
+  fill(0);
+  noStroke();
+  translate(0,150);
+  triangle(0,0,-120,300,120,300);
+  stroke(0);
+  line(-30,300,-30,300+180);
+  line(30,300,30,300+180);
+}
diff --git a/processing/sketch_nov19/sketch_nov19.pde b/processing/sketch_nov19/sketch_nov19.pde
new file mode 100644
index 0000000..af2c2a5
--- /dev/null
+++ b/processing/sketch_nov19/sketch_nov19.pde
@@ -0,0 +1,57 @@
+float theta;
+float x, y, d = 0.01;
+
+void setup(){
+  size(600,600);
+  theta = 0;
+  noStroke();
+}
+
+void draw(){
+  translate(300,300);
+  rotate(-PI/2);
+  x = cos(theta);
+  y = sin(theta);
+  if(theta < 0.01){
+    d = 0.01;
+  }else if(theta > 2*PI - 0.01){
+    d = -0.01;
+  }
+  theta += d;
+  background(0);
+  fill(0xFF*4/4);
+  arc(0,0,480,480,0,theta);
+  
+  fill(0xFF*3/4);
+  if(theta < PI){
+    arc(0,0,400,400,0,(PI*1/2-(x+pow(x,3)/6)));
+  }else{
+    arc(0,0,400,400,0,(PI*3/2+(x+pow(x,3)/6)));
+  }
+    fill(0xFF*2/4);
+  if(x>0&&y>0&&((y+pow(y,3)/6) < PI*1/4)){
+    arc(0,0,320,320,0,(y+pow(y,3)/6));
+  }else if(y>0&&((PI*1/2-x*1.11) < PI*3/4)){
+    arc(0,0,320,320,0,(PI*1/2-(x+pow(x,3)/6)));
+  }else if(x<0&&((PI*2/2-y*1.11) < PI*5/4)){
+    arc(0,0,320,320,0,(PI*2/2-y*1.11));
+  }else if(y<0&&((PI*3/2+x*1.11) < PI*7/4)){
+    arc(0,0,320,320,0,(PI*3/2+x*1.11));
+  }else{
+    arc(0,0,320,320,0,(PI*4/2+y*1.11));
+  }
+
+  fill(0xFF*1/4);
+  if(x>0&&y>0&&((y*1.11) < PI*1/4)){
+    arc(0,0,240,240,0,(y*1.11));
+  }else if(y>0&&((PI*1/2-x*1.11) < PI*3/4)){
+    arc(0,0,240,240,0,(PI*1/2-x*1.11));
+  }else if(x<0&&((PI*2/2-y*1.11) < PI*5/4)){
+    arc(0,0,240,240,0,(PI*2/2-y*1.11));
+  }else if(y<0&&((PI*3/2+x*1.11) < PI*7/4)){
+    arc(0,0,240,240,0,(PI*3/2+x*1.11));
+  }else{
+    arc(0,0,240,240,0,(PI*4/2+y*1.11));
+  }
+  
+}
diff --git a/processing/sketch_nov19a/sketch_nov19a.pde b/processing/sketch_nov19a/sketch_nov19a.pde
new file mode 100644
index 0000000..0cc89bc
--- /dev/null
+++ b/processing/sketch_nov19a/sketch_nov19a.pde
@@ -0,0 +1,75 @@
+float theta;
+float x, y, d = 0.01;
+
+float arcsin3(float x){
+  return (1.025*(x+pow(x,3)/6));
+}
+
+float arcsin1(float x){
+  return (1.11*x);
+}
+
+void setup(){
+  size(600,600);
+  theta = 0;
+  noStroke();
+}
+
+void draw(){
+  translate(300,300);
+  rotate(-PI/2);
+  
+  x = cos(theta);
+  y = sin(theta);
+  
+  if(theta < 0.01){
+    d = 0.01;
+  }else if(theta > 2*PI - 0.01){
+    d = -0.01;
+  }
+  theta += d;
+  background(0);
+  fill(0xFF*4/4);
+  arc(0,0,480,480,0,theta);
+  
+  fill(0xFF*3/4);
+  if(arcsin3(y)>PI/4){
+    arc(0,0,400,400,0, PI*1/2-arcsin3(x) );
+  }else if(arcsin3(y)<-PI/4){
+    arc(0,0,400,400,0, PI*3/2+arcsin3(x) );
+  }else if(x>0){
+    if(y>0){
+      arc(0,0,400,400,0, arcsin3(y) );
+    }else{
+      arc(0,0,400,400,0, 2*PI+arcsin3(y) );
+    }
+  }else{
+    arc(0,0,400,400,0, PI-arcsin3(y) );
+  }
+  
+  fill(0xFF*2/4);
+  if(arcsin1(y)>PI/4){
+    arc(0,0,320,320,0, PI*1/2-arcsin1(x) );
+  }else if(arcsin1(y)<-PI/4){
+    arc(0,0,320,320,0, PI*3/2+arcsin1(x) );
+  }else if(x>0){
+    if(y>0){
+      arc(0,0,320,320,0, arcsin1(y) );
+    }else{
+      arc(0,0,320,320,0, 2*PI+arcsin1(y) );
+    }
+  }else{
+    arc(0,0,320,320,0, PI-arcsin1(y) );
+  }
+  
+  fill(0xFF*1/4);
+  if(x>0){
+    if(y>0){
+      arc(0,0,240,240,0, asin(y) );
+    }else{
+      arc(0,0,240,240,0, 2*PI+asin(y) );
+    }
+  }else{
+    arc(0,0,240,240,0, PI-asin(y) );
+  }
+}