00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
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 }
00237
00238 #endif