Matrix3.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 #ifndef MATRIX3_HH
00018 #define MATRIX3_HH
00019 
00020 #include "math/Vector3.hh"
00021 
00022 namespace gazebo
00023 {
00024     namespace math
00025   {
00028 
00030     class Matrix3
00031     {
00033       public: Matrix3();
00034 
00037       public: Matrix3(const Matrix3 &_m);
00038 
00049       public: Matrix3(double _v00, double _v01, double _v02,
00050                       double _v10, double _v11, double _v12,
00051                       double _v20, double _v21, double _v22);
00052  
00054       public: virtual ~Matrix3();
00055   
00060       public: void SetFromAxes(const Vector3 &_xAxis, 
00061                                const Vector3 &_yAxis, 
00062                                const Vector3 &_zAxis);
00063   
00064 
00066       public: void SetFromAxis(const Vector3 &_axis, double _angle);
00067 
00071       public: void SetCol(unsigned int _c, const Vector3 &_v);
00072 
00076       public: friend std::ostream &operator<<( std::ostream &_out, 
00077                                                const gazebo::math::Matrix3 &_m )
00078             {
00079               for (int i=0; i < 3; i++)
00080               {
00081                 for (int j=0; j < 3; j++)
00082                 {
00083                   _out << _m.m[i][j] << " ";
00084                 }
00085                 _out << "\n";
00086               }
00087   
00088               return _out;
00089             }
00090 
00092       protected: double m[3][3];
00093       friend class Matrix4;
00094     };
00096   }
00097 }
00098 #endif