Go to the documentation of this file.
41 return ((x < 0) ? -1.0 : 1.0);
46 return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
49 void polar(
double x,
double y,
double &r,
double &theta)
51 r = sqrt(x * x + y * y);
70 void fresnel_0_8(
double x,
double &S_f,
double &C_f)
74 double quarter_x = 0.25 * x;
75 double arg = 0.03125 * x * x - 1.0;
77 double T1 = 0.125 * x;
79 double T3 = quarter_x * T2 - T1;
80 double A = chebev_a[0] * T0 + chebev_a[1] * T2;
81 double B = chebev_b[0] * T1 + chebev_b[1] * T3;
85 for (
int n = 2; n < 17; n++)
87 double T2n = 2.0 * arg * T2n_m2 - T2n_m4;
88 double T2n_p1 = quarter_x * T2n - T2n_m1;
89 A += chebev_a[n] * T2n;
90 B += chebev_b[n] * T2n_p1;
95 double T34 = 2.0 * arg * T2n_m2 - T2n_m4;
96 A += chebev_a[17] * T34;
98 double sqrt_x = sqrt(x);
107 double arg = 128.0 / (x * x) - 1.0;
110 double E = chebev_e[0] * T0 + chebev_e[1] * T2;
111 double F = chebev_f[0] * T0 + chebev_f[1] * T2;
114 for (
int n = 2; n < 35; n++)
116 double T2n = 2.0 * arg * T2n_m2 - T2n_m4;
117 E += chebev_e[n] * T2n;
118 F += chebev_f[n] * T2n;
122 for (
int n = 35; n < 41; n++)
124 double T2n = 2.0 * arg * T2n_m2 - T2n_m4;
125 E += chebev_e[n] * T2n;
130 double sin_x = sin(x);
131 double cos_x = cos(x);
132 double sqrt_x = sqrt(x);
138 void fresnel(
double s,
double &S_f,
double &C_f)
154 double length,
double *x_f,
double *y_f,
double *theta_f,
double *kappa_f)
158 double sgn_sigma =
sgn(sigma);
159 double abs_sigma = fabs(sigma);
160 double sqrt_sigma_inv = 1 / sqrt(abs_sigma);
161 double k1 = theta_i - 0.5 *
direction * kappa_i * kappa_i / sigma;
162 double k2 =
SQRT_PI_INV * sqrt_sigma_inv * (abs_sigma *
length + sgn_sigma * kappa_i);
163 double k3 =
SQRT_PI_INV * sqrt_sigma_inv * sgn_sigma * kappa_i;
164 double cos_k1 = cos(k1);
165 double sin_k1 = sin(k1);
170 fresnel(k2, fresnel_s_k2, fresnel_c_k2);
171 fresnel(k3, fresnel_s_k3, fresnel_c_k3);
174 (
direction * cos_k1 * (fresnel_c_k2 - fresnel_c_k3) - sgn_sigma * sin_k1 * (fresnel_s_k2 - fresnel_s_k3));
177 (
direction * sin_k1 * (fresnel_c_k2 - fresnel_c_k3) + sgn_sigma * cos_k1 * (fresnel_s_k2 - fresnel_s_k3));
182 *kappa_f = kappa_i + sigma *
length;
186 double *x_f,
double *y_f,
double *theta_f)
200 void global_frame_change(
double x,
double y,
double theta,
double local_x,
double local_y,
double *global_x,
203 double sin_th = sin(theta);
204 double cos_th = cos(theta);
205 *global_x = local_x * cos_th - local_y * sin_th + x;
206 *global_y = local_x * sin_th + local_y * cos_th + y;
209 void local_frame_change(
double x,
double y,
double theta,
double global_x,
double global_y,
double *local_x,
212 double sin_th = sin(theta);
213 double cos_th = cos(theta);
214 *local_x = (global_x - x) * cos_th + (global_y - y) * sin_th;
215 *local_y = -(global_x - x) * sin_th + (global_y - y) * cos_th;
220 double min = array[0];
222 for (
int i = 1; i < size; i++)
235 for (
int i = 0; i < size; i++)
243 for (
int i = 0; i < size; i++)
double point_distance(double x1, double y1, double x2, double y2)
Cartesian distance between two points.
double pify(double alpha)
Conversion of arbitrary angle given in [rad] to [-pi, pi[.
void end_of_straight_line(double x_i, double y_i, double theta, double direction, double length, double *x_f, double *y_f)
Computation of the end point on a straight line x_i, y_i: initial configuration theta: angle of strai...
void fresnel(double s, double &S_f, double &C_f)
Fresnel integrals: S_f = int_0_s(sin(pi/2 u*u)du), C_f = int_0_s(cos(pi/2 u*u)du) approximated with C...
void global_frame_change(double x, double y, double theta, double local_x, double local_y, double *global_x, double *global_y)
Transformation of (local_x, local_y) from local coordinate system to global one.
void end_of_circular_arc(double x_i, double y_i, double theta_i, double kappa, double direction, double length, double *x_f, double *y_f, double *theta_f)
Computation of the end point on a circular arc x_i, y_i, theta_i: initial configuration kappa: curvat...
int direction(bool forward, bool order)
void pointer_array_init(void *array[], int size)
Initialize an array with nullptr.
void fresnel_8_inf(double x, double &S_f, double &C_f)
void local_frame_change(double x, double y, double theta, double global_x, double global_y, double *local_x, double *local_y)
Transformation of (global_x, global_y) from global coordinate system to local one.
int array_index_min(double array[], int size)
Find index with minimal value in double array.
void fresnel_0_8(double x, double &S_f, double &C_f)
void end_of_clothoid(double x_i, double y_i, double theta_i, double kappa_i, double sigma, double direction, double length, double *x_f, double *y_f, double *theta_f, double *kappa_f)
Computation of the end point on a clothoid x_i, y_i, theta_i, kappa_i: initial configuration sigma: s...
double get_epsilon()
Return value of epsilon.
void polar(double x, double y, double &r, double &theta)
Computation of a point's polar coordinates.
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
void double_array_init(double array[], int size, double value)
Initialize an array with a given value.
double sgn(double x)
Return sign of a number.
double twopify(double alpha)
Conversion of arbitrary angle given in [rad] to [0, 2*pi[.