orca-robotics


INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

REPOSITORY
Interfaces
Components
Libraries
Utilities
Software Map

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
Wiki
login/pass: orca/orca

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

coordinateframe.h

00001 #ifndef ORCAVIEW3D_COORDINATEFRAME_H
00002 #define ORCAVIEW3D_COORDINATEFRAME_H
00003 
00004 #include "vector3.h"
00005 #include "matrix4.h"
00006 #include <iostream>
00007 #include <string>
00008 
00009 namespace orcaqgui3d {
00010 
00011 //
00012 // @author Alex Brooks
00013 //
00014 // @brief This class represents a coordinate frame in the usual Orca sense:
00015 //        The default coordinate frame has x-y plane is parallel to the ground, z up.
00016 //        A local coordinate frame has the x-axis pointing forwards, y left, and z up.
00017 //
00019 //                   [ fwd.x left.x up.x ]   [ pos.x ]                        //
00020 // Coordinate Frame: [ fwd.y left.y up.y ] + [ pos.y ]                        //
00021 //                   [ fwd.z left.z up.z ]   [ pos.z ]                        //
00023 class CoordinateFrame
00024 {
00025 
00026 public: 
00027 
00028     CoordinateFrame();
00029     CoordinateFrame( const Vector3 &pos,
00030                      double         roll,
00031                      double         pitch,
00032                      double         yaw );
00033     // Create from homogeneous matrix
00034     CoordinateFrame( const Matrix4 &m );
00035     CoordinateFrame( const Vector3 &pos,
00036                      const Vector3 &fwd,
00037                      const Vector3 &up );
00038 
00039     const Vector3 &fwd()  const { return fwd_; }
00040     const Vector3 &left() const { return left_; }
00041     const Vector3 &up()   const { return up_; }
00042     const Vector3 &pos()  const { return pos_; }
00043 
00044     void setOrientation( const Vector3 &fwd, const Vector3 &up );
00045 
00046     void translate( const Vector3 &offset );
00047     void rotate( const Vector3 &axis, double angle );
00048 
00049     // (roll, pitch, yaw) are NOT the native description of the coordinate frame!
00050     // These shouldn't normally need to be used.
00051     double roll() const;
00052     double pitch() const;
00053     double yaw() const;
00054 
00055     // The two versions of increaseYaw:
00056     //   - increaseYawSpace rotates around the frame's current z-axis
00057     //       (imagine yaw-ing a spaceship)
00058     //   - increaseYawPlanet rotates around the world's z-axis
00059     //       (imagine yaw-ing around the gravity vector on a planet)
00060     void increaseRoll( double angle );
00061     void increasePitch( double angle );
00062     void increaseYawSpace( double angle );
00063     void increaseYawPlanet( double angle );
00064 
00065     Matrix4 homogeneousMatrix() const;
00066 
00067     // Transform the coordinate frame by multiplying by another matrix
00068     void multMatrix( const Matrix4 &m );
00069 
00070     // Assumes the bottom row of m is '0,0,0,1'.
00071     void set( const Matrix4 &m );
00072 
00073 private: 
00074 
00075     Vector3 fwd_;
00076     Vector3 left_;
00077     Vector3 up_;
00078     Vector3 pos_;
00079 };
00080 
00081 std::string toString( const CoordinateFrame &c );
00082 inline std::ostream &operator<<( std::ostream &s, const CoordinateFrame &c )
00083 { return s << toString(c); }
00084 
00085 }
00086 
00087 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5