$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena
|
|
|
- ゆうりゅう みやくぼ
- 8 years ago
- Views:
Transcription
1 $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a
2 $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filename> less $ man <cmdname> <cmdname> $ mkdir <dirname> <dirname>
3 nrps ~ nrps ~/nrps $ cd ~/nrps nrps hello.c.c ~/nrps hello.c /* This is my first C program. */ #include<stdio.h> #define MYNAME "abcdefg" int main() { printf("hello World!!\n"); printf("my name is %s.\n",myname); return(0); }
4 hello.c hello.c ~/nrps $ cd ~/nrps nrps $ ls-a $ gcc hello.c -o hello.out -lm hello.c hello.out hello.out aaa.out aaa.out $ ls hello.out $./hello.out hello.c gcc... c ~/nrps
5 $ cd ~/nrps $ chmod +x c $ cd ~/nrps $./c hello hello.c hello.out ~/nrps ~/nrps $ cd~/nrps cd $ ls -a $ rm -r <file name> $ ls -a
6 main2d.c ~/nrps main2d.c $ cd ~/nrps $./c main2d $./main2d.out 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 5 #define WIDTH #define HIGHT void display(void); 9 void reshape(int w, int h); 10 void keyboard(unsigned char key, int x, int y); 11 void ginit(int* pargc, char** argv); void display(void) 14 { 15 int i, j; glclear(gl_color_buffer_bit); 18 glpointsize(1);
7 19 glbegin(gl_points); 20 glcolor3f(1.0,0.0,0.0); /* red */ 21 glvertex2f(1,1); 22 glcolor3f(0.0,1.0,0.0); /* green */ 23 glvertex2f(2,2); 24 glcolor3f(0.0,0.0,1.0); /* blue */ 25 glvertex2f(3,3); glend(); 28 glutswapbuffers(); 29 } void reshape(int w, int h) 32 { 33 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 34 glmatrixmode(gl_projection); 35 glloadidentity(); 36 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 37 } void keyboard(unsigned char key, int x, int y) 40 { 41 switch(key) { 42 case 'q': 43 case 'Q': 44 exit(0); 45 break; 46 case ' ': 47 glutidlefunc(0); 48 break; 49 default: 50 break; 51 } 52 }
8 53 54 void ginit(int* pargc, char** argv) 55 { 56 glutinit(pargc,argv); 57 glutinitdisplaymode(glut_double GLUT_RGB); 58 glutinitwindowsize(width,hight); 59 glutinitwindowposition(100,50); 60 glutcreatewindow("numerical Recipes for Polymer Science"); 61 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 62 glshademodel(gl_flat); 63 glutdisplayfunc(display); 64 glutreshapefunc(reshape); 65 glutkeyboardfunc(keyboard); 66 } int main(int argc, char* argv[]) 69 { 70 ginit(&argc,argv); 71 glutmainloop(); 72 return 0; 73 } WIDTH HIGHT WIDTH 300 reshape void int
9 display glutdisplayfunc(display) display i j display() 1 glbegin() glend() glbegin(gl_points) glbegin(gl_lines) glbegin(gl_line_strip) glbegin(gl_line_loop) glbegin(gl_triangles / GL_QUADS) glbegin(gl_trianble_strip / GL_QUAD_STRIPE) glbegin(gl_triangle_fan) glbegin(gl_polygon) glcolor3f() glvertex2f(float x, float y) (x, y) glutswapbuffers() reshape(int w, int h) glutreshapefunc() glutkeyboardfunc()
10 ginit(int* pargc, char** argv) main() main() { } #include.c ;
11 #include <stdio.h> int main() { printf("hello World!\n"); return(0); } #include <stdio.h> int main(){printf("hello World!\n");return(0);} main() #include <stdio.h> int mai n(){printf("hello World!\n");return(0);} ; : {} () [] <> #include '' "" / % { } _ _
12 + a = b+c; b c a - a = b-c; b c a * a = b*c; b c a / a = b/c; b c a % a = b%c; b c a ++ a++; ++a; a = a + 1; -- a--; --a; a = a - 1; - b = -a;
13 = a = b += a += b; a = a + b; -= a -= b; a = a - b; *= a *= b; a = a*b; /= a /= b; a = a/b; %= a %= b; a = a%b; > < >= <= ==!= a = (b > c); c b a a a = ( b!= c); b c a a a = (b > c) && (c < d); b>c c<d a a = (b > c) (c < d); b>c c<d a &&!
14 a =!(b > c); b>c a if for while 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 int num,i; 7 8 for(i=0;i<4;i++){ 9 num = rand()%2000; if(num < 100){ 12 printf("%d < 100\n", num); 13 }else if(num > 1000){ 14 printf("%d > 1000\n", num); 15 }else{ 16 printf("100 <= %d <= 1000\n",num); 17 } if(num < 100)printf("The num is smaller than 100\n"); } i=0;
15 24 while(i < 5){ 25 num = rand()%2000; 26 printf("num = %d\n",num); 27 i++; 28 } do{ 31 num = rand()%2000; 32 printf("in do_while, num = %d\n",num); 33 i--; 34 }while(i>0); return(0); 37 } 38.c 1 #include <stdio.h>
16 2 #include <stdlib.h> 3 4 double f2bai(double x); 5 double tasu(double x, double y); 6 7 double f2bai(double x) 8 { 9 printf("f2bai works.\n"); return(2.0*x); 12 } double tasu(double x, double y) 15 { 16 return(x+y); 17 } int main() 20 { 21 double a,b; a = (rand()%1000)/1000.0; 24 b = (rand()%1000)/1000.0; printf("2*%lf = %lf\n", a, f2bai(a)); 27 printf("%lf + %lf = %lf\n", a, b, tasu(a,b)); return(0); 30 } ~/nrps
17 $ pwd main2d.c hexagon.c $ cp main2d.c hexagon.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> * 4 #include <math.h> 5 6 #define WIDTH #define HIGHT 300 * 8 #define RADIUS 100 * 9 #define X0 150 *10 #define Y void display(void) 18 { *19 int x, y, deg; glclear(gl_color_buffer_bit); 22 glpointsize(1); *23 glbegin(gl_line_loop); *24 glcolor3f(1.0, 1.0, 0.0); /* yellow */ *25 for(deg = 0; deg < 360; deg = deg+60){ *26 x = RADIUS*cos(deg*M_PI/180); *27 y = RADIUS*sin(deg*M_PI/180); *28 glvertex2f(x0+x,y0+y); *29 }
18 30 glend(); 31 glutswapbuffers(); 32 } hexagon.c math.h RADIUS X0 Y0 display() hexagon.c hexagon.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 #include <math.h> * 5 #include <time.h> 6 7 #define WIDTH #define HIGHT #define RADIUS #define X #define Y0 150 *12 #define DEGSTEP void display(void); 15 void reshape(int w, int h); 16 void keyboard(unsigned char key, int x, int y); 17 void ginit(int* pargc, char** argv);
19 *18 void idle(void); 19 *20 int Degshift=0; 21 *22 void idle(void) *23 { *24 static int first = 1; *25 static time_t past; *26 time_t now; *27 *28 if(first == 1){ *29 time(&past); *30 first = 0; *31 return; *32 } *33 *34 time(&now); *35 *36 if(difftime(now,past) > 1.0){ *37 Degshift += DEGSTEP; *38 past = now; *39 } *40 *41 glutpostredisplay(); *42 } void display(void) 45 { 46 int x, y, deg; glclear(gl_color_buffer_bit); 49 glpointsize(1); 50 glbegin(gl_polygon); 51 glcolor3f(1.0, 1.0, 0.0); /* yellow */
20 52 for(deg = 0; deg < 360; deg = deg+60){ *53 x = RADIUS*cos((deg+Degshift)*M_PI/180); *54 y = RADIUS*sin((deg+Degshift)*M_PI/180); 55 glvertex2f(x0+x,y0+y); 56 } 57 glend(); 58 glutswapbuffers(); 59 } void reshape(int w, int h) 62 { 63 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 64 glmatrixmode(gl_projection); 65 glloadidentity(); 66 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 67 } void keyboard(unsigned char key, int x, int y) 70 { 71 switch(key) { 72 case 'q': 73 case 'Q': 74 exit(0); 75 default: 76 break; 77 } 78 } void ginit(int* pargc, char** argv) 81 { 82 glutinit(pargc,argv); 83 glutinitdisplaymode(glut_double GLUT_RGB); 84 glutinitwindowsize(width,hight); 85 glutinitwindowposition(100,50);
21 86 glutcreatewindow("numerical Recipes for Polymer Science"); 87 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 88 glshademodel(gl_flat); 89 glutdisplayfunc(display); 90 glutreshapefunc(reshape); 91 glutkeyboardfunc(keyboard); *92 glutidlefunc(idle); 93 } int main(int argc, char* argv[]) 96 { 97 ginit(&argc,argv); 98 glutmainloop(); 99 return 0; 100 } 101 rothex.c time() time.h.h DEGSTEP idle(void) Degshift
22 glutidlefunc() 1 0 first static static time.h time_t now past now past time(&past) first return if time(&now) now difftime(now,past) now past Degshift DEGDTEP now past idle(void)
23 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1
24 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l (l > 0) n 1 H = ϵ l j, j=1 ϵ e x x = 0 e x = j=0 x j j! = 1 + x x x j! xj +, 0! = 1 x = 1 e = j! + = j=0 1 j!, e = n j=0 1 j!. n 1 15 n
25 T j H j j Ψ j k Ψ j = 1 ( Z H ) j, k T Z = j ( H ) j, k T j T a b P a b ( H ) ( a P ab = H ) b P ba, k T k T
26 N N H 3N r N = (r 1, r 2, r N ) 3N p N = (p 1, p 2, p N ) H = N j=1 p 2 j 2m + U(r 1, r 2,, r N ), U r j = (x j, y j, z j ) p j = (p xj, p yj, p zj ) x j y j z j j x y z p xj p yj p zj p N r N r N = (r 1, r 2,, r N ) p N = (p 1, p 2,, p N ) r + r N = (r 1 + r 1, r 2 + r 2,, r N + r N ) p + p N = (p 1 + p 1, p 2 + p 2,, p N + p N ) ( H ) r N p N k T ( H ) k T Q r N Q < Q > ( Q ( Q H ) r N p N k < Q >= T ( H ) = r N p N k T U ) r N k T ), r N ( U k T N r N k t k t t m N 1 a x a y b z b
27 x a x a + δ x (1 2ξ 1 ), y a y a + δ y (1 2ξ 2 ), z a z a + δ z (1 2ξ 3 ). δ x, δ y, δ z x y z ξ j [0, 1] 8δ x δ y δ z t m t m t U t m U m U t U m k + 1 m U t < U m m [0, 1] η ( η < U ) m U t k T m k + 1 ( η > U ) m U t k T t k + 1 N l j = ±1 0
28 t m N l j 1 k t t m 1 n 1 a l a +1 1 l a l a 1 t m m t H t m H m H t H m k + 1 m H t < H m [0, 1] η m k + 1 ( η < H ) m H t k T ( η > H ) m H t k T t k + 1
29 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define N (20) 5 6 double uran(){ 7 return((double)rand()/rand_max); 8 } 9 10 int main() 11 { 12 float rn[n]; 13 int l[n]; 14 int j; for(j=0;j<n;j++){ 17 rn[j] = uran(); 18 if(rn[j] < 0.5){ 19 l[j] = -1; 20 }else{ 21 l[j] = 1; 22 } printf("%f,%2d\n",rn[j],l[j]); 25 } 26 return(0); 27 } 28
30 H ϵ = k = #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 5 #define N (100) 6 #define EP (6.0e-22) /* [J] */ 7 #define KB ( e-23) /* The Botzmann's constant [J/K] */ 8 #define MCTIME (1000) 9 10 double uran(){ 11 return((double)rand()/rand_max); 12 } int main() 15 { 16 int l[n],p[n+1]; 17 int k,j,mct,lbefore,end; 18 float dene,t; 19 FILE *fp; printf("temperature ="); 22 scanf("%f",&t); 23 printf("\n"); for(j=0;j<n;j++){ 26 l[j] = 1; 27 } for(j=0;j<n+1; j++){ 30 p[j] = 0;
31 31 } for(mct=0;mct<mctime;mct++){ 34 for(k=0;k<n;k++){ 35 j = (N+1)*uran(); 36 lbefore = l[j]; 37 l[j] *= (-1); 38 dene = - EP*l[j] - (-EP*lbefore); 39 if(dene > 0){ 40 if(exp(-dene/(kb*t)) < uran()){ 41 l[j] = lbefore; 42 } 43 } 44 } for(j=0,end=0;j<n;j++){ 47 end += l[j]; 48 } 49 p[(end+n)/2]++; printf("%d\n",mct); 52 } fp = fopen("result.txt","w"); for(j=0;j<(n+1);j++){ 57 fprintf(fp,"%d\t%e\n",2*j-n,((float)p[j])/mctime); 58 } fclose(fp); return(0); 63 } 64
32 65 result.txt $ mv result.txt 10.txt result.txt 10.txt 100.txt 1000.txt
33 [0, 1] uran() double j int l[n] [ ]... [ ] p[n+1] [ ]... [ ] lbefor end float dene t FILE fp t for for { }
34 j 0 l[j] = 1 j j + 1 j j < N l[j] j 0 N p[j] 0 p[j] mct { } mct 1 mct MCTIME N N 1 j 0 N l[j] l[j] 1 1 lbefore l[j] l[j] l[j] l[j] 1 l[j] l[j] *= (-1); l[j] = l[j]*(-1); l j l j l j H H H H = ϵ(l l j + + l N 1 ) ( ϵ)(l l j + + l N 1 ) = ϵl j ( ϵl j), dene
35 dene ( H ) H, k T H H [0, 1] l[j] x l j 1 x = N x = N 2 x 2 x = N, N + 2, N + 4,..., N 4, N 2, N j = (x+n)/2 x = N, N +2, N +4,..., N 4, N 2, N j = 0, 1, 2,..., N 2, N 1, N x = 2j N p[j] 1 p[j] x p[(x 1 x = 2j N result.txt 2j N p[j]/mctime n 1 H = ϵ l xj, j=1
36 l xj j x rothex.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 #include <math.h> 5 #include <time.h> 6 7 #define WIDTH #define HIGHT #define RADIUS #define LENGTH 3 11 #define X #define Y #define DEGSTEP #define N (100) 16 #define EP (6.0e-22) /* [J] */ 17 #define KB ( e-23) /* The Botzmann's constant [J/K] */ 18 #define MCTIME (1000) 19 #define DL (0.5) void display(void); 22 void reshape(int w, int h); 23 void keyboard(unsigned char key, int x, int y); 24 void ginit(int* pargc, char** argv); 25 void idle(void); int Degshift=0; 28 int Zoom=1,Stop=1; 29 float Ep,T, Lx[N], Ly[N]; 30 31
37 32 double uran(){ 33 return((double)rand()/rand_max); 34 } int mcrun() 38 { 39 int j; 40 float dene; 41 float lxbefore, lybefore; 42 float dx, dy, r; j = (N-1)*uran()+1; 45 lxbefore = Lx[j]; 46 lybefore = Ly[j]; do{ 49 dx = 2.0*DL*(uran()-0.5); 50 dy = 2.0*DL*(uran()-0.5); 51 }while( dx*dx + dy*dy > DL*DL); /* 54 Lx[j] = Lx[j] + dx; 55 Ly[j] = Ly[j] + dy; 56 */ Lx[j] = dx; 59 Ly[j] = dy; r = sqrt(lx[j]*lx[j] + Ly[j]*Ly[j]); 62 Lx[j] = Lx[j]/r; 63 Ly[j] = Ly[j]/r; dene = - Ep*Lx[j] - (-Ep*lxbefore);
38 66 dene = dene*ep; if(dene > 0){ 69 if(exp(-dene/(kb*t)) < uran()){ 70 Lx[j] = lxbefore; 71 Ly[j] = lybefore; 72 } 73 } return(0); 76 } void idle(void) 79 { 80 if(stop == 1)return; 81 mcrun(); 82 glutpostredisplay(); 83 } void display(void) 86 { 87 int x, y, j; glclear(gl_color_buffer_bit); 90 glpointsize(1); 91 glbegin(gl_line_strip); 92 glcolor3f(1.0, 1.0, 1.0); /* white */ 93 x = 0; 94 y = 0; 95 glvertex2f(x0+x, Y0+y); 96 for(j=1;j<n;j++){ 97 if(j%2 == 0){ 98 glcolor3f(1.0, 1.0, 1.0); 99 }else{
39 100 glcolor3f(1.0, 1.0, 0.0); 101 } 102 x = x+zoom*length*lx[j]; 103 y = y+zoom*length*ly[j]; 104 glvertex2f(x0+x, Y0+y); 105 } glend(); 108 glutswapbuffers(); 109 } void reshape(int w, int h) 112 { 113 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 114 glmatrixmode(gl_projection); 115 glloadidentity(); 116 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 117 } void keyboard(unsigned char key, int x, int y) 120 { 121 switch(key) { 122 case 's': 123 Stop *= -1; 124 break; 125 case 'i': 126 if(zoom == 0){ 127 Zoom=1; 128 }else{ 129 Zoom *= 2; 130 } 131 break; 132 case 'o': 133 Zoom /= 2;
40 134 break; 135 case 'e': 136 printf("\nelectric field ="); 137 scanf("%f",&ep); 138 Stop = 1; 139 break; 140 case 't': 141 printf("\ntemperature ="); 142 scanf("%f",&t); 143 Stop = 1; 144 break; 145 case 'q': 146 case 'Q': 147 exit(0); 148 default: 149 break; 150 } 151 } void ginit(int* pargc, char** argv) 154 { 155 glutinit(pargc,argv); 156 glutinitdisplaymode(glut_double GLUT_RGB); 157 glutinitwindowsize(width,hight); 158 glutinitwindowposition(100,50); 159 glutcreatewindow("numerical Recipes for Polymer Science"); 160 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 161 glshademodel(gl_flat); 162 glutdisplayfunc(display); 163 glutreshapefunc(reshape); 164 glutkeyboardfunc(keyboard); 165 glutidlefunc(idle); 166 } 167
41 168 int main(int argc, char* argv[]) 169 { 170 int j; 171 ginit(&argc,argv); printf("temperature ="); 174 scanf("%f",&t); 175 printf("\n"); 176 printf("electric field ="); 177 scanf("%f",&ep); for(j=1;j<n;j++){ 180 Lx[j] = 0.0; 181 Ly[j] = 1.0; 182 } glutmainloop(); 185 return 0; 186 } 187
j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E
8 9 7 6 4 2 3 5 1 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l l > 0) n 1 H = ϵ l j, j=1 ϵ e x x
#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta
1 1. 1 #include 2 #include 3 #include 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 static bool KeyDownON = false; // 8 static bool KeyLeftON
第3章 OpenGL の基礎
3 OpenGL April 11, 2017 1 / 28 3.1 ( ) OpenGL OpenGL 2 / 28 3.2 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc. 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh
1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - >
1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib
3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程
3. 3D ビューイング 1. 3Dグラフィックス処理の一般過程 2. 射影と射影変換 3. ビューボリュームとクリッピング 4. 陰面処理とデプスバッファ 5. ビューポート変換 6. 3Dグラフィックスを描く 7. モデルビュー変換 3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程 3D グラフィックス処理の一般過程 1. モデリング変換 座標系の異なる複数のオブジェクトを仮想世界に配置し,
/*p7-1-1*/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 /* e8.c Copyright (c) 2003 by T. HAYASHI and
( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>
2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9
第3章 OpenGL の基礎
3 OpenGL April 20, 2012 1 / 23 31 ( ) OpenGL OpenGL 2 / 23 32 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh CAD
£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡
(2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else
超初心者用
3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num
2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix()
1 20 (2) OpenGL+GUI(GLUI) 3DCG TA 2008 10 27 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2008/ 1.2 TA 1.3 2008/12/4( ) EyeToy 2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut
演算増幅器
スペースインベーダーもどき 1000 行プログラムの参考として スペースインベーダーもどきのプログラムを配布する いくつか習って いないものもあるので 補足の説明を加えていく 文字列の描画 文字の描画は glutbitmapcharacter() を用いる これは以下のようにして利用する int i; char *str = "Display String"; glcolor3f(0.0, 0.0,
2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, IBM UNIX Linux, FreeBSD PC UNIX Windows, Mac OS API PD
1 2015 5-1 2015 6 22 1 3DCG 3DCG 3DCG OpenGL OS Linux(Ubuntu) 1.1 TA 1.2 http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/ 2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI)
1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber();
: : :0757230G :2008/07/18 2008/08/17 1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); private: float num; ;
Microsoft Word - C.....u.K...doc
C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ
2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t
1 22 (2) OpenGL+GUI(GLUI) 3DCG TA 2010 10 18 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2010/ 1.2 TA 1.3 2010/12/6( ) USB 2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height
I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *
2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +
準備 計算結果を可視化するために OpenGL を 利用する. 2
2. 2 次元粒子法シミュレーション (+ 少しだけ OpenGL) 茨城大学工学部 教授乾正知 準備 計算結果を可視化するために OpenGL を 利用する. 2 OpenGL 3 次元コンピュータグラフィックス用の標準的なライブラリ. 特に CAD やアート, アニメーション分野 ( ゲーム以外の分野 ) で広く利用されている. OpenGL は仕様がオープンに決められており, 企業から独立した団体が仕様を管理している.
C
C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................
2 2 OpenGL ( ) OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf
1 24 (1) OpenGL TA 2012 10 11 1 C OpenGL (3DCG) OS Linux OS 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI 3DCG 3DCG 1.1 1 3DCG 3DCG GUI 2 3DCG 10/10( ) 11/11( ) 3DCG OpenGL OpenGL+GUI(GLUI) 3DCG 3DCG 1.2 TA 2
新・明解C言語 ポインタ完全攻略
2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)
comment.dvi
( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------
新版明解C言語 実践編
2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,
:30 12:00 I. I VI II. III. IV. a d V. VI
2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx
II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D
II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko
/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU
OpenGL ( ) #include #include #define PI 3.14159265 void function_graph() int j; float x, y; glbegin( GL_LINE_STRIP );// sine curve by line glcolor3f( 0.0f, 1.0f, 1.0f );// line color
/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v
1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html [email protected] /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );
double float
2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................
18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o
18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include
Microsoft Word - Cプログラミング演習(12)
第 12 回 (7/9) 4. いくつかのトピック (5)main 関数の引数を利用したファイル処理 main 関数は, 起動する環境から引数を受け取ることができる 例えば 次に示すように,main 関数に引数を用いたプログラムを作成する 01 /* sample */ 02 /* main 関数の引数 */ 03 #include 04 05 main(int argc, char
programmingII2019-v01
II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2
[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±
[1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,
2 2 OpenGL OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN,
1 20 (1) OpenGL TA 2008 10 20 1 C OpenGL (3DCG) OS Linux (Open SUSE 10.3) 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI USB EyeToy 1.1 1 3DCG 2 3DCG GUI 2 USB EyeToy) 10/20( ) 10/27( ) 3DCG OpenGL OpenGL+GUI(GLUI)
ex01.dvi
,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double
Microsoft PowerPoint - program.ppt [互換モード]
プログラミング演習 バージョン 1 担当教員 : 綴木馴 プログラムの決まりについて学ぶ おすすめする参考書 ザ C 戸川隼人サイエンス社 本日の予定 1. 授業の説明. 2. コンパイラーのインストール. プログラムの決まりについて学ぶ,P31 /* The most in C */ /* hello.c */ printf("hello,world n"); プログラムの決まり ( コメント )
‚æ2›ñ C„¾„ê‡Ìš|
I 8 10 10 I ( 6 ) 10 10 1 / 23 1 C ( ) getchar(), gets(), scanf() ( ) putchar(), puts(), printf() 1 getchar(), putchar() 1 I ( 6 ) 10 10 2 / 23 1 (getchar 1 1) 1 #include 2 void main(void){ 3 int
1 OpenGL OpenGL OpenGL OpenGL
2008 OpenGL 2009 2 27 1 OpenGL 4 1.1 OpenGL.............................. 4 1.2 OpenGL............... 4 1.2.1............... 4 1.2.2............................. 5 2 OpenGL 6 2.1.......................
1.ppt
/* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)
£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡
(2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =
C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in
C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................
273? C
TSG Theoretical Science Group 273? C 2-1.................................. 2 -1. Windows Mac Mac UNIX CUI bash >_ Finder TSG No.273? 2 3 pwd ls cd ( ) change directory 3 TSG No.273? cd hoge cd hoge cd....../
: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology
I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and
tuat1.dvi
( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )
PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU
1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf
PowerPoint プレゼンテーション
プログラミング応用 第 15 回 知的情報システム学科張 暁華 プログラミング応用 1 授業のマナー ------ 人の話を聞くときの社会常識 1. 欠席者のかわりに登録を行わない 倫理に反することをやらない あなたの信を問われている蟻の穴から堤防が決壊 2. 私語しないこと : 質問 意見は手を挙げて大きな声ではっきりと意思表示 3. 授業以外のことをしない : 携帯をカバンにいれ イヤホンを使って音楽等を聞かない授業中ゲームを遊ばない
新・明解C言語 実践編
第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include
untitled
II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}
1 4 2 EP) (EP) (EP)
2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)
C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç
C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10
I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b
I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT
ex01.dvi
,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double
実際の株価データを用いたオプション料の計算
2002 2 20 1 1 3 2 3 2.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 5 2.1.1 : : : : : : : : : : : : : : : : : : : : 5 2.1.2 : : : : : : : : : : : : : : : : : : : : 6 2.2 : : : : : : : : : :
PowerPoint Presentation
p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight
44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru
43 6 MPI MPI(Message Passing Interface) MPI 1CPU/1 PC Cluster MPICH[5] 6.1 MPI MPI MPI 1 : #include 2 : #include 3 : #include 4 : 5 : #include "mpi.h" 7 : int main(int argc,
Ⅰ Report#1 Report#1 printf() /* Program : hello.c Student-ID : 095740C Author UpDate Comment */ #include int main(){ : Yuhi,TOMARI : 2009/04/28(Thu) : Used Easy Function printf() 10 printf("hello,
pptx
iphone 2010 8 18 C [email protected] C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>
#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main
=1= (.5, 1.65), (1., 2.72), (2., 7.39).2,.4,.6,.8, 1., 1.2, 1.4, 1.6 1 1: x.2 1.4128.4 1.5372.6 1.796533.8 2.198 1.2 3.384133 1.4 4.1832 1.6 5.1172 8 7 6 5 y 4 3 2 1.5 1 1.5 2 x 1: /* */ #include
£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –
(2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001
2 P.S.P.T. P.S.P.T. wiki 26
P.S.P.T. C 2011 4 10 2 P.S.P.T. P.S.P.T. wiki [email protected] http://www23.atwiki.jp/pspt 26 3 2 1 C 8 1.1 C................................................ 8 1.1.1...........................................
Krylov (b) x k+1 := x k + α k p k (c) r k+1 := r k α k Ap k ( := b Ax k+1 ) (d) β k := r k r k 2 2 (e) : r k 2 / r 0 2 < ε R (f) p k+1 :=
127 10 Krylov Krylov (Conjugate-Gradient (CG ), Krylov ) MPIBNCpack 10.1 CG (Conjugate-Gradient CG ) A R n n a 11 a 12 a 1n a 21 a 22 a 2n A T = =... a n1 a n2 a nn n a 11 a 21 a n1 a 12 a 22 a n2 = A...
導入基礎演習.ppt
Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09
r07.dvi
19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1
ohp07.dvi
19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5
BW BW
Induced Sorting BW 11T2042B 2015 3 23 1 1 1.1................................ 1 1.2................................... 1 2 BW 1 2.1..................................... 2 2.2 BW.................................
lexex.dvi
(2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,
K227 Java 2
1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html
untitled
II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*
