ScanMap.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00031 
00033 /* @{ */
00034 
00035 #ifndef __SCAN_MAP_H_
00036 #define __SCAN_MAP_H_
00037 
00038 #ifdef MIP_HOST_APPLE
00039 #include <applePatch.h>
00040 #endif
00041 
00042 #include <stdlib.h>
00043 #include <string>
00044 #include <sstream>
00045 #include <vector>
00046 #include <assert.h>
00047 #include <pthread.h>
00048 
00049 #include <Scan.h>
00050 #include <Grid.h>
00051 
00052 
00053 namespace MipBaselib {
00054 class ScanMap{
00055  private:
00056   vector <Scan> _scans;
00057   vector <Pose> _poses;
00058   BoundBox _boundBox;
00059   
00060   Grid*   _grid;
00061   
00062   int _size;
00063   int _numPoints;
00064   vector<bool> _bisquits;
00065  
00066   void _computeBoundingBox();
00067  public:
00068   
00070   ScanMap(bool useGrid=true,BoundBox gridBoundBox=BoundBox());
00071   
00073   ~ScanMap(){
00074   }
00075   
00079   void pushBack(Scan &scan,Pose &pose);
00080   
00082   void popBack();
00083   
00090   bool findNearest(Pose &pose,Scan &scan,Decimal maxLinDist,Decimal maxAngDist);
00091   
00099   bool getExpectedScan(Scan &expectedScan,Pose &expectedPose, Decimal range, unsigned int samples, Angle angWidth);
00100   
00104   bool save(string fileName);
00105 
00109   bool load(string fileName);
00110   
00113   int getSize(){
00114    return _size;
00115   }
00116   
00120   void getGrid(Grid* &grid, Position& gridCenter){
00121    grid = _grid;
00122    gridCenter = _boundBox.center();
00123   }
00124   
00127   int getNumPoints(){
00128    return _numPoints;
00129   }
00130   
00134   int getNumPoints(int numScan);
00135   
00138   Scan* getScanPointer(int numScan);
00139   
00142   Pose* getPosePointer(int numPose);
00143 
00145   void setBisquit(int i){
00146    _bisquits[i] = true;
00147   }
00148   
00150   int createBisquit(){
00151    _bisquits.push_back(false);
00152    return _bisquits.size() - 1;
00153   }
00154   
00156   bool getBisquit(int i){
00157    return _bisquits[i];
00158   }
00159   
00161   void unsetBisquits(){
00162    _bisquits = vector<bool>(_bisquits.size(),false);
00163   }
00164   
00167   string print();
00168 };
00169 
00170 
00171 }; // end of namespace
00172 
00173 #endif
00174 
00175 /* @} */

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6