วันเสาร์ที่ 23 สิงหาคม พ.ศ. 2557
Lab1 : draw a football (soccer) field
void setup() {
size(323, 200);
background(#2EB82E);
fill(#2EB82E);
strokeWeight(3);
int center_filedX = 162.5 ;
int center_filedY = 100 ;
int radius_center_circle = 40
quad(center_filedX-137.5,center_filedY-80,center_filedX-137.5,center_filedY+80,center_filedX+137.5,center_filedY+80,
center_filedX+137.5,center_filedY-80) ; //field
ellipse(center_filedX,center_filedY,radius_center_circle,
radius_center_circle) ; //center circle
line(center_filedX,center_filedY-80,center_filedX,center_filedY+80) ; //half way line
//left court
int corner_filedX = 25 ;
int corner_filedY = 50 ;
quad(corner_filedX,corner_filedY,corner_filedX,
corner_filedY+100,corner_filedX+45,corner_filedY+100,
corner_filedX+45,corner_filedY) ; //penalty area
quad(corner_filedX,corner_filedY+20,corner_filedX,
corner_filedY+80,corner_filedX+25,corner_filedY+80,
corner_filedX+25,corner_filedY+20) ; //penalty area
quad(corner_filedX,corner_filedY+35,corner_filedX,
corner_filedY+65,corner_filedX-10,corner_filedY+65,corner_filedX-10,corner_filedY+35) ; //goal
arc(corner_filedX, corner_filedY-30, corner_filedX-10,
corner_filedY-35, 0, PI/2) ; //top corner
arc(corner_filedX, corner_filedY+130, corner_filedX-10, corner_filedY-35, TWO_PI-PI/2, TWO_PI
) ; //buttom corner
arc(corner_filedX+48,corner_filedY+50,corner_filedX-5,corner_filedY, -PI/2,PI/2);
//right court
int corner_filedX = 300 ;
int corner_filedY = 50 ;
quad(corner_filedX,corner_filedY+100,corner_filedX,corner_filedY,
corner_filedX-45,corner_filedY,corner_filedX-45,corner_filedY+100) ; //penalty area
quad(corner_filedX,corner_filedY+20,corner_filedX,
corner_filedY+80,corner_filedX-25,corner_filedY+80,corner_filedX-25,corner_filedY+20) ; //penalty area
quad(corner_filedX,corner_filedY+35,corner_filedX,corner_filedY+65,
corner_filedX+10,corner_filedY+65,corner_filedX+10,corner_filedY+35) ; //goal
arc(corner_filedX, corner_filedY-30, corner_filedX-285,corner_filedY-35, PI/2,PI) ; //top corner
arc(corner_filedX, corner_filedY+130, corner_filedX-285, corner_filedY-35, PI, TWO_PI-PI/2) ; //buttom corner
arc(corner_filedX-47,corner_filedY+50,corner_filedX-280,corner_filedY
, PI/2,TWO_PI-PI/2);
}
ป้ายกำกับ:
Lab1
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น