14_g_def_scale_3D_1.c |
1 #include<stdio.h> 2 #include<glsc3d_3.h> 3 #define WX (600) 4 #define WY (600) 5 6 #define XLEN (2.0 * M_PI) 7 #define YLEN (2.0 * M_PI) 8 #define ZLEN (2.0 * M_PI) 9 #define Imax (100) 10 #define Jmax (100) 11 12 int main() 13 { 14 g_init("Window", WX, WY); 15 g_def_scale_3D_fix(0, 16 -XLEN / 2, XLEN / 2, 17 -YLEN / 2, YLEN / 2, 18 -ZLEN / 2, ZLEN / 2, 19 20.0, 20.0, 20 WX - 40.0, WY - 40.0); 21 double u[Imax][Jmax]; 22 double dx = XLEN / Imax, dy = YLEN / Jmax,rx,ry; 23 24 for(int i = 0;i < Imax;i ++) 25 { 26 rx = (i + 0.5) * dx - XLEN / 2; 27 for(int j = 0;j < Jmax;j ++) 28 { 29 ry = (j + 0.5) * dy - YLEN / 2; 30 u[i][j] = sin(rx * ry) * 0.5; 31 } 32 } 33 for (int i_time = 0;; i_time++) 34 { 35 g_cls(); 36 g_sel_scale(0); 37 g_boundary(); 38 g_box_center_3D_core(0, 0, 0, XLEN, YLEN, ZLEN*0.5, 0, 1, 0); 39 g_bird_view_3D(-XLEN / 2, XLEN / 2, 40 -YLEN / 2, YLEN / 2, 41 Imax, Jmax, 42 u, 0, 1); 43 g_finish(); 44 } 45 return 0; 46 } |