Changeset 5846 for trunk/Ohana/src/opihi/cmd.data/tvcontour.c
- Timestamp:
- Dec 27, 2005, 5:06:32 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/tvcontour.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/tvcontour.c
r4689 r5846 42 42 43 43 # define DUMP { \ 44 sprintf (&buffer[Nline*128], "%14s %20.10f %20.10f %20.10f %20.10f ", "LINE", Npix*x, Npix*y, Npix*dx, Npix*dy); \ 45 Nline ++; \ 46 if (Nline == 512) { \ 47 SendGraphCommand (Ximage, 16, "NLINES %7d ", Nline); \ 48 write (Ximage, buffer, Nline*128); \ 49 bzero (buffer, 65536); \ 50 Nline = 0; \ 51 } \ 52 continue; } 53 54 # define NUMP { \ 55 sprintf (&buffer[Nline*128], "%14s %20.10f %20.10f %20.10f %20.10f ", "LINE", Npix*x, Npix*y, Npix*dx, Npix*dy); \ 56 Nline ++; \ 57 if (Nline == 512) { \ 58 SendGraphCommand (Ximage, 16, "NLINES %7d ", Nline); \ 59 write (Ximage, buffer, Nline*128); \ 60 bzero (buffer, 65536); \ 61 Nline = 0; \ 62 } } 44 overlay[Noverlay].type = KII_OVERLAY_LINE; \ 45 overlay[Noverlay].x = Npix*x; \ 46 overlay[Noverlay].y = Npix*y; \ 47 overlay[Noverlay].dx = Npix*dx; \ 48 overlay[Noverlay].dy = Npix*dy; \ 49 Noverlay ++; \ 50 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 1000); \ 51 } 63 52 64 53 int tvcontour (int argc, char **argv) { 65 54 66 int i, j, ii, jj, n, Npix, Nx, Ny, Nline;55 int i, j, ii, jj, Npix, Nx, Ny; 67 56 float level, d00, d01, d10, d11, tmp; 68 57 float x, y, dx, dy; 69 58 float *v00, *v01, *v10, *v11; 70 59 float *Vout, *Vin, *matrix; 71 char *buffer; 72 int Ximage, Nimage, N; 60 int Ximage, Nimage, N, Noverlay, NOVERLAY; 73 61 Buffer *buf; 62 KiiOverlay *overlay; 74 63 75 64 Nimage = -1; … … 87 76 88 77 if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE); 89 if (!SelectOverlay (argv[2], &n)) return (FALSE);90 78 91 79 level = atof (argv[3]); … … 115 103 } 116 104 } 117 } 118 else { 105 } else { 119 106 fprintf (stderr, "using scale of 1\n"); 120 107 matrix = (float *)(buf[0].matrix.buffer); 121 108 } 122 109 123 SendGraphCommand (Ximage, 4, "LOAD"); /* force Ximage to look for the incoming image */ 124 SendGraphCommand (Ximage, 16, "OVERLAY %7d ", n); 125 ALLOCATE (buffer, char, 65536); /* space for 512 lines of 128 bytes */ 126 bzero (buffer, 65536); 127 Nline = 0; 110 Noverlay = 0; 111 NOVERLAY = 1000; 112 ALLOCATE (overlay, KiiOverlay, NOVERLAY); 128 113 129 114 v00 = matrix; … … 150 135 LL; 151 136 DUMP; 137 continue; 152 138 } 153 139 if ((d01 > 0) && (d11 <= 0)) { /* - */ 154 140 HZ; 155 141 DUMP; 142 continue; 156 143 } 157 144 if ((d01 > 0) && (d11 > 0)) { /* / */ 158 145 UL; 159 146 DUMP; 147 continue; 160 148 } 161 149 if ((d01 <= 0) && (d11 > 0)) { /* \\ */ 162 150 LL; 163 NUMP;151 DUMP; 164 152 UR; 165 153 DUMP; 154 continue; 166 155 } 167 156 } … … 171 160 LL; 172 161 DUMP; 162 continue; 173 163 } 174 164 if ((d01 <= 0) && (d11 > 0)) { /* - */ 175 165 HZ; 176 166 DUMP; 167 continue; 177 168 } 178 169 if ((d01 <= 0) && (d11 <= 0)) { /* / */ 179 170 UL; 180 171 DUMP; 172 continue; 181 173 } 182 174 if ((d01 > 0) && (d11 <= 0)) { /* // */ 183 175 UL; 184 NUMP;176 DUMP; 185 177 LR; 186 178 DUMP; 179 continue; 187 180 } 188 181 } … … 193 186 LR; 194 187 DUMP; 188 continue; 195 189 } 196 190 if ((d01 <= 0) && (d11 > 0)) { 197 191 UR; 198 192 DUMP; 193 continue; 199 194 } 200 195 if ((d01 > 0) && (d11 > 0)) { 201 196 VT; 202 197 DUMP; 198 continue; 203 199 } 204 200 } … … 208 204 LR; 209 205 DUMP; 206 continue; 210 207 } 211 208 if ((d01 > 0) && (d11 <= 0)) { 212 209 UR; 213 210 DUMP; 211 continue; 214 212 } 215 213 if ((d01 <= 0) && (d11 <= 0)) { 216 214 VT; 217 215 DUMP; 216 continue; 218 217 } 219 218 } … … 235 234 if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) { 236 235 x = i + (level - *v01)/(*v01 - *v00); 237 NUMP;236 DUMP; 238 237 } 239 238 } … … 248 247 if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) { 249 248 x = i + (level - *v01)/(*v01 - *v00); 250 NUMP;249 DUMP; 251 250 } 252 251 } … … 261 260 if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) { 262 261 y = j + (level - *v01)/(*v01 - *v00); 263 NUMP;262 DUMP; 264 263 } 265 264 } … … 274 273 if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) { 275 274 y = j + (level - *v01)/(*v01 - *v00); 276 NUMP;275 DUMP; 277 276 } 278 277 } 279 278 280 if (Nline > 0) { 281 SendGraphCommand (Ximage, 16, "NLINES %7d ", Nline); 282 write (Ximage, buffer, Nline*128); 283 } 284 285 free (buffer); 286 SendGraphCommand (Ximage, 16, "DONE"); 279 KiiLoadOverlay (Ximage, overlay, Noverlay, argv[2]); 280 free (overlay); 287 281 288 282 if (Npix != 1) free (matrix);
Note:
See TracChangeset
for help on using the changeset viewer.
