顯示具有 04160683_邱繼儀 標籤的文章。 顯示所有文章
顯示具有 04160683_邱繼儀 標籤的文章。 顯示所有文章

2017年6月14日 星期三

Week 17 邱

#第17週上課重點

         1. 期末作品Demo
         2. 幫其他人打星星分數
         3. 評選前五名

-------------------------------------------------------------------------------------------------------------------------
◎期末作品 - 會跳舞的機器人

2017年6月6日 星期二

Week 16 邱

#第16週上課重點


         1. 下周期末作品Demo
         2. 內插公式 v.s. 動作
         3. 存檔、讀檔
         4. 利用Timer自動內插
         5.學期複習
-------------------------------------------------------------------------------------------------------------------------
◎用Excel試著內插公式     ///A2*(...新) + (1-A2)*(...舊)



◎用自己的檔案Build成功


◎寫檔案-動作存檔   ///按" s "存檔



◎讀檔案-動作    ///按" r "讀檔


◎讀檔案-內插角度    ///交叉相乘



2017年5月23日 星期二

Week 14 邱

#第14週上課重點

         1. 上週作業
         2. 讓機器人動
         3. Timer計時器
         4. 鍵盤滑鼠控制
         5.機器人2.0
-------------------------------------------------------------------------------------------------------------------------
◎水土不服

<Option working_dir="D:/電腦圖學/freeglut/bin" />  
 →  <Option working_dir="." />
<Add directory="D:/電腦圖學/freeglut/include" />   ///freeglut位置
  →  <Add directory="c:/users/user/desktop/freeglut/include" /> 




◎Timer 計時器 ///glutTimerFunc(等多久, 呼叫函式, 參數)

void timer(int t)
{
    glutTimerFunc(100,timer,t+1);
    angle++;
    glutPostRedisplay();
}


◎關節位置


◎ 利用茶壺觀察官結位置是否正確



◎ 左邊手臂關節


執行截圖:















◎ 左邊手臂關節+右邊手臂關節


執行截圖:



◎ 用mouse轉角度

     - mouse函式 & motion函式



執行截圖:


◎ 角度陣列

    - float angle = 0 ; → float angle[20] = { } ;



    (*  timer函式裡面的" angle++; "要註解掉 )


     - keyboard函式


    - 宣告 now




2017年5月16日 星期二

Week 13 邱

#第13週上課重點

         1. 小考:TRT觀念
         2. 上周範例
         3. 讀圖檔
         4. 貼圖設定
         5. 轉動的地球
         6. 回家作業:機器人
-------------------------------------------------------------------------------------------------------------------------

◎
(1) Google:qxncv2.1 Download 安裝
(2) CodeBlock:新專案 → Console APP 貝殼專案
                                設定專案 Build Options設定 - ① Compiler include:C:\ opencv2.1 \ include
                                                                         - ② Linker lib:C:\ opencv2.1 \ lib
                                咒語:Linker Setting - cv210
                                                               - cxcore210
                                                               - highgui210

#include <opencv/highgui.h>

int main( )
{
     IplImage * img = cvLoadImage("...");  ///圖檔
     cvShowImage("...",img);
     cvWaitKey(0);
}

2017年5月9日 星期二

Week 12 邱

#第12週上課重點

  1.  3D TRT轉動
  2.  矩陣、投影矩陣
  3.  攝影機運鏡
  4.  會動的機器人
  5.  (補)MP3播放

-------------------------------------------------------------------------------------------------------------------------
◎播MP3


把檔案跟專案放在同一個資料夾中



#include <iostream>
#include "CMP3_MCI.h"
  ///(1) 放在同一個程式碼專案的目錄中哦
CMP3_MCI myMP3 ;  ///(2) 宣告一個變數,叫 myMP3

using namespace std ;
///在 main()函式裡面
int main( )
{
     myMP3.Load("yukai.mp3");   /// "C:/dropbox/yukai.mp3"
     myMP3.Play( );   /// (4) Play the file
     int n;     cin >> n ;      cout << "Hello world!" << endl ;     return 0 ;
}

◎運鏡 glLookAt()

  • data.zip → 桌面\windows\data\模型
  • window.zip → 桌面\windows\project.exe
  • glut32.dll → 桌面\windows\glut32.dl
#include <GL/glut.h>
float eyeX=0, eyeY=0, eyeZ=1;
float centerX=0, centerY=0, centerZ=0;
float upX=0, upY=1, upZ=0;

float angle=0;
static void display(void)
{
    glMatrixMode(GL_PROJECTION) ;
    glLoadIdentity( ) ;
    gluPerspective(60,1,0.001,10000) ;
    glMartrixMode(GL_MODELVIEW) ;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glColor3d(1,0,0);

    angle += 0.01;
    eyeX = cos(angle);
    eyeZ = 2*sin(angle);
    glPushMatrix( );    gluLookAt(eyeX, eyeY, eyeZ,                    centerX, centerY, centerZ,                    upX, upY, upZ);    glutSolidTeapot(0.3);    glPopMatrix( );    glutSwapBuffers( );
}
const GLfloat light_ambient[ ]  = { 0.0f, 0.0f, 0.0f, 1.0f };
const GLfloat light_diffuse[ ]  = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_specular[ ] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_position[ ] = { 2.0f, 5.0f, -5.0f, 0.0f };

const GLfloat mat_ambient[ ]    = { 0.7f, 0.7f, 0.7f, 1.0f };
const GLfloat mat_diffuse[ ]    = { 0.8f, 0.8f, 0.8f, 1.0f };
const GLfloat mat_specular[ ]   = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat high_shininess[ ] = { 100.0f };

int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitWindowSize(640,480);
    glutInitWindowPosition(10,10);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("GLUT Shapes");

    ///glutReshapeFunc(resize);
    glutDisplayFunc(display);
    ///glutKeyboardFunc(key);
    ///glutIdleFunc(idle);


    glClearColor(1,1,1,1);
    //glEnable(GL_CULL_FACE);
    //glCullFace(GL_BACK);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    glEnable(GL_LIGHT0);
    glEnable(GL_NORMALIZE);
    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_LIGHTING);

    glLightfv(GL_LIGHT0, GL_AMBIENT,  light_ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE,  light_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glMaterialfv(GL_FRONT, GL_AMBIENT,   mat_ambient);
    glMaterialfv(GL_FRONT, GL_DIFFUSE,   mat_diffuse);
    glMaterialfv(GL_FRONT, GL_SPECULAR,  mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);

    glutMainLoop();
}