quat-io.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! operator() for non-const object */
00003 inline double& quat::operator()(const int& i)
00004 {
00005   switch( i ){
00006   case 0: return x;
00007   case 1: return y;
00008   case 2: return z;
00009   case 3: return r;
00010   default:
00011     std::cerr << "[ERROR] quat::operator()(const int&)" << std::endl
00012               << "The required component was not 0, 1, 2, or 3." << std::endl
00013               << "Your input was (" << i << ")." << std::endl;
00014     std::exit(1);
00015   }
00016 }
00017 
00018 //=============================================================================
00019 /*! operator() for const object */
00020 inline double quat::operator()(const int& i) const
00021 {
00022   switch( i ){
00023   case 0: return x;
00024   case 1: return y;
00025   case 2: return z;
00026   case 3: return r;
00027   default:
00028     std::cerr << "[ERROR] quat::operator()(const int&) const" << std::endl
00029               << "The required component was not 0, 1, 2, or 3." << std::endl
00030               << "Your input was (" << i << ")." << std::endl;
00031     std::exit(1);
00032   }
00033 }
00034 
00035 ///////////////////////////////////////////////////////////////////////////////
00036 ///////////////////////////////////////////////////////////////////////////////
00037 ///////////////////////////////////////////////////////////////////////////////
00038 
00039 //============================================================================ 
00040 inline std::ostream& operator<<(std::ostream& s, const quat& q)
00041 {
00042   s << "( " << q.x << ", " << q.y << ", " << q.z
00043     << "; " << q.r << " )";
00044   return s;
00045 }

Generated on Tue Mar 15 16:02:38 2005 for QVM by  doxygen 1.4.1