/Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Clothoids/src/Clothoids/Fresnel.hxx Source File

Clothoids: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Clothoids/src/Clothoids/Fresnel.hxx Source File
Clothoids
Fresnel.hxx
1/*--------------------------------------------------------------------------*\
2 | |
3 | Copyright (C) 2017 |
4 | |
5 | , __ , __ |
6 | /|/ \ /|/ \ |
7 | | __/ _ ,_ | __/ _ ,_ |
8 | | \|/ / | | | | \|/ / | | | |
9 | |(__/|__/ |_/ \_/|/|(__/|__/ |_/ \_/|/ |
10 | /| /| |
11 | \| \| |
12 | |
13 | Enrico Bertolazzi |
14 | Dipartimento di Ingegneria Industriale |
15 | Universita` degli Studi di Trento |
16 | email: enrico.bertolazzi@unitn.it |
17 | |
18\*--------------------------------------------------------------------------*/
19
23
24namespace G2lib {
25
26 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27
28 /*\
29 | _____ _
30 | | ___| __ ___ ___ _ __ ___| |
31 | | |_ | '__/ _ \/ __| '_ \ / _ \ |
32 | | _|| | | __/\__ \ | | | __/ |
33 | |_| |_| \___||___/_| |_|\___|_|
34 \*/
35 /*
36 * Compute Fresnel integrals
37 */
38 void
40 real_type x,
41 real_type & C,
42 real_type & S
43 );
44
58 void
60 integer nk,
61 real_type x,
62 real_type C[],
63 real_type S[]
64 );
65
81 void
83 integer nk,
84 real_type a,
85 real_type b,
86 real_type c,
87 real_type intC[],
88 real_type intS[]
89 );
90
105 void
107 real_type a,
108 real_type b,
109 real_type c,
110 real_type & intC,
111 real_type & intS
112 );
113
114 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115
116 #ifndef DOXYGEN_SHOULD_SKIP_THIS
117
121 class ClothoidData {
122 public:
123
124 real_type m_x0{0};
125 real_type m_y0{0};
126 real_type m_theta0{0};
127 real_type m_kappa0{0};
128 real_type m_dk{0};
129
130 ClothoidData() = default;
131
133 delta_theta( real_type s ) const
134 { return s*(m_kappa0 + 0.5*s*m_dk); }
135
136 real_type deltaTheta( real_type s ) const { return delta_theta( s ); }
137
142 theta( real_type s ) const
143 { return m_theta0 + s*(m_kappa0 + 0.5*s*m_dk); }
144
145 real_type theta_D ( real_type s ) const { return m_kappa0 + s*m_dk; }
146 real_type theta_DD ( real_type ) const { return m_dk; }
147 real_type theta_DDD( real_type ) const { return 0; }
148
152 real_type kappa ( real_type s ) const { return m_kappa0 + s*m_dk; }
153 real_type kappa_D ( real_type ) const { return m_dk; }
154 real_type kappa_DD ( real_type ) const { return 0; }
155 real_type kappa_DDD( real_type ) const { return 0; }
156
157 real_type X ( real_type s ) const;
158 real_type Y ( real_type s ) const;
159 real_type X_D ( real_type s ) const;
160 real_type Y_D ( real_type s ) const;
161 real_type X_DD ( real_type s ) const;
162 real_type Y_DD ( real_type s ) const;
163 real_type X_DDD( real_type s ) const;
164 real_type Y_DDD( real_type s ) const;
165
166 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
167 real_type X_ISO ( real_type s, real_type offs ) const;
168 real_type Y_ISO ( real_type s, real_type offs ) const;
169 real_type X_ISO_D ( real_type s, real_type offs ) const;
170 real_type Y_ISO_D ( real_type s, real_type offs ) const;
171 real_type X_ISO_DD ( real_type s, real_type offs ) const;
172 real_type Y_ISO_DD ( real_type s, real_type offs ) const;
173 real_type X_ISO_DDD( real_type s, real_type offs ) const;
174 real_type Y_ISO_DDD( real_type s, real_type offs ) const;
175
176 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
177
178 real_type X_SAE ( real_type s, real_type offs ) const;
179 real_type Y_SAE ( real_type s, real_type offs ) const;
180 real_type X_SAE_D ( real_type s, real_type offs ) const;
181 real_type Y_SAE_D ( real_type s, real_type offs ) const;
182 real_type X_SAE_DD ( real_type s, real_type offs ) const;
183 real_type Y_SAE_DD ( real_type s, real_type offs ) const;
184 real_type X_SAE_DDD( real_type s, real_type offs ) const;
185 real_type Y_SAE_DDD( real_type s, real_type offs ) const;
186
187 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
188
189 real_type tg0_x() const { return cos( m_theta0 ); }
190 real_type tg0_y() const { return sin( m_theta0 ); }
191
192 real_type tg_x( real_type s ) const { return cos(this->theta(s)); }
193 real_type tg_y( real_type s ) const { return sin(this->theta(s)); }
194
195 real_type tg_x_D( real_type s ) const;
196 real_type tg_y_D( real_type s ) const;
197
198 real_type tg_x_DD( real_type s ) const;
199 real_type tg_y_DD( real_type s ) const;
200
201 real_type tg_x_DDD( real_type s ) const;
202 real_type tg_y_DDD( real_type s ) const;
203
204 real_type nor0_x_ISO() const { return -this->tg0_y(); }
205 real_type nor0_y_ISO() const { return this->tg0_x(); }
206
207 real_type nor_x_ISO( real_type s ) const { return -this->tg_y(s); }
208 real_type nor_y_ISO( real_type s ) const { return this->tg_x(s); }
209
210 real_type nor_x_ISO_D( real_type s ) const { return -this->tg_y_D(s); }
211 real_type nor_y_ISO_D( real_type s ) const { return this->tg_x_D(s); }
212
213 real_type nor_x_ISO_DD( real_type s ) const { return -this->tg_y_DD(s); }
214 real_type nor_y_ISO_DD( real_type s ) const { return this->tg_x_DD(s); }
215
216 real_type nor_x_ISO_DDD( real_type s ) const { return -this->tg_y_DDD(s); }
217 real_type nor_y_ISO_DDD( real_type s ) const { return this->tg_x_DDD(s); }
218
219 real_type nor0_x_SAE() const { return this->tg0_y(); }
220 real_type nor0_y_SAE() const { return -this->tg0_x(); }
221
222 real_type nor_x_SAE( real_type s ) const { return this->tg_y(s); }
223 real_type nor_y_SAE( real_type s ) const { return -this->tg_x(s); }
224
225 real_type nor_x_SAE_D( real_type s ) const { return this->tg_y_D(s); }
226 real_type nor_y_SAE_D( real_type s ) const { return -this->tg_x_D(s); }
227
228 real_type nor_x_SAE_DD( real_type s ) const { return this->tg_y_DD(s); }
229 real_type nor_y_SAE_DD( real_type s ) const { return -this->tg_x_DD(s); }
230
231 real_type nor_x_SAE_DDD( real_type s ) const { return this->tg_y_DDD(s); }
232 real_type nor_y_SAE_DDD( real_type s ) const { return -this->tg_x_DDD(s); }
233
234 void tg( real_type s, real_type & tx, real_type & ty ) const;
235 void tg_D( real_type s, real_type & tx, real_type & ty ) const;
236 void tg_DD( real_type s, real_type & tx, real_type & ty ) const;
237 void tg_DDD( real_type s, real_type & tx, real_type & ty ) const;
238
239 void nor_ISO( real_type s, real_type & nx, real_type & ny ) const;
240 void nor_ISO_D( real_type s, real_type & nx_D, real_type & ny_D ) const;
241 void nor_ISO_DD( real_type s, real_type & nx_DD, real_type & ny_DD ) const;
242 void nor_ISO_DDD( real_type s, real_type & nx_DDD, real_type & ny_DDD ) const;
243
244 void nor_SAE( real_type s, real_type & nx, real_type & ny ) const;
245 void nor_SAE_D( real_type s, real_type & nx_D, real_type & ny_D ) const;
246 void nor_SAE_DD( real_type s, real_type & nx_DD, real_type & ny_DD ) const;
247 void nor_SAE_DDD( real_type s, real_type & nx_DDD, real_type & ny_DDD ) const;
248
249 void
250 evaluate(
251 real_type s,
252 real_type & theta,
253 real_type & kappa,
254 real_type & x,
255 real_type & y
256 ) const;
257
258 void
259 eval(
260 real_type s,
261 real_type & x,
262 real_type & y
263 ) const;
264
265 void
266 eval_D(
267 real_type s,
268 real_type & x_D,
269 real_type & y_D
270 ) const;
271
272 void
273 eval_DD(
274 real_type s,
275 real_type & x_DD,
276 real_type & y_DD
277 ) const;
278
279 void
280 eval_DDD(
281 real_type s,
282 real_type & x_DDD,
283 real_type & y_DDD
284 ) const;
285
286 void
287 eval_ISO(
288 real_type s,
289 real_type offs,
290 real_type & x,
291 real_type & y
292 ) const;
293
294 void
295 eval_ISO_D(
296 real_type s,
297 real_type offs,
298 real_type & x_D,
299 real_type & y_D
300 ) const;
301
302 void
303 eval_ISO_DD(
304 real_type s,
305 real_type offs,
306 real_type & x_DD,
307 real_type & y_DD
308 ) const;
309
310 void
311 eval_ISO_DDD(
312 real_type s,
313 real_type offs,
314 real_type & x_DDD,
315 real_type & y_DDD
316 ) const;
317
318 void
319 eval_SAE(
320 real_type s,
321 real_type offs,
322 real_type & x,
323 real_type & y
324 ) const {
325 this->eval_ISO( s, -offs, x, y );
326 }
327
328 void
329 eval_SAE_D(
330 real_type s,
331 real_type offs,
332 real_type & x_D,
333 real_type & y_D
334 ) const {
335 this->eval_ISO_D( s, -offs, x_D, y_D );
336 }
337
338 void
339 eval_DAE_DD(
340 real_type s,
341 real_type offs,
342 real_type & x_DD,
343 real_type & y_DD
344 ) const {
345 this->eval_ISO_DD( s, -offs, x_DD, y_DD );
346 }
347
348 void
349 eval_SAE_DDD(
350 real_type s,
351 real_type offs,
352 real_type & x_DDD,
353 real_type & y_DDD
354 ) const {
355 this->eval_ISO_DDD( s, -offs, x_DDD, y_DDD );
356 }
357
358 void
359 eval( real_type s, ClothoidData & C ) const;
360
361 real_type c0x() const { return m_x0 - (sin(m_theta0)/m_kappa0); }
362 real_type c0y() const { return m_y0 + (cos(m_theta0)/m_kappa0); }
363
364 void
365 Pinfinity( real_type & x, real_type & y, bool plus ) const;
366
367 void
368 reverse( real_type L );
369
370 void
371 reverse( real_type L, ClothoidData & out) const;
372
373 void
374 rotate( real_type angle, real_type cx, real_type cy );
375
376 void
377 origin_at( real_type s_origin );
378
380 split_at_flex( ClothoidData & C0, ClothoidData & C1 ) const;
381
383 aplus( real_type dtheta ) const;
384
385 bool
386 bbTriangle(
387 real_type L,
388 real_type & xx0, real_type & yy0,
389 real_type & xx1, real_type & yy1,
390 real_type & xx2, real_type & yy2
391 ) const;
392
393 bool
394 bbTriangle_ISO(
395 real_type L,
396 real_type offs,
397 real_type & xx0, real_type & yy0,
398 real_type & xx1, real_type & yy1,
399 real_type & xx2, real_type & yy2
400 ) const;
401
402 bool
403 bbTriangle_SAE(
404 real_type L,
405 real_type offs,
406 real_type & xx0, real_type & yy0,
407 real_type & xx1, real_type & yy1,
408 real_type & xx2, real_type & yy2
409 ) const {
410 return this->bbTriangle_ISO( L, -offs, xx0, yy0, xx1, yy1, xx2, yy2 );
411 }
412
413 int
414 build_G1(
415 real_type x0,
416 real_type y0,
417 real_type theta0,
418 real_type x1,
419 real_type y1,
420 real_type theta1,
421 real_type tol,
422 real_type & L,
423 bool compute_deriv = false,
424 real_type L_D[2] = nullptr,
425 real_type k_D[2] = nullptr,
426 real_type dk_D[2] = nullptr
427 );
428
429 bool
430 build_forward(
431 real_type x0,
432 real_type y0,
433 real_type theta0,
434 real_type kappa0,
435 real_type x1,
436 real_type y1,
437 real_type tol,
438 real_type & L
439 );
440
441 void
442 info( ostream_type & s ) const;
443
444 };
445
446 #endif
447
448}
449
Definition BBox.cc:42
void GeneralizedFresnelCS(integer nk, real_type a, real_type b, real_type c, real_type intC[], real_type intS[])
Definition Fresnel.cc:601
double real_type
real type number
Definition Clothoids.hh:79
void FresnelCS(real_type x, real_type &C, real_type &S)
Definition Fresnel.cc:187
int integer
integer type number
Definition Clothoids.hh:80