2011年4月19日 星期二

如意圖形 Ru_Yi Pattern ( Processing )




"如意" 圖形在中國建築或試器具上時常出現
代表 幸福與順利
如意同時也是中國一種器物之明
利用Processing畫出捲曲的尾巴造形
來描述如意造形
基本上即是利用sin, cos在平面中的關係
產生如意圖形


The Ru-Yi pattern appears on the facade or the surface 
of the industrial design in China.
Ru-Yi means as one wish in Chinese, 
which also means happiness.
Ru-Yi itself is also a traditional industrial product in China.
check here: Ru-Yi
We use Processing to create a curry tail like form 
to describe the "Ru-Yi" pattern 
Basically we just use the sin, cos relationship in 
2D to make the pattern
and try to give it a Z increment to make it 3D.

做了一個叫tails01的Function並在CODE中做旋轉鏡射
產生出對稱圖形

請下載PeasyCam定放置在Processing檔案內的
Libraries資料夾內以產生3D的CAMERA

We made a "tails01" function and rotate, mirror 
to make the symmetrical pattern.  

Please download the PeasyCam libraries and 
put it into the Processing/ Libraries folder
Code Here:

import peasy.*;
PeasyCam gCam;

float l =200;// the tails radius
float t =2;// the increment of the pattern
float m = 0;// the Z increament of the pattern

void setup(){
 size(600,600,P3D);
 background(0); 
 smooth();
 gCam = new PeasyCam(this,900);
}

void draw(){
  background(0);
  int n=4;
  
  pushMatrix();
  translate(200,0,0);
  noStroke();
  sphere(30);
  stroke(0);
  strokeWeight(1);
  for(int j=0; j<=n; j++){
   //rotate(PI/n);
   tails01(200,-180,270,5);
  }
  popMatrix();

  pushMatrix();
  translate(-200,0,0);
  noStroke();
  sphere(30);
  stroke(0);
  rotateY(PI);
  for(int j=0; j<=n; j++){
   //rotate(PI/n);
   tails01(200,-180,270,5);
  }
  popMatrix();

  pushMatrix();
  translate(-200,l,0);
  noStroke();
  sphere(30);
  stroke(0);
  rotateY(PI);
  rotateX(PI);
  for(int j=0; j<=n; j++){
   //rotate(PI/n);
   tails01(200,-180,270,5);
  }
  popMatrix();

  pushMatrix();
  translate(200,l,0);
  noStroke();
  sphere(30);
  stroke(0);
  rotateX(PI);
  for(int j=0; j<=n; j++){
  //rotate(PI/n);  
   tails01(200,-180,270,5);
   }
  popMatrix();
}

void tails01(float r, float s, float a, float d){
 for(float i= s; i
   pushMatrix();
   translate(r*cos(i*(PI/180)),r*sin(i*(PI/180)),m);
   //noStroke();
   box(r/5);
   //stroke(255);
   //strokeWeight(r/5);
   //point(0,0,0);
   //sphere(r/5);
   popMatrix();
   r=r-t;

 }

}






3D



3D transform


3D transform_BALLS






沒有留言:

張貼留言