object_table.h

説明を見る。
00001 // -*-c++-*-
00002 
00008 /*
00009  *Copyright:
00010 
00011  Copyright (C) Hidehisa AKIYAMA
00012 
00013  This code is free software; you can redistribute it and/or
00014  modify it under the terms of the GNU Lesser General Public
00015  License as published by the Free Software Foundation; either
00016  version 2.1 of the License, or (at your option) any later version.
00017 
00018  This library is distributed in the hope that it will be useful,
00019  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  Lesser General Public License for more details.
00022 
00023  You should have received a copy of the GNU Lesser General Public
00024  License along with this library; if not, write to the Free Software
00025  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  *EndCopyright:
00028  */
00029 
00031 
00032 #ifndef RCSC_PLAYER_OBJECT_TABLE_H
00033 #define RCSC_PLAYER_OBJECT_TABLE_H
00034 
00035 #include <rcsc/geom/vector_2d.h>
00036 #include <rcsc/types.h>
00037 
00038 #include <map>
00039 #include <vector>
00040 
00041 namespace rcsc {
00042 
00047 class ObjectTable {
00048 public:
00049 
00051     static const double SERVER_EPS;
00052 
00056     struct DataEntry {
00057         double M_seen_dist; 
00058         double M_average; 
00059         double M_error; 
00060 
00064         DataEntry()
00065             : M_seen_dist( 0.0 )
00066             , M_average( 0.0 )
00067             , M_error( 0.0 )
00068           { }
00069 
00074         explicit
00075         DataEntry( const double & dist )
00076             : M_seen_dist( dist )
00077             , M_average(0.0)
00078             , M_error(0.0)
00079           { }
00080 
00087         DataEntry( const double & dist,
00088                    const double & ave,
00089                    const double & err )
00090             : M_seen_dist( dist )
00091             , M_average( ave )
00092             , M_error( err )
00093           { }
00094     };
00095 
00096 private:
00097 
00099     std::map< MarkerID, Vector2D > M_landmark_map;
00100 
00102     std::vector< DataEntry > M_static_table;
00103 
00105     std::vector< DataEntry > M_movable_table;
00106 
00107 public:
00111     explicit
00112     ObjectTable( const SideID ourside );
00113 
00114 
00119     const
00120     std::map< MarkerID, Vector2D > & landmarkMap() const
00121       {
00122           return M_landmark_map;
00123       }
00124 
00132     bool getStaticObjInfo( const double & see_dist,
00133                            double * ave,
00134                            double * err ) const;
00135 
00143     bool getMovableObjInfo( const double & see_dist,
00144                             double * ave,
00145                             double * err ) const;
00146 
00153     static
00154     double quantize( const double & value,
00155                      const double & qstep );
00156 
00163     static
00164     double quantize_dist( const double & unq_dist,
00165                           const double & qstep );
00166 
00167 private:
00168 
00172     void createLandmarkMap( const SideID ourside );
00173 
00177     void createTable();
00178 
00186     void create( const double & static_qstep,
00187                  const double & movable_qstep );
00188 
00194     void createTable( const double & qstep,
00195                       std::vector< DataEntry > & table );
00196 
00197 };
00198 
00199 }
00200 
00201 #endif

librcscに対してThu May 1 15:41:21 2008に生成されました。  doxygen 1.5.0