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

Clothoids: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Clothoids/src/Clothoids/G2lib.hxx Source File
Clothoids
G2lib.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
29namespace G2lib {
30
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32
33 extern real_type const m_1_sqrt_pi;
34 extern real_type const machepsi;
35 extern real_type const machepsi10;
36 extern real_type const machepsi100;
37 extern real_type const machepsi1000;
38 extern real_type const sqrtMachepsi;
39 extern bool intersect_with_AABBtree;
40
41 extern integer const G2LIB_AABB_CUT;
42 extern integer const G2LIB_AABB_MIN_NODES;
43
44 // for CLOTHOIDS_BACK_COMPATIBILITY
45 extern bool use_ISO;
46
47 #endif
48
49 #ifdef CLOTHOIDS_BACK_COMPATIBILITY
50
51 static
52 inline
53 void
54 lib_use_ISO()
55 { use_ISO = true; }
56
57 static
58 inline
59 void
60 lib_use_SAE()
61 { use_ISO = false; }
62
63 #endif
64
68 static
69 inline
70 void
71 noAABBtree()
72 { intersect_with_AABBtree = false; }
73
77 static
78 inline
79 void
80 yesAABBtree()
81 { intersect_with_AABBtree = true; }
82
83 /*
84 * sin(x)/x
85 */
90
91 /*
92 * (1-cos(x))/x
93 */
98
99 /*
100 * atan(x)/x
101 */
106
110 void rangeSymm( real_type & ang );
111
112 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116 inline
117 void
119 real_type a,
120 real_type b,
121 real_type c,
122 real_type & vmin,
123 real_type & vmax
124 ) {
125 vmin = vmax = a;
126 if ( b < vmin ) vmin = b;
127 else vmax = b;
128 if ( c < vmin ) vmin = c;
129 else if ( c > vmax ) vmax = c;
130 }
131
132 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
148
151 real_type x0,
152 real_type y0,
153 real_type c0,
154 real_type s0,
155 real_type k,
156 real_type L,
157 real_type qx,
158 real_type qy
159 );
160
161 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
162
176
179 real_type x0,
180 real_type y0,
181 real_type theta0,
182 real_type k,
183 real_type qx,
184 real_type qy
185 );
186
187 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202 inline
203 bool
205 real_type x0,
206 real_type y0,
207 real_type c0,
208 real_type s0,
209 real_type k,
210 real_type qx,
211 real_type qy
212 ) {
213 real_type cx = x0 - s0/k;
214 real_type cy = y0 + c0/k;
215 real_type dst = hypot( qx - cx, qy - cy );
216 return dst*k <= 1;
217 }
218
219 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
220
221 integer
223 real_type A,
224 real_type B,
225 real_type C,
226 real_type a,
227 real_type b,
228 real_type c,
229 real_type x[],
230 real_type y[]
231 );
232
233 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
234
235 integer
237 real_type A,
238 real_type B,
239 real_type C,
240 real_type x[],
241 real_type y[]
242 );
243
244 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
245
246 integer
248 real_type x1,
249 real_type y1,
250 real_type theta1,
251 real_type kappa1,
252 real_type x2,
253 real_type y2,
254 real_type theta2,
255 real_type kappa2,
256 real_type s1[],
257 real_type s2[]
258 );
259
260 /*\
261 | ____ _ ____ ____
262 | / ___| ___ | |_ _____|___ \__ _|___ \
263 | \___ \ / _ \| \ \ / / _ \ __) \ \/ / __) |
264 | ___) | (_) | |\ V / __// __/ > < / __/
265 | |____/ \___/|_| \_/ \___|_____/_/\_\_____|
266 \*/
271 class Solve2x2 {
272 integer i[2], j[2];
273 real_type LU[2][2];
274 real_type epsi;
275 bool singular;
276
277 public:
278
279 Solve2x2() : epsi(1e-10) {}
280 bool factorize( real_type A[2][2] );
281 bool solve( real_type const b[2], real_type x[2] ) const;
282 };
283
307 integer
309 real_type const P1[],
310 real_type const P2[],
311 real_type const P3[]
312 );
313
326
327 integer
329 real_type const point[],
330 real_type const P1[],
331 real_type const P2[],
332 real_type const P3[]
333 );
334
335 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
336 /*\
337 | __ ____ __ _ _____ _ _
338 | \ \/ /\ \ / / | |_ ___ |_ _| |__ ___| |_ __ _
339 | \ / \ V / | __/ _ \ | | | '_ \ / _ \ __/ _` |
340 | / \ | | | || (_) | | | | | | | __/ || (_| |
341 | /_/\_\ |_| \__\___/ |_| |_| |_|\___|\__\__,_|
342 \*/
343 void
345 integer npts,
346 real_type const x[],
347 real_type const y[],
348 real_type theta[],
349 real_type theta_min[],
350 real_type theta_max[],
351 real_type omega[],
352 real_type len[]
353 );
354
355}
356
Definition G2lib.hxx:271
bool factorize(real_type A[2][2])
Definition G2lib.cc:570
Definition BBox.cc:42
real_type Sinc_DD(real_type x)
Definition G2lib.cc:93
real_type Sinc(real_type x)
Definition G2lib.cc:76
void xy_to_guess_angle(integer npts, real_type const x[], real_type const y[], real_type theta[], real_type theta_min[], real_type theta_max[], real_type omega[], real_type len[])
Definition G2lib.cc:495
integer intersectCircleCircle(real_type x1, real_type y1, real_type theta1, real_type kappa1, real_type x2, real_type y2, real_type theta2, real_type kappa2, real_type s1[], real_type s2[])
Definition G2lib.cc:409
real_type Atanc_DDD(real_type x)
Definition G2lib.cc:185
real_type Atanc_D(real_type x)
Definition G2lib.cc:165
real_type Sinc_DDD(real_type x)
Definition G2lib.cc:100
real_type Cosc_D(real_type x)
Definition G2lib.cc:122
real_type Sinc_D(real_type x)
Definition G2lib.cc:86
bool pointInsideCircle(real_type x0, real_type y0, real_type c0, real_type s0, real_type k, real_type qx, real_type qy)
Definition G2lib.hxx:204
integer solveLinearQuadratic2(real_type A, real_type B, real_type C, real_type x[], real_type y[])
Definition G2lib.cc:288
real_type projectPointOnCircle(real_type x0, real_type y0, real_type theta0, real_type k, real_type qx, real_type qy)
integer is_point_in_triangle(real_type const point[], real_type const P1[], real_type const P2[], real_type const P3[])
real_type Cosc(real_type x)
Definition G2lib.cc:112
real_type Atanc_DD(real_type x)
Definition G2lib.cc:175
real_type Atanc(real_type x)
Definition G2lib.cc:155
real_type Cosc_DD(real_type x)
Definition G2lib.cc:132
integer solveLinearQuadratic(real_type A, real_type B, real_type C, real_type a, real_type b, real_type c, real_type x[], real_type y[])
Definition G2lib.cc:230
real_type projectPointOnCircleArc(real_type x0, real_type y0, real_type c0, real_type s0, real_type k, real_type L, real_type qx, real_type qy)
integer is_counter_clockwise(real_type const P1[], real_type const P2[], real_type const P3[])
void minmax3(real_type a, real_type b, real_type c, real_type &vmin, real_type &vmax)
Definition G2lib.hxx:118
double real_type
real type number
Definition Clothoids.hh:79
real_type Cosc_DDD(real_type x)
Definition G2lib.cc:141
void rangeSymm(real_type &ang)
Definition G2lib.cc:59
int integer
integer type number
Definition Clothoids.hh:80