math_utils.h
Go to the documentation of this file.
1 #ifndef H_MATH_UTILS
2 #define H_MATH_UTILS
3 
4 
5 /* Sometimes I really don't understand compilers.. */
6 #ifndef M_PI
7 #define M_PI 3.14159265358979323846
8 #endif
9 
10 #ifndef NAN
11 #define NAN GSL_NAN
12 #endif
13 
15 double norm_d(const double p[2]);
16 
17 double distance_d(const double a[2], const double b[2]);
18 double distance_squared_d(const double a[2], const double b[2]);
19 
21 double angleDiff(double a, double b);
22 double square(double x);
23 
25 double deg2rad(double deg);
26 
28 double rad2deg(double rad);
29 
30 
31 int minmax(int from,int to,int x);
32 
34 void copy_d(const double*from, int n, double*to);
35 
37 void ominus_d(const double x[3], double res[3]);
38 void oplus_d(const double x1[3], const double x2[3], double res[3]);
39 void pose_diff_d(const double second[3], const double first[3], double res[3]);
40 
41 
42 void transform_d(const double point2d[2], const double pose[3], double result2d[2]);
43 
47  const double a[2],
48  const double b[2],
49  const double p[2],
50  double res[2],
51  double *distance);
52 
55  const double a[2],
56  const double b[2],
57  const double P[2],
58  double proj[2]);
59 
61 double dist_to_segment_d(const double a[2], const double b[2], const double x[2]);
62 
64 double dist_to_segment_squared_d(const double a[2], const double b[2], const double x[2]);
65 
66 /* Executes ray tracing for a segment. p0 and p1 are the segments extrema, eye is the position
67 of the eye, and direction is the direction of the ray coming out of the eye. Returns true
68 if the ray intersects the segment, and in that case *range contains the length of the ray. */
69 int segment_ray_tracing(const double p0[2], const double p1[2], const double eye[2], double direction, double*range);
70 
72 double segment_alpha(const double p0[2], const double p1[2]);
73 
75 const char* friendly_pose(const double*pose);
76 
78 int is_nan(double v);
79 
81 int any_nan(const double *d, int n);
82 
84 int count_equal(const int*v, int n, int value);
85 
87 double normalize_0_2PI(double angle);
88 
90 double max_in_array(const double*v, int n);
91 
92 #endif
93 
double dist_to_segment_d(const double a[2], const double b[2], const double x[2])
Definition: math_utils.c:181
double angleDiff(double a, double b)
Definition: math_utils.c:128
int any_nan(const double *d, int n)
Definition: math_utils.c:64
double norm_d(const double p[2])
Definition: math_utils.c:71
int count_equal(const int *v, int n, int value)
Definition: math_utils.c:192
double dist_to_segment_squared_d(const double a[2], const double b[2], const double x[2])
Definition: math_utils.c:174
double deg2rad(double deg)
Definition: math_utils.c:75
const char * friendly_pose(const double *pose)
Definition: math_utils.c:266
void oplus_d(const double x1[3], const double x2[3], double res[3])
Definition: math_utils.c:96
double distance_d(const double a[2], const double b[2])
Definition: math_utils.c:55
double square(double x)
Definition: math_utils.c:124
double max_in_array(const double *v, int n)
Definition: math_utils.c:273
double distance_squared_d(const double a[2], const double b[2])
Definition: math_utils.c:48
double segment_alpha(const double p0[2], const double p1[2])
Definition: math_utils.c:257
void transform_d(const double point2d[2], const double pose[3], double result2d[2])
Definition: math_utils.c:108
struct @0 p
void copy_d(const double *from, int n, double *to)
Definition: math_utils.c:83
void projection_on_segment_d(const double a[2], const double b[2], const double P[2], double proj[2])
Definition: math_utils.c:156
int is_nan(double v)
Definition: math_utils.c:60
double rad2deg(double rad)
Definition: math_utils.c:79
double normalize_0_2PI(double angle)
Definition: math_utils.c:198
int segment_ray_tracing(const double p0[2], const double p1[2], const double eye[2], double direction, double *range)
Definition: math_utils.c:218
void ominus_d(const double x[3], double res[3])
Definition: math_utils.c:87
void pose_diff_d(const double second[3], const double first[3], double res[3])
Definition: math_utils.c:115
int minmax(int from, int to, int x)
Definition: math_utils.c:6
double distance(const gsl_vector *a, const gsl_vector *b)
void projection_on_line_d(const double a[2], const double b[2], const double p[2], double res[2], double *distance)
Definition: math_utils.c:135


csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23