Presentation is loading. Please wait.

Presentation is loading. Please wait.

CGプログラミング論 平成28年6月1日 森田 彦.

Similar presentations


Presentation on theme: "CGプログラミング論 平成28年6月1日 森田 彦."— Presentation transcript:

1 CGプログラミング論 平成28年6月1日 森田 彦

2 基礎課題5-1 解答(その1) 1 2 60° 30° 1 45° cos(60°)=1/2 sin(60°)= sin(30°)= 1/2
基礎課題5-1 解答(その1) 60° 30° 45° cos(60°)=1/2 sin(60°)= sin(30°)= 1/2 cos(30°)= sin(45°)= cos(45°)=

3 基礎課題5-1 解答(その2) θ(ラジアン)=(θ(角度)/180)×π 45° → (ラジアン) 60° → (ラジアン) π/4
基礎課題5-1 解答(その2) θ(ラジアン)=(θ(角度)/180)×π 45° →         (ラジアン) π/4 60° →         (ラジアン) π/3

4 基礎課題5-2 r r y 描画開始点 x void DrawGraphics(Graphics g) { int x0,y0,r;
g.setColor(Color.blue); //グラフの描画色を青色に指定 //円の描画 double x1,x2,y1,y2,theta,d_theta; int Cx=1,Cy=1; //x軸方向、y軸方向の縮尺 int N=8; //円の分割数 x1= r ; //描画開始点のx座標 y1=0; //描画開始点のy座標 d_theta=(2*Math.PI/N); //角度θの刻み幅 for(int i=1;i<=N;i++) { theta=d_theta*i; //i番目の点の角度θ ・・・ } r

5 基礎課題5-3 void DrawGraphics(Graphics g) { int x0,y0,r;
・・・ for(int i=1;i<=N;i++) { theta=d_theta*i; //i番目の点の角度θ x2=r*Math.cos(theta); //i番目の点のx座標 y2=r*Math.sin(theta); //i番目の点のy座標 if( (i%2)==0 ) { g.drawLine( x0+(int) (Cx*x1), y0-(int)(Cy*y1) ,x0+(int) (Cx*x2), y0-(int)(Cy*y2)); } x1=x2; y1=y2; (i%2)==0

6 基礎課題5-4 も可 void DrawGraphics(Graphics g) { int x0,y0,r;
  ・・・ for(int i=1;i<=N;i++) { theta=d_theta*i; //i番目の点の角度θ x2=r*Math.cos(theta); //i番目の点のx座標 y2=r*Math.sin(theta); //i番目の点のy座標 g.drawLine( x0+(int) (Cx*x1), y0-(int)(Cy*y1) ,x0+(int) (Cx*x2), y0-(int)(Cy*y2)); g.drawLine(x0,y0, x0+(int) (Cx*x2) , y0-(int)(Cy*y2) ); x1=x2; y1=y2; } x0+(int)(Cx*x2) y0-(int)(Cy*y2) も可 x0+(int)(Cx*x1) y0-(int)(Cy*y1)

7 基礎課題5-5 3 2 1 (i%2) == 0 ① void DrawGraphics(Graphics g) { ・・・
void DrawGraphics(Graphics g) {  ・・・ for(int i=1;i<=N;i++) { theta=d_theta*i; //i番目の点の角度θ x2=r*Math.cos(theta); //i番目の点のx座標 y2=r*Math.sin(theta); //i番目の点のy座標 if(          ) { g.drawLine( x0+(int) (Cx*x1), y0-(int)(Cy*y1) ,x0+(int) (Cx*x2), y0-(int)(Cy*y2)); } g.drawLine(x0,y0, x0+(int) (Cx*x2) , y0-(int)(Cy*y2) ); x1=x2; y1=y2; (i%2) == 0

8 応用課題5-A void DrawGraphics(Graphics g) { int x0,y0;
double r; //半径rを実数型にする ・・・ int N=100; //円の分割数 x1=r; //描画開始点のx座標 y1=0; //描画開始点のy座標 d_theta=(2*Math.PI/N); //角度θの刻み幅 for(int i=1;i<=N;i++) { theta=d_theta*i; //i番目の点の角度θ r=10*theta; //角度θの時のr x2=r*Math.cos(theta); //i番目の点のx座標 y2=r*Math.sin(theta); //i番目の点のy座標 g.drawLine( x0+(int) (Cx*x1), y0-(int)(Cy*y1) ,x0+(int) (Cx*x2), y0-(int)(Cy*y2)); x1=x2; y1=y2; } d_theta=(4*Math.PI/N);

9 応用課題5-A これも可 void DrawGraphics(Graphics g) { int x0,y0;
double r; //半径rを実数型にする ・・・ int N=100; //円の分割数 x1=r; //描画開始点のx座標 y1=0; //描画開始点のy座標 d_theta=(2*Math.PI/N); //角度θの刻み幅 for(int i=1;i<=2*N;i++) { theta=d_theta*i; //i番目の点の角度θ r=10*theta; //角度θの時のr x2=r*Math.cos(theta); //i番目の点のx座標 y2=r*Math.sin(theta); //i番目の点のy座標 g.drawLine( x0+(int) (Cx*x1), y0-(int)(Cy*y1) ,x0+(int) (Cx*x2), y0-(int)(Cy*y2)); x1=x2; y1=y2; } これも可

10 本日の学習内容 図形の移動 提出課題 【基礎課題6-1】~【基礎課題6-6】および【応用演習課題6-A】の7題です。
本日の学習内容 図形の移動 提出課題  【基礎課題6-1】~【基礎課題6-6】および【応用演習課題6-A】の7題です。 【基礎課題6-6】の提出期限は【応用課題6-A】と同様に、6/2(木)17:00までとします。

11 演習課題の受け取りについて 原則として講義時間内に提出してもらいます。提出が遅れた場合は以下のように減点とします。 基礎課題 応用課題
100% 終了後1時間以内 90% 1時間超~当日中 70% 翌日の17:00まで 0% それ以上の遅れ 課題内容によっては、上の基準を緩和します。その際は講義時にアナウンスします。


Download ppt "CGプログラミング論 平成28年6月1日 森田 彦."

Similar presentations


Ads by Google