Changeset 1305
- Timestamp:
- Mar 10, 2009, 2:05:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/data/flowvis_dx_files/convpro/main.cpp
r1304 r1305 10 10 { 11 11 FILE* file = fopen(filename, "wb"); 12 13 #if 0 14 width = width >> 1; 15 height = height >> 1; 16 #endif 12 13 int ori_width = width; 14 int ori_height = height; 15 if (ori_width > 512) width = 512; 16 if (ori_height > 512) height = 512; 17 17 18 int count = width * height; 18 19 int total_count = width * height * depth; 19 fprintf(file, "object 1 class gridposition counts %d %d %d\n", width, height, depth);20 fprintf(file, "object 1 class gridpositions counts %d %d %d\n", width, height, depth); 20 21 fprintf(file, "origin 0 0 0\n"); 21 22 fprintf(file, "delta 50 0 0\n"); … … 26 27 27 28 28 for (int z = 0; z < depth; ++z)29 if (ori_width <= 512 && ori_height <= 512) 29 30 { 30 for (int index = 0; index < count; ++index) 31 int dataindex = 0; 32 Vector2* ptr; 33 for (int z = 0; z < depth; ++z) 31 34 { 32 fprintf(file, "%f %f 0.0\n", vector[index].x, vector[index].y); 35 for (int y = 0; y < height; ++y) 36 { 37 for (int x = 0; x < width; ++x) 38 { 39 ptr = vector + (y * ori_width + x); 40 fprintf(file, "%f %f 0.0\n", ptr->x, ptr->y); 41 } 42 } 33 43 } 34 44 } 45 else 46 { 47 int offsetx = 0, offsety = 0; 48 if (ori_width > 512) { width = 512; offsetx = (ori_width - width) / 2;} 49 if (ori_height > 512) { height = 512; offsety = (ori_height - height) / 2;} 50 51 int dataindex = 0; 52 Vector2* ptr; 53 for (int z = 0; z < depth; ++z) 54 { 55 for (int y = 0; y < height; ++y) 56 { 57 for (int x = 0; x < width; ++x) 58 { 59 ptr = vector + ((y + offsety) * ori_width + x + offsetx); 60 fprintf(file, "%f %f 0.0\n", ptr->x, ptr->y); 61 } 62 } 63 } 64 } 65 35 66 36 67 fclose(file); … … 39 70 int main(int argc, char* argv[]) 40 71 { 41 #if 142 if (argc < 7)72 #if 0 73 if (argc < 6) 43 74 { 44 printf("usage: mat2dx <Ix ascii filename> <Iy ascii filename> <width> <height> <depth> <outputfilename>\n"); 45 return 0; 75 printf("usage: mat2dx <Ix ascii filename> <Iy ascii filename> <width> <height> <depth>\n"); 46 76 } 47 77 FILE* xComp = fopen(argv[1], "rb"); 48 78 FILE* yComp = fopen(argv[2], "rb"); 49 int width , height, depth;79 int width = 610, height = 218; 50 80 width = atoi(argv[3]); 51 81 height = atoi(argv[4]); 52 82 depth = atoi(argv[5]); 53 83 #else 54 int width = 610, height = 218; 84 //int width =218, height = 610;(?) 85 int width =610, height = 218; 55 86 int depth = 50; 56 87 FILE* xComp = fopen("Ix_data.txt", "rb"); … … 94 125 fclose(yComp); 95 126 96 storeInOpenDX( argv[6], data, width, height, depth);127 storeInOpenDX("flow2d.dx", data, width, height, depth); 97 128 }
Note: See TracChangeset
for help on using the changeset viewer.