math_utils.h
Go to the documentation of this file.
00001 #ifndef H_MATH_UTILS
00002 #define H_MATH_UTILS
00003 
00004 
00005 /* Sometimes I really don't understand compilers.. */ 
00006 #ifndef M_PI
00007 #define M_PI           3.14159265358979323846
00008 #endif
00009 
00010 #ifndef NAN
00011 #define NAN GSL_NAN
00012 #endif
00013      
00015 double norm_d(const double p[2]);
00016 
00017 double distance_d(const double a[2], const double b[2]);
00018 double distance_squared_d(const double a[2], const double b[2]);
00019 
00021 double angleDiff(double a, double b);
00022 double square(double x);
00023 
00025 double deg2rad(double deg);
00026 
00028 double rad2deg(double rad);
00029 
00030 
00031 int minmax(int from,int to,int x);
00032 
00034 void copy_d(const double*from, int n, double*to);
00035 
00037 void ominus_d(const double x[3], double res[3]);
00038 void oplus_d(const double x1[3], const double x2[3], double res[3]);
00039 void pose_diff_d(const double second[3], const double first[3], double res[3]);
00040         
00041         
00042 void transform_d(const double point2d[2], const double pose[3], double result2d[2]);
00043         
00046 void projection_on_line_d(
00047         const double a[2],
00048         const double b[2],
00049         const double p[2],
00050         double res[2],
00051         double *distance);
00052         
00054 void projection_on_segment_d(
00055         const double a[2],
00056         const double b[2],
00057         const double P[2],
00058    double proj[2]);
00059         
00061 double dist_to_segment_d(const double a[2], const double b[2], const double x[2]);
00062 
00064 double dist_to_segment_squared_d(const double a[2], const double b[2], const double x[2]);
00065 
00066 /* Executes ray tracing for a segment. p0 and p1 are the segments extrema, eye is the position
00067 of the eye, and direction is the direction of the ray coming out of the eye. Returns true
00068 if the ray intersects the segment, and in that case *range contains the length of the ray. */
00069 int segment_ray_tracing(const double p0[2], const double p1[2], const double eye[2], double direction, double*range);
00070 
00072 double segment_alpha(const double p0[2], const double p1[2]);
00073 
00075 const char* friendly_pose(const double*pose);
00076 
00078 int is_nan(double v);
00079 
00081 int any_nan(const double *d, int n);
00082 
00084 int count_equal(const int*v, int n, int value);
00085 
00087 double normalize_0_2PI(double angle);
00088 
00090 double max_in_array(const double*v, int n);
00091 
00092 #endif
00093 


csm
Author(s): Andrea Censi
autogenerated on Mon Jan 16 2017 03:48:29