home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / geometry / transform3 / tm3transpose.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-23  |  1.3 KB  |  45 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Pat Hanrahan, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #include "transform3.h"
  13.  
  14. /*-----------------------------------------------------------------------
  15.  * Function:    Tm3Transpose
  16.  * Description:    transpose a matrix
  17.  * Args:    T: the matrix to transpose (INPUT)
  18.  *        Ttrans: the transposed matrix (OUTPUT)
  19.  * Returns:    nothing
  20.  * Author:    hanrahan, mbp
  21.  * Date:    Thu Aug  8 14:41:24 1991
  22.  * Notes:    
  23.  */
  24. void
  25. Tm3Transpose( T, Ttrans )
  26.     Transform3 T, Ttrans;
  27. {
  28.     register int i, j;
  29.     double t;
  30.  
  31.     if( T != Ttrans ) {
  32.         for( i=0; i<4; i++ )
  33.             for( j=0; j<4; j++ )
  34.                 Ttrans[i][j] = T[j][i];
  35.     }
  36.     else {
  37.         for( i=0; i<4; i++ ) 
  38.             for( j=0; j<i; j++ ) {
  39.                 t = T[i][j];
  40.                 T[i][j] = T[j][i];
  41.                 T[j][i] = t;
  42.             }
  43.     }
  44. }
  45.