32#ifndef RCSC_SOCCERMATH_H
33#define RCSC_SOCCERMATH_H
61 const double & dir_diff,
62 const double & kprate,
65 const double & kmargin )
68 - 0.25 * std::fabs( dir_diff ) / 180.0
69 - 0.25 * ( dist - bsize - psize ) / kmargin );
86 const double & back_dash_rate,
87 const double & side_dash_rate )
89 return ( std::fabs( dir ) > 90.0
90 ? back_dash_rate - ( ( back_dash_rate - side_dash_rate )
91 * ( 1.0 - ( std::fabs( dir ) - 90.0 ) / 90.0 )
93 : side_dash_rate + ( ( 1.0 - side_dash_rate )
94 * ( 1.0 - std::fabs( dir ) / 90.0 ) )
113 const double & speed,
114 const double & inertiamoment )
116 return turn_moment / ( 1.0 + inertiamoment * speed );
136 const double & dprate,
137 const double & effort,
138 const double & decay )
148 return ( ( std::fabs( dash_power ) * dprate * effort )
166 const double & dprate,
167 const double & effort,
168 const double & decay,
169 const double & speed_max )
172 return ( std::fabs( dash_power ) * dprate * effort
173 > speed_max * ( 1.0 - decay ) );
192 const double & decay )
195 *= ( ( 1.0 - std::pow( decay, n_step ) ) / ( 1.0 - decay ) );
213 const double & decay )
248 const double & decay )
251 * ( 1.0 - std::pow( decay, n_step ) )
267 const double & n_step_real,
268 const double & decay )
271 * ( 1.0 - std::pow( decay, n_step_real ) )
286 const double & decay )
288 return Vector2D( initial_vel ) /= ( 1.0 - decay );
303 const double & decay )
330 const double & decay )
332 return initial_speed / ( 1.0 - decay );
350 const double & qstep )
352 return rint( value / qstep ) * qstep;
377 const double & qstep )
394 const double & qstep )
396 return ( rint( dist / qstep ) - 0.5 ) * qstep;
409 const double & qstep )
411 return ( rint( dist / qstep ) + 0.5 ) * qstep;
428 const double & weight,
429 const double & wind_force,
430 const double & wind_dir,
431 const double & wind_weight,
432 const double & wind_rand,
444 const double & qstep );
2D point vector class
Definition: vector_2d.h:46
double unquantize_min(const double &dist, const double &qstep)
calculate minnimal value by inverse quantize function
Definition: soccer_math.h:393
constexpr double SERVER_EPS
epsilon value
Definition: soccer_math.h:40
double unquantize_max(const double &dist, const double &qstep)
calculate maximal value by inverse quantize function
Definition: soccer_math.h:408
Vector2D wind_effect(const double &speed, const double &weight, const double &wind_force, const double &wind_dir, const double &wind_weight, const double &wind_rand, Vector2D *wind_error)
calculate wind effect
Vector2D inertia_n_step_point(const Vector2D &initial_pos, const Vector2D &initial_vel, const int n_step, const double &decay)
estimate future point after n steps only by inertia. No additional acceleration
Definition: soccer_math.h:210
double unquantize_error(const double &see_dist, const double &qstep)
calculate minmax error range by inverse quantize function
double final_speed(const double &dash_power, const double &dprate, const double &effort, const double &decay)
calculate converged max speed, when using "dash_power"
Definition: soccer_math.h:135
double effective_turn(const double &turn_moment, const double &speed, const double &inertiamoment)
calculate effective turn moment. it may be useful to redefine this algorighm in movement action modul...
Definition: soccer_math.h:112
double quantize(const double &value, const double &qstep)
quantize a floating point number
Definition: soccer_math.h:349
double kick_rate(const double &dist, const double &dir_diff, const double &kprate, const double &bsize, const double &psize, const double &kmargin)
calculate kick rate
Definition: soccer_math.h:60
Vector2D inertia_final_travel(const Vector2D &initial_vel, const double &decay)
calculate total travel only by inertia movement.
Definition: soccer_math.h:285
Vector2D inertia_n_step_travel(const Vector2D &initial_vel, const int n_step, const double &decay)
estimate future travel after n steps only by inertia. No additional acceleration.
Definition: soccer_math.h:190
double quantize_dist(const double &unq_dist, const double &qstep)
calculate quantized distance value about dist quantization
Definition: soccer_math.h:376
double inertia_n_step_distance(const double &initial_speed, const int n_step, const double &decay)
estimate travel distance only by inertia. No additional acceleration
Definition: soccer_math.h:246
double inertia_final_distance(const double &initial_speed, const double &decay)
calculate total travel distance only by inertia.
Definition: soccer_math.h:329
double dir_rate(const double &dir, const double &back_dash_rate, const double &side_dash_rate)
calculate effective dash power rate according to the input dash direction
Definition: soccer_math.h:85
bool can_over_speed_max(const double &dash_power, const double &dprate, const double &effort, const double &decay, const double &speed_max)
check if player's poteantial max speed is over plsyer_speed_max parameter.
Definition: soccer_math.h:165
Vector2D inertia_final_point(const Vector2D &initial_pos, const Vector2D &initial_vel, const double &decay)
calculate final reach point only by inertia.
Definition: soccer_math.h:301
2d vector class Header File.