kick_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_KICK_TABLE_H
00033 #define RCSC_PLAYER_KICK_TABLE_H
00034 
00035 #include <rcsc/geom/vector_2d.h>
00036 
00037 namespace rcsc {
00038 
00039 class WorldModel;
00040 
00041 /*-------------------------------------------------------------------*/
00042 /*
00043   \class KickPoint
00044   \brief kick subtarget point info class
00045 */
00046 class KickPoint {
00047 public:
00048     static const int MAX_INTERFERE; 
00049 
00050 private:
00051     std::size_t M_index; 
00052     Vector2D M_ball_pos; 
00053     double M_kick_rate; 
00054 
00058     int M_interfere_cycle;
00059 
00061     KickPoint();
00062 public:
00064     KickPoint( const std::size_t index,
00065                const Vector2D & ball_pos,
00066                const double & kick_rate,
00067                const int cycle )
00068         : M_index( index )
00069         , M_ball_pos( ball_pos )
00070         , M_kick_rate( kick_rate )
00071         , M_interfere_cycle( cycle )
00072       { }
00073 
00075     std::size_t getIndex() const
00076       {
00077           return M_index;
00078       }
00079 
00081     const
00082     Vector2D & ballPos() const
00083       {
00084           return M_ball_pos;
00085       }
00087     const
00088     double & kickRate() const
00089       {
00090           return M_kick_rate;
00091       }
00093     int interfereCycle() const
00094       {
00095           return M_interfere_cycle;
00096       }
00097 };
00098 
00099 typedef std::vector< KickPoint > KickPointCont;
00100 typedef std::vector< const KickPoint * > KickPointPtrCont;
00101 
00102 class TwoKick {
00103 private:
00104     std::size_t M_first;
00105     std::size_t M_second;
00106     double M_score;
00107 public:
00108     TwoKick( const std::size_t first,
00109              const std::size_t first,
00110              const double & score )
00111         : M_first( first )
00112         , M_sencod( second )
00113         , M_score( score )
00114       { }
00115 
00116 };
00117 
00118 /*-------------------------------------------------------------------*/
00128 class KickTable {
00129 public:
00130     enum {
00131         MAX_DEPTH = 2,
00132         ANGLE_DIVS_LOW = 8,
00133         ANGLE_DIVS_HIGH = 12
00134     };
00135 private:
00136 
00141     KickPointCont M_kick_points[MAX_DEPTH];
00146     KickPointPtrCont M_kick_points_ptr[MAX_DEPTH];
00147 
00148     // noncopyable
00149     Kicktable( const KickTable & );
00150     KickTable & operator=( const KickTable & );
00151 public:
00153     KickTable();
00154 
00156     void update( const WorldModel & world );
00157 
00164     inline
00165     const
00166     KickPointPtrCont * getKickPoints( const int depth ) const
00167       {
00168           if ( depth < 0 || MAX_DEPTH <= depth )
00169           {
00170               return static_cast< KickPointPtrCont* >( 0 );
00171           }
00172           return &( M_kick_points_ptr[depth] );
00173       }
00174 
00175 private:
00177     void setPoints( const WorldModel & world );
00179     int calcInterfereCycle( const WorldModel & world,
00180                             const Vector2D & point,
00181                             const int depth );
00182 
00184     void sortPoints();
00185 
00186 };
00187 
00188 }
00189 
00190 #endif

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