HelmertTransform.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: HelmertTransform.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002 
00003 //============================================================================
00004 //
00005 //  This file is part of GPSTk, the GPS Toolkit.
00006 //
00007 //  The GPSTk is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU Lesser General Public License as published
00009 //  by the Free Software Foundation; either version 2.1 of the License, or
00010 //  any later version.
00011 //
00012 //  The GPSTk is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU Lesser General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU Lesser General Public
00018 //  License along with GPSTk; if not, write to the Free Software Foundation,
00019 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00020 //  
00021 //  Copyright 2009, The University of Texas at Austin
00022 //
00023 //============================================================================
00024 
00025 #ifndef GPSTK_HELMERT_TRANSFORM_HPP
00026 #define GPSTK_HELMERT_TRANSFORM_HPP
00027 
00028 #include <map>
00029 #include <string>
00030 
00031 #include "Exception.hpp"
00032 #include "Matrix.hpp"
00033 #include "MatrixOperators.hpp"
00034 #include "Position.hpp"
00035 #include "ReferenceFrame.hpp"
00036 #include "Vector.hpp"
00037 #include "Xvt.hpp"
00038 
00039 namespace gpstk
00040 {
00041    class HelmertTransform
00042    {
00043 
00044    public:
00045 
00046       //Forward declarations so the structs don't have to be moved.
00047       struct Transform;
00048       struct TransformParameters;
00049 
00057       typedef std::map<ReferenceFrame, Transform> TransformMap;
00058 
00068       typedef std::map<ReferenceFrame, TransformMap> LookupMap;
00069 
00072       static const double MAS;
00075       static const double PPB;
00076 
00082       static HelmertTransform& instance();
00083 
00087       void dump();
00088 
00090 
00107       void defineTransform(const TransformParameters& tp,
00108                            const ReferenceFrame& to,
00109                            const ReferenceFrame& from    )
00110          throw(InvalidParameter);
00111 
00125       Transform& getTransform(const ReferenceFrame& from,
00126                               const ReferenceFrame& to   )
00127          throw(InvalidParameter);
00128 
00130 
00134       Position transform(const ReferenceFrame& to,
00135                          const Position& pos      )
00136          throw(InvalidParameter);
00137 
00141       Xvt transform(const ReferenceFrame& to,
00142                     const Xvt& pos           )
00143          throw(InvalidParameter);
00144 
00162       Triple posTransform(const ReferenceFrame& from,
00163                           const ReferenceFrame& to,
00164                           const Triple& pos          )
00165          throw(InvalidParameter);
00166 
00176       Triple velTransform(const ReferenceFrame& from,
00177                           const ReferenceFrame& to,
00178                           const Triple& vel          )
00179          throw(InvalidParameter);
00180 
00189       Vector<double> posTransform(const ReferenceFrame& from,
00190                                   const ReferenceFrame& to,
00191                                   const Vector<double>& pos  )
00192          throw(InvalidParameter);
00193 
00202       Vector<double> velTransform(const ReferenceFrame& from,
00203                                   const ReferenceFrame& to,
00204                                   const Vector<double>& vel  )
00205          throw(InvalidParameter);
00206 
00207          // The struct that gets passed to this class.
00208          // Holds basic information about the transformation, including
00209          // its rotation parameters, scale factor and translation values.
00210          // In addition, there is a string for a brief description of the
00211          // publication from which these parameters were taken, or other
00212          // information deemed neccessary.
00223       struct TransformParameters
00224       {
00225          double r1;   
00226          double r2;   
00227          double r3;   
00228          double t1;   
00229          double t2;   
00230          double t3;   
00231          double scale;   
00232 
00234          // Used for publication info.
00235          std::string description;
00236 
00237       }; //struct TransformParameters
00238 
00239          // The stored struct, takes the params struct and builds the matrices.
00249       struct Transform
00250       {
00251          TransformParameters params;     
00252 
00253          Matrix<double> rotation;        
00254          Matrix<double> inverseRotation; 
00255          Vector<double> translation;     
00256 
00257 
00258       }; //struct Transform
00259 
00260 
00261    protected:
00262 
00263          // This function does the work for the other functions.
00282       Vector<double> helperTransform(const ReferenceFrame& from,
00283                                      const ReferenceFrame& to,
00284                                      const Vector<double>& vec,
00285                                      bool translate             )
00286          throw(InvalidParameter);
00287 
00288       //Initializer
00295       void populateTransformMaps();
00296 
00310       Transform buildTransform(const TransformParameters& tp)
00311          throw();
00312 
00315       LookupMap fromMap;
00316 
00318 
00319       // Constructors. Because we want this class to be a singleton,
00320       // these need to be private or protected.
00326       HelmertTransform()
00327          throw();
00328 
00332       HelmertTransform(const HelmertTransform& ht)
00333          throw()
00334       {}
00335 
00339       HelmertTransform& operator=(const HelmertTransform& ht)
00340          throw();
00341 
00342    }; //class HelmertTransform
00343 
00344 } //namespace gpstk
00345 
00346 #endif

Generated on Sat May 18 03:31:05 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1