1 / 11

CG プログラミング論

CG プログラミング論. 平成 26 年 5 月 26 日 森田 彦. 30°. 1. 2. 45°. 60°. 1. 1. 基礎課題 5-1  解答(その1). ①. cos(60°)=1/2. sin(60°)=. ②. sin(30°)=. ③. 1/2. cos(30°)=. sin(45°)=. cos(45°)=. ④. 基礎課題 5-1  解答(その2). θ (ラジアン) =(θ (角度) /180 )×π. 45°  →         (ラジアン). ⑤. π /4. 60°  →         (ラジアン).

deron
Télécharger la présentation

CG プログラミング論

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

  4. x r 基礎課題5-2 描画開始点 void DrawGraphics(Graphics g) { int x0,y0,r; x0=110; //円の中心のx座標 y0=110; //円の中心のy座標 r=100; //円の半径 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; x0=110; //円の中心のx座標 ・・・ 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; x0=110; //円の中心のx座標 ・・・ 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 4 3 2 1 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-6】の提出期限は【応用課題6-A】と同様に、5/27(火)17:00までとします。

  11. 演習課題の受け取りについて • 原則として講義時間内に提出してもらいます。提出が遅れた場合は以下のように減点とします。 基礎課題 応用課題 課題内容によっては、上の基準を緩和します。その際は講義時にアナウンスします。

More Related