================= CM_TransposeGrid Swaps the rows and columns in place ================= */
| 231 | ================= |
| 232 | */ |
| 233 | static void CM_TransposeGrid( cGrid_t *grid ) { |
| 234 | int i, j, l; |
| 235 | vec3_t temp; |
| 236 | qboolean tempWrap; |
| 237 | |
| 238 | if ( grid->width > grid->height ) { |
| 239 | for ( i = 0 ; i < grid->height ; i++ ) { |
| 240 | for ( j = i + 1 ; j < grid->width ; j++ ) { |
| 241 | if ( j < grid->height ) { |
| 242 | // swap the value |
| 243 | VectorCopy( grid->points[i][j], temp ); |
| 244 | VectorCopy( grid->points[j][i], grid->points[i][j] ); |
| 245 | VectorCopy( temp, grid->points[j][i] ); |
| 246 | } else { |
| 247 | // just copy |
| 248 | VectorCopy( grid->points[j][i], grid->points[i][j] ); |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | } else { |
| 253 | for ( i = 0 ; i < grid->width ; i++ ) { |
| 254 | for ( j = i + 1 ; j < grid->height ; j++ ) { |
| 255 | if ( j < grid->width ) { |
| 256 | // swap the value |
| 257 | VectorCopy( grid->points[j][i], temp ); |
| 258 | VectorCopy( grid->points[i][j], grid->points[j][i] ); |
| 259 | VectorCopy( temp, grid->points[i][j] ); |
| 260 | } else { |
| 261 | // just copy |
| 262 | VectorCopy( grid->points[i][j], grid->points[j][i] ); |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | l = grid->width; |
| 269 | grid->width = grid->height; |
| 270 | grid->height = l; |
| 271 | |
| 272 | tempWrap = grid->wrapWidth; |
| 273 | grid->wrapWidth = grid->wrapHeight; |
| 274 | grid->wrapHeight = tempWrap; |
| 275 | } |
| 276 | |
| 277 | /* |
| 278 | =================== |
no test coverage detected