Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Output.h

Go to the documentation of this file.
00001 /************************************************************** ggt-head beg
00002  *
00003  * GGT: Generic Graphics Toolkit
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum
00007  *
00008  * -----------------------------------------------------------------
00009  * File:          $RCSfile: Output.h,v $
00010  * Date modified: $Date: 2002/10/11 10:34:23 $
00011  * Version:       $Revision: 1.13 $
00012  * -----------------------------------------------------------------
00013  *
00014  *********************************************************** ggt-head end */
00015 /*************************************************************** ggt-cpr beg
00016 *
00017 * GGT: The Generic Graphics Toolkit
00018 * Copyright (C) 2001,2002 Allen Bierbaum
00019 *
00020 * This library is free software; you can redistribute it and/or
00021 * modify it under the terms of the GNU Lesser General Public
00022 * License as published by the Free Software Foundation; either
00023 * version 2.1 of the License, or (at your option) any later version.
00024 *
00025 * This library is distributed in the hope that it will be useful,
00026 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00028 * Lesser General Public License for more details.
00029 *
00030 * You should have received a copy of the GNU Lesser General Public
00031 * License along with this library; if not, write to the Free Software
00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00033 *
00034  ************************************************************ ggt-cpr end */
00035 #ifndef _GMTL_OUTPUT_H_
00036 #define _GMTL_OUTPUT_H_
00037 
00038 #include <iostream>
00039 #include <gmtl/Util/Assert.h>
00040 #include <gmtl/VecBase.h>
00041 #include <gmtl/Matrix.h>
00042 #include <gmtl/Quat.h>
00043 #include <gmtl/Tri.h>
00044 #include <gmtl/Plane.h>
00045 #include <gmtl/Sphere.h>
00046 #include <gmtl/EulerAngle.h>
00047 #include <gmtl/AABox.h>
00048 
00049 namespace gmtl
00050 {
00055 
00066    template< class DATA_TYPE, unsigned SIZE >
00067    std::ostream& operator<<( std::ostream& out,
00068                              const VecBase<DATA_TYPE, SIZE>& v )
00069    {
00070       out << "(";
00071       for ( unsigned i=0; i<SIZE; ++i )
00072       {
00073          if ( i != 0 )
00074          {
00075             out << ", ";
00076          }
00077          out << v[i];
00078       }
00079       out << ")";
00080       return out;
00081    }
00082 
00092    template< class DATA_TYPE, typename ROTATION_ORDER>
00093    std::ostream& operator<<( std::ostream& out,
00094                              const EulerAngle<DATA_TYPE, ROTATION_ORDER>& e )
00095    {
00096       const DATA_TYPE* angle_data(e.getData());
00097       out << "{" << angle_data[0] << ", " << angle_data[1] << ", " << angle_data[2] << "}";
00098       return out;
00099    }
00100 
00101 
00116    template< class DATA_TYPE, unsigned ROWS, unsigned COLS >
00117    std::ostream& operator<<( std::ostream& out,
00118                              const Matrix<DATA_TYPE, ROWS, COLS>& m )
00119    {
00120       for ( unsigned row=0; row<ROWS; ++row )
00121       {
00122          out << "|";
00123          for ( unsigned col=0; col<COLS; ++col )
00124          {
00125             out << " " << m(row, col);
00126          }
00127          out << " |" << std::endl;
00128       }
00129       return out;
00130    }
00131 
00142    template< typename DATA_TYPE >
00143    std::ostream& operator<<( std::ostream& out, const Quat<DATA_TYPE>& q )
00144    {
00145       out << q.mData;
00146       return out;
00147    }
00148 
00164    template< typename DATA_TYPE >
00165    std::ostream& operator<<( std::ostream& out, const Tri<DATA_TYPE> &t )
00166    {
00167       out << t[0] << ", " << t[1] << ", " << t[2];
00168       return out;
00169    }
00170 
00185    template< typename DATA_TYPE >
00186    std::ostream& operator<<( std::ostream& out, const Plane<DATA_TYPE> &p )
00187    {
00188       out << p.mNorm << ", " << p.mOffset;
00189       return out;
00190    }
00191 
00206    template< typename DATA_TYPE >
00207    std::ostream& operator<<( std::ostream& out, const Sphere<DATA_TYPE> &s )
00208    {
00209       out << s.mCenter << ", " << s.mRadius;
00210       return out;
00211    }
00212 
00227    template< typename DATA_TYPE >
00228    std::ostream& operator<<( std::ostream& out, const AABox<DATA_TYPE>& b)
00229    {
00230       out << b.mMin << " " << b.mMax << " ";
00231       out << (b.mEmpty ? "true" : "false");
00232       return out;
00233    }
00235 
00236 } // end namespace gmtl
00237 
00238 #endif

Generated on Mon Apr 7 15:28:55 2003 for GenericMathTemplateLibrary by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002