00001
00002
00003 inline double& mat::operator()(const int& i, const int& j)
00004 {
00005 switch( i ){
00006 case 0:
00007 switch( j ){
00008 case 0: return xx;
00009 case 1: return xy;
00010 case 2: return xz;
00011 }
00012 case 1:
00013 switch( j ){
00014 case 0: return yx;
00015 case 1: return yy;
00016 case 2: return yz;
00017 }
00018 case 2:
00019 switch( j ){
00020 case 0: return zx;
00021 case 1: return zy;
00022 case 2: return zz;
00023 }
00024 }
00025 std::cerr << "[ERROR] mat::operator()(const int&,const int&)" << std::endl
00026 << "The required component was not 0, 1, or 2." << std::endl
00027 << "Your input was (" << i << "," << j << ")." << std::endl;
00028 std::exit(1);
00029 }
00030
00031
00032
00033 inline double mat::operator()(const int& i, const int& j) const
00034 {
00035 switch( i ){
00036 case 0:
00037 switch( j ){
00038 case 0: return xx;
00039 case 1: return xy;
00040 case 2: return xz;
00041 }
00042 case 1:
00043 switch( j ){
00044 case 0: return yx;
00045 case 1: return yy;
00046 case 2: return yz;
00047 }
00048 case 2:
00049 switch( j ){
00050 case 0: return zx;
00051 case 1: return zy;
00052 case 2: return zz;
00053 }
00054 }
00055 std::cerr << "[ERROR] mat::operator()(const int&,const int&) const"
00056 << std::endl
00057 << "The required component was not 0, 1, or 2." << std::endl
00058 << "Your input was (" << i << "," << j << ")." << std::endl;
00059 std::exit(1);
00060 }
00061
00062
00063
00064
00065
00066
00067 inline std::ostream& operator<<(std::ostream& s, const mat& m)
00068 {
00069 s << "[ " << m.xx << ", " << m.xy << ", " << m.xz
00070 << "; " << m.yx << ", " << m.yy << ", " << m.yz
00071 << "; " << m.zx << ", " << m.zy << ", " << m.zz
00072 << " ]";
00073 return s;
00074 }