Gazebo

Quatern.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: External interfaces for Gazebo
00022  * Author: Nate Koenig
00023  * Date: 03 Apr 2007
00024  * SVN: $Id: Quatern.hh 156 2007-11-26 20:26:57Z natepak $
00025  */
00026 
00027 #ifndef QUATERN_HH
00028 #define QUATERN_HH
00029 
00030 #include <iostream>
00031 #include "Vector3.hh"
00032 
00033 namespace gazebo
00034 {
00035 
00039 
00041 class Quatern
00042 {
00044   public: Quatern();
00045 
00051   public: Quatern( const double &u, const double &x, const double &y, const double &z);
00052 
00055   public: Quatern( const Quatern &qt );
00056 
00058   public: ~Quatern();
00059 
00062   public: const Quatern &operator=(const Quatern &qt);
00063 
00065   public: void Invert();
00066 
00069   public: Quatern GetInverse() const;
00070 
00072   public: void SetToIdentity();
00073 
00075   public: void Normalize();
00076 
00082   public: void SetFromAxis(double x, double y, double z, double a);
00083          
00086   public: void SetFromEuler(const Vector3 &vec);
00087 
00090   public: Vector3 GetAsEuler();
00091 
00093   public: double GetRoll();
00094 
00096   public: double GetPitch();
00097 
00099   public: double GetYaw();
00100 
00103   public: Quatern GetAsAxis();
00104 
00107   public: void Scale(double scale);
00108 
00112   public: Quatern operator*( const Quatern &qt ) const;
00113 
00116   public: bool IsFinite() const;
00117 
00119   public: double u;
00120 
00122   public: double x;
00123 
00125   public: double y;
00126 
00128   public: double z;
00129 
00134   public: friend  std::ostream &operator<<( std::ostream &out, const gazebo::Quatern &q )
00135   {
00136     out << q.u << " " << q.x << " " << q.y << " " << q.z;
00137 
00138     return out;
00139   }
00140 
00141 };
00142 
00144 }
00145 
00146 #endif

Last updated Aug 04 2007