processing=005=3d&library
DESCRIPTION
A_Little_Bit_Processing_TutorialTRANSCRIPT
![Page 1: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/1.jpg)
Processing
3D & Library
053D 以及 Library
![Page 2: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/2.jpg)
3D
![Page 3: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/3.jpg)
void setup(){
size(500,500,P3D);
smooth();
}
void draw(){
background(0);
ellipse(250,250,100,100);
}
![Page 4: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/4.jpg)
Where is the Camera
鏡頭呢?不會動?
![Page 5: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/5.jpg)
Go to File/ Example
![Page 6: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/6.jpg)
You can open it and
see what’s in the code
可以看看他們有甚麼
![Page 7: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/7.jpg)
![Page 8: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/8.jpg)
There is a LIBRARY,Easy way 還好有個Library簡單好用
![Page 10: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/10.jpg)
Click on it
![Page 12: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/12.jpg)
FOR
WIND
OWS微軟使用者
![Page 13: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/13.jpg)
Unzip the file
解壓縮
![Page 14: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/14.jpg)
There is a
“peasycam” under the
“PeasyCam_200 ”
Copy it !!!
裡面會有個peasyCam
資料夾
複製它
![Page 15: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/15.jpg)
If you are Windows Users,如果你是微軟用戶
Find the “Modes” folder
And find the “java” folder
And find the “libraries” folder
And Paste the “peasy” folder under it
![Page 16: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/16.jpg)
Something like this
像這樣
![Page 17: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/17.jpg)
FOR
MAC蘋果使用者
![Page 18: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/18.jpg)
Unzip the file
解壓縮
![Page 19: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/19.jpg)
There is a
“peasycam” under the
“PeasyCam_200 ”
Copy it !!!
裡面會有個peasyCam
資料夾
複製它
![Page 20: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/20.jpg)
1. 2.
3. 4.
![Page 21: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/21.jpg)
If you are Mac Users,
Find the “Processing.app/ Content/
Resource/ Java/ Modes/ jave/ libraries
And Paste the “peasy” folder under it
5. 6.
7.
![Page 22: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/22.jpg)
Something like this
![Page 23: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/23.jpg)
Close and Reopen
Your
Proce
ssing
ALL the
ALL the
Users
全體通通有
重新啟動
![Page 24: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/24.jpg)
Now we can go back to the CODE
![Page 25: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/25.jpg)
How to import the LABRARIES如何輸入library
![Page 26: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/26.jpg)
![Page 27: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/27.jpg)
![Page 28: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/28.jpg)
import peasy.*;
PeasyCam gcam;
// you can name any name instead of “gcam”
//你可以任意取名
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
// telling that the gcam is a new object of PeasyCam
//告訴程式 我創建了一個叫gcam的PeasyCam物件}
void draw(){
background(0);
ellipse(250,250,100,100);
}
![Page 29: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/29.jpg)
![Page 30: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/30.jpg)
Primitives3D基本量體
![Page 31: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/31.jpg)
box(size);box(x,y,z);
![Page 32: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/32.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(0);
box(50);
}
![Page 33: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/33.jpg)
![Page 34: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/34.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(0);
box(50);
}
![Page 35: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/35.jpg)
![Page 36: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/36.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(255,255,0);
stroke(255);
fill(40,80,200);
box(50,80,100);//box(x,y,z);
}
![Page 37: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/37.jpg)
IKEA
![Page 38: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/38.jpg)
sphere(size);
![Page 39: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/39.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(0);
stroke(255);
fill(40,80,200);
sphere(80)
}
![Page 40: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/40.jpg)
IKEA
![Page 41: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/41.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(0);
stroke(255);
fill(40,80,200);
sphere(80)
}
![Page 42: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/42.jpg)
We would like to make a
sin_Wave想要做一個sin的
波浪
![Page 43: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/43.jpg)
Translate();移動
![Page 44: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/44.jpg)
(20,20,0)
(0,0,0)
Translate(20,20,0)
point(0,0,0);
old
origin
translate() will move the whole coordination of theorigin point
translate()會移動整個原點的座標位置
![Page 45: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/45.jpg)
(0,0,0)
(-20,-20,0)
new
origin
Translate(-10,-40,0)
point(0,0,0);
(-10,-40,0)
![Page 46: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/46.jpg)
(10,40,0)
(-10,20,0)
new
origin
(0,0,0)
![Page 47: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/47.jpg)
import peasy.*;
PeasyCam gCam;
void setup(){
size(800,800,P3D);
gCam = new PeasyCam(this,500);
}
void draw(){
background(0);
box(50);
translate(100,100);
box(50);
translate(100,100);
box(50);
}
![Page 48: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/48.jpg)
Gap distanceBecome Longer and longer
間距越來越長
![Page 49: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/49.jpg)
pushMatrix();popMatrix();To avoid the situation
避免掉此問題
![Page 50: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/50.jpg)
(20,20,0)
(0,0,0)
pushMatrix();
Translate(20,20,0)
point(0,0,0);
popMatirx();
origin
![Page 51: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/51.jpg)
(20,20,0)
(0,0,0)
pushMatrix();
Translate(20,20,0)
point(0,0,0);
popMatirx();
new
origin
![Page 52: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/52.jpg)
import peasy.*;
PeasyCam gCam;
void setup(){
size(800,800,P3D);
gCam = new PeasyCam(this,500);
}
void draw(){
background(0);
box(50);
pushMatrix();
translate(100,100, 0);
box(50);
popMatrix();
pushMatrix();
translate(100,100, 0);
box(50);
popMatrix();
![Page 53: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/53.jpg)
![Page 54: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/54.jpg)
import peasy.*;
PeasyCam gCam;
void setup(){
size(800,800,P3D);
gCam = new PeasyCam(this,500);
}
void draw(){
background(0);
box(50);
pushMatrix();
translate(100,100, 0);
box(50);
popMatrix();
pushMatrix();
translate(-100,100, 0);
box(50);
popMatrix();
}
![Page 55: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/55.jpg)
![Page 56: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/56.jpg)
box(size); + For_Loop
![Page 57: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/57.jpg)
import peasy.*;
PeasyCam gCam;
void setup(){
size(800,800,P3D);
gCam = new PeasyCam(this,500);
}
void draw(){
background(0);
for(int i =0; i< 500; i=i+50){
pushMatrix();
translate( i, 100, 0);
box(50);
popMatrix();
}
}
![Page 58: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/58.jpg)
![Page 59: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/59.jpg)
( i, sin(i) )
![Page 60: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/60.jpg)
PI (π) = 180°
1° = PI / 180
![Page 61: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/61.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(255,255,0);
noStroke();
fill(40,80,200);
for(float i=0; i<1800; i+=15){
pushMatrix();
translate( i, 50*sin(i*(PI/180)), 0);
box(15);
popMatrix();
}
}
![Page 62: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/62.jpg)
![Page 63: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/63.jpg)
(r*cos(θ), r*sin(θ))
r
θ
![Page 64: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/64.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(255,255,0);
stroke(255);
fill(40,80,200);
for(float i=0; i<360; i+=6){
pushMatrix();
translate(50*cos(i*(PI/180)), 50*sin(i*(PI/180)), 0);
box(10);
popMatrix();
}
}
![Page 65: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/65.jpg)
![Page 66: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/66.jpg)
Make a Spiral
做個神鬼奇航
![Page 67: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/67.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(255,255,0);
stroke(255);
fill(40,80,200);
for(float i=0; i<1440; i+=6){
pushMatrix();
translate( (i/2)*cos(i*(PI/180)), (i/2)* sin(i*(PI/180)), i/3);
box(25);
popMatrix();
}
}
![Page 68: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/68.jpg)
![Page 69: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/69.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 500);
}
void draw(){
background(255,255,0);
stroke(255);
fill(40,80,200);
for(float i=0; i<1440; i+=6){
pushMatrix();
translate( (i/2)*cos(i*(PI/180)), (i/2)*sin(i*(PI/180)), i );
box(i/10);
popMatrix();
}
}
![Page 70: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/70.jpg)
![Page 71: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/71.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 1000);
}
void draw(){
background(255,255,0);
stroke(255);
fill(40,80,200);
for(float i=0; i<360; i+=1){
pushMatrix();
translate(200*cos(i*PI/180), 200*sin(i*PI/180), 200*sin(i*PI/180));
box(i/10);
popMatrix();
}
}
![Page 72: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/72.jpg)
![Page 73: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/73.jpg)
import peasy.*;
PeasyCam gcam;
void setup(){
size(500,500,P3D);
smooth();
gcam = new PeasyCam(this, 1000);
}
void draw(){
background(255,255,0);
fill(40,80,200);
int c1 = 1;
int c2 = 1;
int c3 = 2;
for(float i=0; i<360; i+=1){
pushMatrix();
translate(200*cos(c1*i*PI/180), 200*sin(c2*i*PI/180), 200*sin(c3*i*PI/180));
box(i/10);
popMatrix();
}
}
![Page 74: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/74.jpg)
![Page 75: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/75.jpg)
int c1 = 1;
int c2 = 1;
int c3 = 3;
int c1 = 1;
int c2 = 1;
int c3 = 6;
int c1 = 2;
int c2 = 1;
int c3 = 3;
int c1 = 2;
int c2 = 4;
int c3 = 3;
int c1 = 2;
int c2 = 5;
int c3 = 2;
int c1 = 3;
int c2 = 4;
int c3 = 1;
![Page 76: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/76.jpg)
If (you are interested more into 3D Mesh){another library “Hemesh”;
}
![Page 77: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/77.jpg)
If (you are interested more into 3D Mesh){another library “toxiclibs”;
}
![Page 78: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/78.jpg)
http://www.wblut.com/2010/05/04/hemesh-a-3d-mesh-library-for-processing/
![Page 79: Processing=005=3d&library](https://reader035.vdocuments.net/reader035/viewer/2022062815/568bf4be1a28ab89339f262a/html5/thumbnails/79.jpg)