Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "rhsfun_math.h"
#include "symtab.h"
#include "kernel.h"
#include "mem.h"
#include "print.h"
#include "lexer.h"
#include "rhsfun.h"
#include "soar_rand.h"
#include <math.h>
Go to the source code of this file.
Macros | |
#define | PI 3.141592653589 |
#define | PI_OVER_TWO (PI/2) |
#define | RAD_TO_DEG(X) ((X*180)/PI) |
#define | TWO_PI (PI*2) |
#define | X 0 |
#define | Y 1 |
#define | Z 2 |
Functions | |
uint64_t | _dice_binom (uint64_t n, uint64_t m) |
double | _dice_prob_atleast (int64_t dice, int64_t sides, int64_t count) |
double | _dice_prob_exact (int64_t dice, int64_t sides, int64_t count) |
double | _dice_zero_tolerance (double in) |
Symbol * | abs_rhs_function_code (agent *thisAgent, list *args, void *) |
int64_t | air_soar_round_off_angle (int64_t n, int64_t m) |
Symbol * | atan2_rhs_function_code (agent *thisAgent, list *args, void *) |
double | bracket_rad_to_deg (double var) |
Symbol * | compute_heading_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | compute_range_rhs_function_code (agent *thisAgent, list *args, void *) |
int64_t | convert (double flo) |
double | convert_to_soar_angle (double heading_in_rads) |
Symbol * | cos_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | dice_prob_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | div_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | float_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | fp_divide_rhs_function_code (agent *thisAgent, list *args, void *) |
int64_t | heading_to_point (int64_t current_x, int64_t current_y, int64_t x, int64_t y) |
void | hrl_xydof_to_heading (double xydof[3], double *output) |
void | init_built_in_rhs_math_functions (agent *thisAgent) |
Symbol * | int_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | minus_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | mod_rhs_function_code (agent *thisAgent, list *args, void *) |
double | normalize_heading_float (double n) |
int64_t | normalize_heading_int (int64_t n) |
Symbol * | plus_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | rand_float_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | rand_int_rhs_function_code (agent *thisAgent, list *args, void *) |
void | remove_built_in_rhs_math_functions (agent *thisAgent) |
Symbol * | round_off_air_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | round_off_heading_air_rhs_function_code (agent *thisAgent, list *args, void *) |
double | round_off_heading_float (double n, double m) |
int64_t | round_off_heading_int (int64_t n, int64_t m) |
Symbol * | sin_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | sqrt_rhs_function_code (agent *thisAgent, list *args, void *) |
Symbol * | times_rhs_function_code (agent *thisAgent, list *args, void *) |
void | vec2_norm (double v[3], double r[3], int abort) |
void | vector_from_to_position (double pos1[3], double pos2[3], double vector[3]) |
#define PI 3.141592653589 |
Definition at line 760 of file rhsfun_math.cpp.
Referenced by convert_to_soar_angle().
#define PI_OVER_TWO (PI/2) |
Definition at line 761 of file rhsfun_math.cpp.
Referenced by convert_to_soar_angle().
Definition at line 763 of file rhsfun_math.cpp.
Referenced by bracket_rad_to_deg().
#define TWO_PI (PI*2) |
Definition at line 762 of file rhsfun_math.cpp.
Referenced by convert_to_soar_angle().
#define X 0 |
Definition at line 764 of file rhsfun_math.cpp.
Referenced by hrl_xydof_to_heading(), vec2_norm(), and vector_from_to_position().
#define Y 1 |
Definition at line 765 of file rhsfun_math.cpp.
Referenced by hrl_xydof_to_heading(), vec2_norm(), and vector_from_to_position().
#define Z 2 |
Definition at line 766 of file rhsfun_math.cpp.
Referenced by vector_from_to_position().
uint64_t _dice_binom | ( | uint64_t | n, |
uint64_t | m | ||
) |
Definition at line 1066 of file rhsfun_math.cpp.
Referenced by _dice_prob_exact().
double _dice_prob_atleast | ( | int64_t | dice, |
int64_t | sides, | ||
int64_t | count | ||
) |
Definition at line 1119 of file rhsfun_math.cpp.
References _dice_prob_exact().
Referenced by dice_prob_rhs_function_code().
double _dice_prob_exact | ( | int64_t | dice, |
int64_t | sides, | ||
int64_t | count | ||
) |
Definition at line 1086 of file rhsfun_math.cpp.
References _dice_binom().
Referenced by _dice_prob_atleast(), and dice_prob_rhs_function_code().
|
inline |
Definition at line 1060 of file rhsfun_math.cpp.
Referenced by dice_prob_rhs_function_code().
Definition at line 444 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, print(), print_with_symbols(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
int64_t air_soar_round_off_angle | ( | int64_t | n, |
int64_t | m | ||
) |
Definition at line 813 of file rhsfun_math.cpp.
Referenced by bracket_rad_to_deg().
Definition at line 391 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
double bracket_rad_to_deg | ( | double | var | ) |
Definition at line 835 of file rhsfun_math.cpp.
References air_soar_round_off_angle(), and RAD_TO_DEG.
Referenced by heading_to_point().
Definition at line 871 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, heading_to_point(), symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 932 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
int64_t convert | ( | double | flo | ) |
Definition at line 840 of file rhsfun_math.cpp.
Referenced by heading_to_point().
double convert_to_soar_angle | ( | double | heading_in_rads | ) |
Definition at line 789 of file rhsfun_math.cpp.
References PI, PI_OVER_TWO, and TWO_PI.
Referenced by hrl_xydof_to_heading().
Definition at line 334 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 1140 of file rhsfun_math.cpp.
References _dice_prob_atleast(), _dice_prob_exact(), _dice_zero_tolerance(), symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), sym_constant_struct::name, NIL, print_with_symbols(), cons_struct::rest, symbol_union::sc, SYM_CONSTANT_SYMBOL_TYPE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 238 of file rhsfun_math.cpp.
References cons_struct::first, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, and int_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 531 of file rhsfun_math.cpp.
References FALSE, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, IDENTIFIER_SYMBOL_TYPE, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, SYM_CONSTANT_SYMBOL_TYPE, symbol_add_ref(), symbol_to_string(), int_constant_struct::value, and VARIABLE_SYMBOL_TYPE.
Referenced by init_built_in_rhs_math_functions().
Definition at line 185 of file rhsfun_math.cpp.
References rhs_function_struct::f, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
int64_t heading_to_point | ( | int64_t | current_x, |
int64_t | current_y, | ||
int64_t | x, | ||
int64_t | y | ||
) |
Definition at line 845 of file rhsfun_math.cpp.
References bracket_rad_to_deg(), convert(), FALSE, hrl_xydof_to_heading(), vec2_norm(), and vector_from_to_position().
Referenced by compute_heading_rhs_function_code().
void hrl_xydof_to_heading | ( | double | xydof[3], |
double * | output | ||
) |
Definition at line 804 of file rhsfun_math.cpp.
References convert_to_soar_angle(), X, and Y.
Referenced by heading_to_point().
void init_built_in_rhs_math_functions | ( | agent * | thisAgent | ) |
Definition at line 1315 of file rhsfun_math.cpp.
References abs_rhs_function_code(), add_rhs_function(), atan2_rhs_function_code(), compute_heading_rhs_function_code(), compute_range_rhs_function_code(), cos_rhs_function_code(), dice_prob_rhs_function_code(), div_rhs_function_code(), FALSE, float_rhs_function_code(), fp_divide_rhs_function_code(), int_rhs_function_code(), make_sym_constant(), minus_rhs_function_code(), mod_rhs_function_code(), plus_rhs_function_code(), rand_float_rhs_function_code(), rand_int_rhs_function_code(), round_off_air_rhs_function_code(), round_off_heading_air_rhs_function_code(), sin_rhs_function_code(), sqrt_rhs_function_code(), times_rhs_function_code(), and TRUE.
Referenced by init_built_in_rhs_functions().
Definition at line 475 of file rhsfun_math.cpp.
References FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, IDENTIFIER_SYMBOL_TYPE, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, SYM_CONSTANT_SYMBOL_TYPE, symbol_add_ref(), symbol_to_string(), float_constant_struct::value, and VARIABLE_SYMBOL_TYPE.
Referenced by init_built_in_rhs_math_functions().
Definition at line 126 of file rhsfun_math.cpp.
References rhs_function_struct::f, FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, TRUE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 272 of file rhsfun_math.cpp.
References cons_struct::first, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print(), print_with_symbols(), cons_struct::rest, and int_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
double normalize_heading_float | ( | double | n | ) |
Definition at line 600 of file rhsfun_math.cpp.
Referenced by round_off_heading_air_rhs_function_code().
int64_t normalize_heading_int | ( | int64_t | n | ) |
Definition at line 585 of file rhsfun_math.cpp.
Referenced by round_off_heading_air_rhs_function_code().
Definition at line 42 of file rhsfun_math.cpp.
References rhs_function_struct::f, FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, print_with_symbols(), cons_struct::rest, TRUE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 997 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print_with_symbols(), SoarRand(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 1032 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_int_constant(), NIL, print_with_symbols(), SoarRandInt(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
void remove_built_in_rhs_math_functions | ( | agent * | thisAgent | ) |
Definition at line 1393 of file rhsfun_math.cpp.
References find_sym_constant(), and remove_rhs_function().
Referenced by remove_built_in_rhs_functions().
Definition at line 712 of file rhsfun_math.cpp.
References FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, print(), cons_struct::rest, round_off_heading_float(), round_off_heading_int(), TRUE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 656 of file rhsfun_math.cpp.
References FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, normalize_heading_float(), normalize_heading_int(), print(), cons_struct::rest, round_off_heading_float(), round_off_heading_int(), TRUE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
double round_off_heading_float | ( | double | n, |
double | m | ||
) |
Definition at line 627 of file rhsfun_math.cpp.
Referenced by round_off_air_rhs_function_code(), and round_off_heading_air_rhs_function_code().
int64_t round_off_heading_int | ( | int64_t | n, |
int64_t | m | ||
) |
Definition at line 614 of file rhsfun_math.cpp.
Referenced by round_off_air_rhs_function_code(), and round_off_heading_air_rhs_function_code().
Definition at line 305 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 362 of file rhsfun_math.cpp.
References symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), NIL, print(), print_with_symbols(), int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
Definition at line 83 of file rhsfun_math.cpp.
References rhs_function_struct::f, FALSE, symbol_union::fc, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, symbol_union::ic, INT_CONSTANT_SYMBOL_TYPE, make_float_constant(), make_int_constant(), NIL, print_with_symbols(), cons_struct::rest, TRUE, int_constant_struct::value, and float_constant_struct::value.
Referenced by init_built_in_rhs_math_functions().
void vec2_norm | ( | double | v[3], |
double | r[3], | ||
int | abort | ||
) |
Definition at line 775 of file rhsfun_math.cpp.
Referenced by heading_to_point().