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

Clothoids: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Clothoids/src/Clothoids/ClothoidList.hxx Source File
Clothoids
ClothoidList.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 using std::vector;
27
28 /*\
29 | ____ ____ _ ____
30 | / ___|___ \ ___ ___ | |_ _____|___ \ __ _ _ __ ___
31 | | | _ __) / __|/ _ \| \ \ / / _ \ __) / _` | '__/ __|
32 | | |_| |/ __/\__ \ (_) | |\ V / __// __/ (_| | | | (__
33 | \____|_____|___/\___/|_| \_/ \___|_____\__,_|_| \___|
34 \*/
35
36
75
76 real_type m_tolerance{real_type(1e-10)};
77 integer m_max_iter{20};
78
79 real_type m_x0{real_type(0)};
80 real_type m_y0{real_type(0)};
81 real_type m_theta0{real_type(0)};
82 real_type m_kappa0{real_type(0)};
83
84 real_type m_x1{real_type(0)};
85 real_type m_y1{real_type(0)};
86 real_type m_theta1{real_type(0)};
87 real_type m_kappa1{real_type(0)};
88
89 // standard problem
90 real_type m_lambda{real_type(0)};
91 real_type m_phi{real_type(0)};
92 real_type m_xbar{real_type(0)};
93 real_type m_ybar{real_type(0)};
94 real_type m_th0{real_type(0)};
95 real_type m_th1{real_type(0)};
96 real_type m_k0{real_type(0)};
97 real_type m_k1{real_type(0)};
98 real_type m_DeltaK{real_type(0)};
99 real_type m_DeltaTheta{real_type(0)};
100
101 ClothoidCurve m_S0{"G2solve2arc_S0"};
102 ClothoidCurve m_S1{"G2solve2arc_S1"};
103
104 void
105 evalA(
106 real_type alpha,
107 real_type L,
108 real_type & A
109 ) const;
110
111 void
112 evalA(
113 real_type alpha,
114 real_type L,
115 real_type & A,
116 real_type & A_1,
117 real_type & A_2
118 ) const;
119
120 void
121 evalG(
122 real_type alpha,
123 real_type L,
124 real_type th,
125 real_type k,
126 real_type G[2]
127 ) const;
128
129 void
130 evalG(
131 real_type alpha,
132 real_type L,
133 real_type th,
134 real_type k,
135 real_type G[2],
136 real_type G_1[2],
137 real_type G_2[2]
138 ) const;
139
140 void evalF( real_type const vars[2], real_type F[2] ) const;
141
142 void
143 evalFJ(
144 real_type const vars[2],
145 real_type F[2],
146 real_type J[2][2]
147 ) const;
148
149 void build_solution( real_type alpha, real_type L );
150
151 public:
152
156 G2solve2arc() = default;
157
158 ~G2solve2arc() = default;
159
160 //void setup( GenericContainer const & gc );
161
183 int
184 build(
185 real_type x0, real_type y0, real_type theta0, real_type kappa0,
186 real_type x1, real_type y1, real_type theta1, real_type kappa1
187 );
188
192 void set_tolerance( real_type tol );
193
197 void set_max_iter( integer miter );
198
204 int solve();
205
209 ClothoidCurve const & S0() const { return m_S0; }
210
214 ClothoidCurve const & S1() const { return m_S1; }
215
216 #ifdef CLOTHOIDS_BACK_COMPATIBILITY
217 void setTolerance( real_type tol ) { set_tolerance( tol ); }
218 void setMaxIter( integer miter ) { set_max_iter( miter ); }
219 #endif
220
221 };
222
223 /*\
224 | ____ ____ _ ____ _ ____
225 | / ___|___ \ ___ ___ | |_ _____ / ___| | / ___|
226 | | | _ __) / __|/ _ \| \ \ / / _ \ | | | | |
227 | | |_| |/ __/\__ \ (_) | |\ V / __/ |___| |__| |___
228 | \____|_____|___/\___/|_| \_/ \___|\____|_____\____|
229 \*/
230
268
269 real_type m_tolerance{real_type(1e-10)};
270 int m_max_iter{20};
271
272 real_type m_x0{real_type(0)};
273 real_type m_y0{real_type(0)};
274 real_type m_theta0{real_type(0)};
275 real_type m_kappa0{real_type(0)};
276 real_type m_x1{real_type(0)};
277 real_type m_y1{real_type(0)};
278 real_type m_theta1{real_type(0)};
279 real_type m_kappa1{real_type(0)};
280
281 // standard problem
282 real_type m_lambda{real_type(0)};
283 real_type m_phi{real_type(0)};
284 real_type m_xbar{real_type(0)};
285 real_type m_ybar{real_type(0)};
286 real_type m_th0{real_type(0)};
287 real_type m_th1{real_type(0)};
288 real_type m_k0{real_type(0)};
289 real_type m_k1{real_type(0)};
290
291 ClothoidCurve m_S0{"G2solveCLC_S0"};
292 ClothoidCurve m_SM{"G2solveCLC_SM"};
293 ClothoidCurve m_S1{"G2solveCLC_S1"};
294
295 bool build_solution( real_type sM, real_type thM );
296
297 public:
298
302 G2solveCLC() = default;
303
304 ~G2solveCLC() = default;
305
306 //void setup( GenericContainer const & gc );
307
329 int
330 build(
331 real_type x0, real_type y0, real_type theta0, real_type kappa0,
332 real_type x1, real_type y1, real_type theta1, real_type kappa1
333 );
334
338 void set_tolerance( real_type tol );
339
343 void set_max_iter( integer miter );
344
350 int solve();
351
355 ClothoidCurve const & S0() const { return m_S0; }
356
360 ClothoidCurve const & SM() const { return m_SM; }
361
365 ClothoidCurve const & S1() const { return m_S1; }
366
367 void save( ostream_type & stream ) const;
368
369 #ifdef CLOTHOIDS_BACK_COMPATIBILITY
370 void setTolerance( real_type tol ) { set_tolerance( tol ); }
371 void setMaxIter( integer miter ) { set_max_iter( miter ); }
372 #endif
373
374 };
375
376 /*\
377 | ____ ____ _ _____
378 | / ___|___ \ ___ ___ | |_ _____|___ / __ _ _ __ ___
379 | | | _ __) / __|/ _ \| \ \ / / _ \ |_ \ / _` | '__/ __|
380 | | |_| |/ __/\__ \ (_) | |\ V / __/___) | (_| | | | (__
381 | \____|_____|___/\___/|_| \_/ \___|____/ \__,_|_| \___|
382 \*/
383
428
429 ClothoidCurve m_S0{"G2solve3arc_S0"};
430 ClothoidCurve m_SM{"G2solve3arc_SM"};
431 ClothoidCurve m_S1{"G2solve3arc_S1"};
432
433 real_type m_tolerance{real_type(1e-10)};
434 int m_max_iter{100};
435
436 // \f$ G^2 \f$ interpolation data
437 real_type m_x0{real_type(0)};
438 real_type m_y0{real_type(0)};
439 real_type m_theta0{real_type(0)};
440 real_type m_kappa0{real_type(0)};
441 real_type m_x1{real_type(0)};
442 real_type m_y1{real_type(0)};
443 real_type m_theta1{real_type(0)};
444 real_type m_kappa1{real_type(0)};
445
446 // standard scaled problem
447 real_type m_phi{real_type(0)};
448 real_type m_Lscale{real_type(0)};
449 real_type m_th0{real_type(0)};
450 real_type m_th1{real_type(0)};
451 real_type m_s0{real_type(0)};
452 real_type m_s1{real_type(0)};
453
454 // precomputed values
455 real_type m_K0{real_type(0)},
456 m_K1{real_type(0)},
457 m_c0{real_type(0)},
458 m_c1{real_type(0)},
459 m_c2{real_type(0)},
460 m_c3{real_type(0)},
461 m_c4{real_type(0)},
462 m_c5{real_type(0)},
463 m_c6{real_type(0)},
464 m_c7{real_type(0)},
465 m_c8{real_type(0)},
466 m_c9{real_type(0)},
467 m_c10{real_type(0)},
468 m_c11{real_type(0)},
469 m_c12{real_type(0)},
470 m_c13{real_type(0)},
471 m_c14{real_type(0)};
472
473 void
474 evalFJ(
475 real_type const vars[2],
476 real_type F[2],
477 real_type J[2][2]
478 ) const;
479
480 void evalF( real_type const vars[2], real_type F[2] ) const;
481
482 void build_solution( real_type sM, real_type thM );
483
484 int solve( real_type sM_guess, real_type thM_guess );
485
486 public:
487
488 G2solve3arc() = default;
489
490 ~G2solve3arc() = default;
491
492 //void setup( GenericContainer const & gc );
493
497 void set_tolerance( real_type tol );
498
502 void set_max_iter( integer miter );
503
520 int
521 build(
522 real_type x0,
523 real_type y0,
524 real_type theta0,
525 real_type kappa0,
526 real_type x1,
527 real_type y1,
528 real_type theta1,
529 real_type kappa1,
530 real_type Dmax = 0,
531 real_type dmax = 0
532 );
533
550 int
552 real_type s0,
553 real_type x0,
554 real_type y0,
555 real_type theta0,
556 real_type kappa0,
557 real_type s1,
558 real_type x1,
559 real_type y1,
560 real_type theta1,
561 real_type kappa1
562 );
563
567 ClothoidCurve const & S0() const { return m_S0; }
568
572 ClothoidCurve const & S1() const { return m_S1; }
573
577 ClothoidCurve const & SM() const { return m_SM; }
578
583 total_length() const {
584 return m_S0.length() +
585 m_S1.length() +
586 m_SM.length();
587 }
588
589
595 return m_S0.theta_total_variation() +
596 m_S1.theta_total_variation() +
598 }
599
609
615 return m_S0.integral_curvature2() +
616 m_S1.integral_curvature2() +
617 m_SM.integral_curvature2();
618 }
619
625 return m_S0.integral_jerk2() +
626 m_S1.integral_jerk2() +
627 m_SM.integral_jerk2();
628 }
629
635 return m_S0.integral_snap2() +
636 m_S1.integral_snap2() +
637 m_SM.integral_snap2();
638 }
639
646 theta_min_max( real_type & thMin, real_type & thMax ) const;
647
653 { real_type thMin, thMax; return theta_min_max( thMin, thMax ); }
654
660 real_type curvature_min_max( real_type & kMin, real_type & kMax ) const;
661
665 real_type theta( real_type s ) const;
666
670 real_type theta_D( real_type s ) const;
671
675 real_type theta_DD( real_type s ) const;
676
680 real_type theta_DDD( real_type s ) const;
681
685 real_type X( real_type s ) const;
686
690 real_type Y( real_type s ) const;
691
695 real_type x_begin() const { return m_S0.x_begin(); }
696
700 real_type y_begin() const { return m_S0.y_begin(); }
701
705 real_type kappa_begin() const { return m_S0.kappa_begin(); }
706
710 real_type theta_begin() const { return m_S0.theta_begin(); }
711
715 real_type x_end()const { return m_S1.x_end(); }
716
720 real_type y_end() const { return m_S1.y_end(); }
721
725 real_type kappa_end() const { return m_S1.kappa_end(); }
726
730 real_type theta_end() const { return m_S1.theta_end(); }
731
741 void
742 eval(
743 real_type s,
745 real_type & kappa,
746 real_type & x,
747 real_type & y
748 ) const;
749
753 void eval( real_type s, real_type & x, real_type & y ) const;
754
758 void eval_D( real_type s, real_type & x_D, real_type & y_D ) const;
759
763 void eval_DD( real_type s, real_type & x_DD, real_type & y_DD ) const;
764
768 void eval_DDD( real_type s, real_type & x_DDD, real_type & y_DDD ) const;
769
773 void eval_ISO( real_type s, real_type offs, real_type & x, real_type & y ) const;
774
778 void eval_ISO_D( real_type s, real_type offs, real_type & x_D, real_type & y_D ) const;
779
783 void eval_ISO_DD( real_type s, real_type offs, real_type & x_DD, real_type & y_DD ) const;
784
788 void eval_ISO_DDD( real_type s, real_type offs, real_type & x_DDD, real_type & y_DDD ) const;
789
797 void
799 m_S0.rotate( angle, cx, cy );
800 m_S1.rotate( angle, cx, cy );
801 m_SM.rotate( angle, cx, cy );
802 }
803
807 void
809 m_S0.translate( tx, ty );
810 m_S1.translate( tx, ty );
811 m_SM.translate( tx, ty );
812 }
813
817 void
819 ClothoidCurve tmp(m_S0); m_S1 = m_S0; m_S0 = tmp;
820 m_S0.reverse();
821 m_S1.reverse();
822 m_SM.reverse();
823 }
824
825 friend
827 operator << ( ostream_type & stream, ClothoidCurve const & c );
828
830 void save( ostream_type & stream ) const;
831
832 // BACK COMPATIBILITY
833 #ifdef CLOTHOIDS_BACK_COMPATIBILITY
834 void setTolerance( real_type tol ) { set_tolerance( tol ); }
835 void setMaxIter( integer miter ) { set_max_iter( miter ); }
836 real_type thetaTotalVariation() const { return theta_total_variation(); }
837 real_type thetaMinMax( real_type & thMin, real_type & thMax ) const { return theta_min_max(thMin,thMax); }
838 real_type totalLength() const { return total_length(); }
839 real_type integralCurvature2() const { return integral_curvature2(); }
840 real_type integralJerk2() const { return integral_jerk2(); }
841 real_type integralSnap2() const { return integral_snap2(); }
842 real_type deltaTheta() const { return delta_theta(); }
843 #endif
844
845 };
846
847 /*\
848 | ____ _ _ _ _ _ _ _ _
849 | / ___| | ___ | |_| |__ ___ (_) __| | | (_)___| |_
850 | | | | |/ _ \| __| '_ \ / _ \| |/ _` | | | / __| __|
851 | | |___| | (_) | |_| | | | (_) | | (_| | |___| \__ \ |_
852 | \____|_|\___/ \__|_| |_|\___/|_|\__,_|_____|_|___/\__|
853 |
854 \*/
861 class ClothoidList : public BaseCurve {
862
863 bool m_curve_is_closed{false};
864 vector<real_type> m_s0;
865 vector<ClothoidCurve> m_clothoid_list;
866
867 #ifdef CLOTHOIDS_USE_THREADS
868 mutable Utils::BinarySearch<integer> m_last_interval;
869 #else
870 mutable integer m_last_interval{0};
871 #endif
872
873 mutable bool m_aabb_done{false};
874 mutable AABB_TREE m_aabb_tree;
875 mutable real_type m_aabb_offs{real_type(0)};
876 mutable real_type m_aabb_max_angle{real_type(0)};
877 mutable real_type m_aabb_max_size{real_type(0)};
878 mutable vector<Triangle2D> m_aabb_triangles;
879
880 #ifdef CLOTHOIDS_USE_THREADS
881 mutable std::mutex m_aabb_mutex;
882 #endif
883
884 void
885 reset_last_interval() {
886 #ifdef CLOTHOIDS_USE_THREADS
887 bool ok;
888 integer & last_interval = *m_last_interval.search( std::this_thread::get_id(), ok );
889 #else
890 integer & last_interval = m_last_interval;
891 #endif
892 last_interval = 0;
893 }
894
895 integer
896 closest_point_internal(
897 real_type qx,
898 real_type qy,
899 real_type offs,
900 real_type & x,
901 real_type & y,
902 real_type & s,
903 real_type & DST
904 ) const;
905
906 public:
907
908 #include "BaseCurve_using.hxx"
909
910 ClothoidList() = delete;
911
915 ClothoidList( string const & name ) : BaseCurve( name )
916 { this->reset_last_interval(); }
917
918 ~ClothoidList() override {
919 m_s0.clear();
920 m_clothoid_list.clear();
921 m_aabb_triangles.clear();
922 }
923
924 void setup( GenericContainer const & gc ) override;
925
929 ClothoidList( ClothoidList const & s ) : BaseCurve( s.name() )
930 { this->reset_last_interval(); this->copy(s); }
931
932 CurveType type() const override { return CurveType::CLOTHOID_LIST; }
933
937 void init();
938
942 void reserve( integer n );
943
947 void copy( ClothoidList const & L );
948
953 { this->copy(s); return *this; }
954
958 explicit ClothoidList( LineSegment const & LS );
959
963 explicit ClothoidList( CircleArc const & C );
964
968 explicit ClothoidList( Biarc const & B );
969
973 explicit ClothoidList( BiarcList const & BL );
974
978 explicit ClothoidList( ClothoidCurve const & CL );
979
983 explicit ClothoidList( PolyLine const & PL );
984
988 explicit ClothoidList( G2solve2arc const & C, string const & name );
989
993 explicit ClothoidList( G2solve3arc const & C, string const & name );
994
998 explicit ClothoidList( G2solveCLC const & C, string const & name );
999
1003 explicit ClothoidList( BaseCurve const * pC );
1004
1005 void build( LineSegment const & );
1006 void build( CircleArc const & );
1007 void build( ClothoidCurve const & );
1008 void build( Biarc const & );
1009 void build( PolyLine const & );
1010 void build( BiarcList const & );
1011 void build( ClothoidList const & );
1012 void build( G2solve2arc const & );
1013 void build( G2solve3arc const & );
1014 void build( G2solveCLC const & );
1015 void build( Dubins const & );
1016 void build( Dubins3p const & );
1017
1021 void push_back( LineSegment const & c );
1022
1026 void push_back( CircleArc const & c );
1027
1031 void push_back( Biarc const & c );
1032
1036 void push_back( BiarcList const & c );
1037
1041 void push_back( ClothoidCurve const & c );
1042
1046 void push_back( ClothoidList const & c );
1047
1051 void push_back( Dubins const & c );
1052
1056 void push_back( Dubins3p const & c );
1057
1061 void push_back( G2solve2arc const & c );
1062
1066 void push_back( G2solve3arc const & c );
1067
1071 void push_back( G2solveCLC const & c );
1072
1076 void push_back( PolyLine const & c );
1077
1085 void
1086 push_back(
1087 real_type kappa0,
1088 real_type dkappa,
1089 real_type L
1090 );
1091
1103 void
1104 push_back(
1105 real_type x0,
1106 real_type y0,
1107 real_type theta0,
1108 real_type kappa0,
1109 real_type dkappa,
1110 real_type L
1111 );
1112
1121 void
1123 real_type x1,
1124 real_type y1,
1125 real_type theta1
1126 );
1127
1140 void
1142 real_type x0,
1143 real_type y0,
1144 real_type theta0,
1145 real_type x1,
1146 real_type y1,
1147 real_type theta1
1148 );
1149
1153 bool is_closed() const { return m_curve_is_closed; }
1154
1158 void make_closed() { m_curve_is_closed = true; }
1159
1163 void make_open() { m_curve_is_closed = false; }
1164
1168 real_type closure_gap_x() const { return this->x_end() - this->x_begin(); }
1169
1173 real_type closure_gap_y() const { return this->y_end() - this->y_begin(); }
1174
1178 real_type closure_gap_tx() const { return this->tx_end() - this->tx_begin(); }
1179
1183 real_type closure_gap_ty() const { return this->ty_end() - this->ty_begin(); }
1184
1193 bool
1194 closure_check( real_type tol_xy = 1e-6, real_type tol_tg = 1e-6 ) const {
1195 return std::abs(closure_gap_x()) < tol_xy &&
1196 std::abs(closure_gap_y()) < tol_xy &&
1197 std::abs(closure_gap_tx()) < tol_tg &&
1198 std::abs(closure_gap_ty()) < tol_tg;
1199 }
1200
1212 bool
1213 build_G1(
1214 integer n,
1215 real_type const x[],
1216 real_type const y[]
1217 );
1218
1230 bool
1231 build_G1(
1232 integer n,
1233 real_type const x[],
1234 real_type const y[],
1235 real_type const theta[]
1236 );
1237
1252 bool
1253 build(
1254 real_type x0,
1255 real_type y0,
1256 real_type theta0,
1257 integer n,
1258 real_type const s[],
1259 real_type const kappa[]
1260 );
1261
1275 bool
1277 real_type x0,
1278 real_type y0,
1279 real_type theta0,
1280 vector<real_type> const & s,
1281 vector<real_type> const & kappa
1282 ) {
1283 if ( s.size() != kappa.size() ) return false;
1284 return build(
1285 x0, y0, theta0,
1286 integer(s.size()),
1287 &s.front(), &kappa.front()
1288 );
1289 }
1290
1303 bool
1304 build_raw(
1305 integer n,
1306 real_type const x[],
1307 real_type const y[],
1308 real_type const abscissa[],
1309 real_type const theta[],
1310 real_type const kappa[]
1311 );
1312
1324 bool
1326 vector<real_type> const & x,
1327 vector<real_type> const & y,
1328 vector<real_type> const & abscissa,
1329 vector<real_type> const & theta,
1330 vector<real_type> const & kappa
1331 ) {
1332 integer n = integer(x.size());
1333 if ( n != integer(y.size()) ||
1334 n != integer(abscissa.size()) ||
1335 n != integer(theta.size()) ||
1336 n != integer(kappa.size()) ) return false;
1337 return build_raw(
1338 n, &x.front(), &y.front(),
1339 &abscissa.front(), &theta.front(), &kappa.front()
1340 );
1341 }
1342
1346 ClothoidCurve const & get( integer idx ) const;
1347
1351 ClothoidCurve const & get_at_s( real_type s ) const;
1352
1356 integer num_segments() const { return integer(m_clothoid_list.size()); }
1357
1363 void wrap_in_range( real_type & s ) const;
1364
1368 integer find_at_s( real_type & s ) const;
1369
1370 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1371
1372 real_type length() const override;
1373 real_type length_ISO( real_type offs ) const override;
1374
1378 real_type
1379 segment_length( integer nseg ) const;
1380
1384 real_type
1385 segment_length_ISO( integer nseg, real_type offs ) const;
1386
1390 real_type
1392 { return segment_length_ISO( nseg, -offs ); }
1393
1394 /*\
1395 | _ _ _____ _ _
1396 | | |__| |_|_ _| _(_)__ _ _ _ __ _| |___
1397 | | '_ \ '_ \| || '_| / _` | ' \/ _` | / -_)
1398 | |_.__/_.__/|_||_| |_\__,_|_||_\__, |_\___|
1399 | |___/
1400 \*/
1401
1402 void
1404 vector<Triangle2D> & tvec,
1405 real_type max_angle = Utils::m_pi/6, // 30 degree
1406 real_type max_size = 1e100,
1407 integer icurve = 0
1408 ) const override;
1409
1410 void
1412 real_type offs,
1413 vector<Triangle2D> & tvec,
1414 real_type max_angle = Utils::m_pi/6, // 30 degree
1415 real_type max_size = 1e100,
1416 integer icurve = 0
1417 ) const override;
1418
1419 void
1421 real_type offs,
1422 vector<Triangle2D> & tvec,
1423 real_type max_angle = Utils::m_pi/6, // 30 degree
1424 real_type max_size = 1e100,
1425 integer icurve = 0
1426 ) const override {
1427 this->bb_triangles_ISO( -offs, tvec, max_angle, max_size, icurve );
1428 }
1429
1430 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1431 void
1432 build_AABBtree_ISO(
1433 real_type offs,
1434 real_type max_angle = Utils::m_pi/6, // 30 degree
1435 real_type max_size = 1e100
1436 ) const;
1437 #endif
1438
1439 /*\
1440 | _ _
1441 | | |__ | |__ _____ __
1442 | | '_ \| '_ \ / _ \ \/ /
1443 | | |_) | |_) | (_) > <
1444 | |_.__/|_.__/ \___/_/\_\
1445 \*/
1446
1447 void
1449 real_type & xmin,
1450 real_type & ymin,
1451 real_type & xmax,
1452 real_type & ymax
1453 ) const override {
1454 bbox_ISO( 0, xmin, ymin, xmax, ymax );
1455 }
1456
1457 void
1458 bbox_ISO(
1459 real_type offs,
1460 real_type & xmin,
1461 real_type & ymin,
1462 real_type & xmax,
1463 real_type & ymax
1464 ) const override;
1465
1466 /*\
1467 | ____ _ _______ _
1468 | | __ ) ___ __ _(_)_ __ / / ____|_ __ __| |
1469 | | _ \ / _ \/ _` | | '_ \ / /| _| | '_ \ / _` |
1470 | | |_) | __/ (_| | | | | |/ / | |___| | | | (_| |
1471 | |____/ \___|\__, |_|_| |_/_/ |_____|_| |_|\__,_|
1472 | |___/
1473 \*/
1474
1475 real_type
1476 theta_begin() const override
1477 { return m_clothoid_list.front().theta_begin(); }
1478
1479 real_type
1480 theta_end() const override
1481 { return m_clothoid_list.back().theta_end(); }
1482
1483 real_type
1484 x_begin() const override
1485 { return m_clothoid_list.front().x_begin(); }
1486
1487 real_type
1488 y_begin() const override
1489 { return m_clothoid_list.front().y_begin(); }
1490
1491 real_type
1492 x_end() const override
1493 { return m_clothoid_list.back().x_end(); }
1494
1495 real_type
1496 y_end() const override
1497 { return m_clothoid_list.back().y_end(); }
1498
1499 real_type
1500 x_begin_ISO( real_type offs ) const override
1501 { return m_clothoid_list.front().x_begin_ISO( offs ); }
1502
1503 real_type
1504 y_begin_ISO( real_type offs ) const override
1505 { return m_clothoid_list.front().y_begin_ISO( offs ); }
1506
1507 real_type
1508 x_end_ISO( real_type offs ) const override
1509 { return m_clothoid_list.back().x_end_ISO( offs ); }
1510
1511 real_type
1512 y_end_ISO( real_type offs ) const override
1513 { return m_clothoid_list.back().y_end_ISO( offs ); }
1514
1515 real_type
1516 tx_begin() const override
1517 { return m_clothoid_list.front().tx_begin(); }
1518
1519 real_type
1520 ty_begin() const override
1521 { return m_clothoid_list.front().ty_begin(); }
1522
1523 real_type
1524 tx_end() const override
1525 { return m_clothoid_list.back().tx_end(); }
1526
1527 real_type
1528 ty_end() const override
1529 { return m_clothoid_list.back().ty_end(); }
1530
1531 real_type
1532 nx_begin_ISO() const override
1533 { return m_clothoid_list.front().nx_begin_ISO(); }
1534
1535 real_type
1536 ny_begin_ISO() const override
1537 { return m_clothoid_list.front().ny_begin_ISO(); }
1538
1539 real_type
1540 nx_end_ISO() const override
1541 { return m_clothoid_list.back().nx_end_ISO(); }
1542
1543 real_type
1544 ny_end_ISO() const override
1545 { return m_clothoid_list.back().ny_end_ISO(); }
1546
1547 /*\
1548 | _ _ _
1549 | | |_| |__ ___| |_ __ _
1550 | | __| '_ \ / _ \ __/ _` |
1551 | | |_| | | | __/ || (_| |
1552 | \__|_| |_|\___|\__\__,_|
1553 \*/
1554
1555 real_type theta ( real_type s ) const override;
1556 real_type theta_D ( real_type s ) const override;
1557 real_type theta_DD ( real_type s ) const override;
1558 real_type theta_DDD( real_type s ) const override;
1559
1560 /*\
1561 | _____ _ _ _
1562 | |_ _| __ _ _ __ __| | | \ | |
1563 | | | / _` | '_ \ / _` | | \| |
1564 | | | | (_| | | | | (_| | | |\ |
1565 | |_| \__,_|_| |_|\__,_| |_| \_|
1566 \*/
1567
1568 real_type tx ( real_type s ) const override;
1569 real_type ty ( real_type s ) const override;
1570 real_type tx_D ( real_type s ) const override;
1571 real_type ty_D ( real_type s ) const override;
1572 real_type tx_DD ( real_type s ) const override;
1573 real_type ty_DD ( real_type s ) const override;
1574 real_type tx_DDD( real_type s ) const override;
1575 real_type ty_DDD( real_type s ) const override;
1576
1577 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1578
1579 void
1580 tg(
1581 real_type s,
1582 real_type & tg_x,
1583 real_type & tg_y
1584 ) const override;
1585
1586 void
1587 tg_D(
1588 real_type s,
1589 real_type & tg_x_D,
1590 real_type & tg_y_D
1591 ) const override;
1592
1593 void
1594 tg_DD(
1595 real_type s,
1596 real_type & tg_x_DD,
1597 real_type & tg_y_DD
1598 ) const override;
1599
1600 void
1601 tg_DDD(
1602 real_type s,
1603 real_type & tg_x_DDD,
1604 real_type & tg_y_DDD
1605 ) const override;
1606
1607 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1608
1609 void
1610 evaluate(
1611 real_type s,
1612 real_type & th,
1613 real_type & k,
1614 real_type & x,
1615 real_type & y
1616 ) const override;
1617
1618 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1619
1620 void
1622 real_type s,
1623 real_type offs,
1624 real_type & th,
1625 real_type & k,
1626 real_type & x,
1627 real_type & y
1628 ) const override;
1629
1630 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1631
1632 real_type X ( real_type s ) const override;
1633 real_type Y ( real_type s ) const override;
1634 real_type X_D ( real_type s ) const override;
1635 real_type Y_D ( real_type s ) const override;
1636 real_type X_DD ( real_type s ) const override;
1637 real_type Y_DD ( real_type s ) const override;
1638 real_type X_DDD( real_type s ) const override;
1639 real_type Y_DDD( real_type s ) const override;
1640
1641 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1642
1643 void
1644 eval(
1645 real_type s,
1646 real_type & x,
1647 real_type & y
1648 ) const override;
1649
1650 void
1651 eval_D(
1652 real_type s,
1653 real_type & x_D,
1654 real_type & y_D
1655 ) const override;
1656
1657 void
1658 eval_DD(
1659 real_type s,
1660 real_type & x_DD,
1661 real_type & y_DD
1662 ) const override;
1663
1664 void
1665 eval_DDD(
1666 real_type s,
1667 real_type & x_DDD,
1668 real_type & y_DDD
1669 ) const override;
1670
1671 /*\
1672 | __ __ _
1673 | ___ / _|/ _|___ ___| |_
1674 | / _ \| |_| |_/ __|/ _ \ __|
1675 | | (_) | _| _\__ \ __/ |_
1676 | \___/|_| |_| |___/\___|\__|
1677 \*/
1678
1679 real_type X_ISO ( real_type s, real_type offs ) const override;
1680 real_type Y_ISO ( real_type s, real_type offs ) const override;
1681 real_type X_ISO_D ( real_type s, real_type offs ) const override;
1682 real_type Y_ISO_D ( real_type s, real_type offs ) const override;
1683 real_type X_ISO_DD ( real_type s, real_type offs ) const override;
1684 real_type Y_ISO_DD ( real_type s, real_type offs ) const override;
1685 real_type X_ISO_DDD( real_type s, real_type offs ) const override;
1686 real_type Y_ISO_DDD( real_type s, real_type offs ) const override;
1687
1688 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1689
1690 void
1691 eval_ISO(
1692 real_type s,
1693 real_type offs,
1694 real_type & x,
1695 real_type & y
1696 ) const override;
1697
1698 void
1699 eval_ISO_D(
1700 real_type s,
1701 real_type offs,
1702 real_type & x_D,
1703 real_type & y_D
1704 ) const override;
1705
1706 void
1708 real_type s,
1709 real_type offs,
1710 real_type & x_DD,
1711 real_type & y_DD
1712 ) const override;
1713
1714 void
1716 real_type s,
1717 real_type offs,
1718 real_type & x_DDD,
1719 real_type & y_DDD
1720 ) const override;
1721
1722 /*\
1723 | _ __
1724 | | |_ _ __ __ _ _ __ ___ / _| ___ _ __ _ __ ___
1725 | | __| '__/ _` | '_ \/ __| |_ / _ \| '__| '_ ` _ \
1726 | | |_| | | (_| | | | \__ \ _| (_) | | | | | | | |
1727 | \__|_| \__,_|_| |_|___/_| \___/|_| |_| |_| |_|
1728 \*/
1729
1730 void translate( real_type tx, real_type ty ) override;
1731 void rotate( real_type angle, real_type cx, real_type cy ) override;
1732 void scale( real_type sc ) override;
1733 void reverse() override;
1734 void change_origin( real_type newx0, real_type newy0 ) override;
1735 void trim( real_type s_begin, real_type s_end ) override;
1736 void trim( real_type s_begin, real_type s_end, ClothoidList & newCL ) const;
1737
1738 /*\
1739 | _ _ _
1740 | __| (_)___| |_ __ _ _ __ ___ ___
1741 | / _` | / __| __/ _` | '_ \ / __/ _ \
1742 | | (_| | \__ \ || (_| | | | | (_| __/
1743 | \__,_|_|___/\__\__,_|_| |_|\___\___|
1744 \*/
1745
1757 integer
1759 real_type qx,
1760 real_type qy,
1761 real_type & x,
1762 real_type & y,
1763 real_type & s,
1764 real_type & t,
1765 real_type & dst
1766 ) const override;
1767
1780 integer
1782 real_type qx,
1783 real_type qy,
1784 real_type offs,
1785 real_type & x,
1786 real_type & y,
1787 real_type & s,
1788 real_type & t,
1789 real_type & dst
1790 ) const override;
1791
1804 real_type
1806 real_type ds,
1807 real_type qx,
1808 real_type qy,
1809 real_type & X,
1810 real_type & Y,
1811 real_type & S
1812 ) const;
1813
1814 /*\
1815 | _ _ _
1816 | __| (_)___| |_ __ _ _ __ ___ ___
1817 | / _` | / __| __/ _` | '_ \ / __/ _ \
1818 | | (_| | \__ \ || (_| | | | | (_| __/
1819 | \__,_|_|___/\__\__,_|_| |_|\___\___|
1820 \*/
1821
1827 integer
1828 closest_segment( real_type qx, real_type qy ) const;
1829
1845 integer
1847 real_type qx,
1848 real_type qy,
1849 integer icurve_begin,
1850 integer icurve_end,
1851 real_type & x,
1852 real_type & y,
1853 real_type & s,
1854 real_type & t,
1855 real_type & dst,
1856 integer & icurve
1857 ) const;
1858
1874 integer
1876 real_type qx,
1877 real_type qy,
1878 integer icurve_begin,
1879 integer icurve_end,
1880 real_type & x,
1881 real_type & y,
1882 real_type & s,
1883 real_type & t,
1884 real_type & dst,
1885 integer & icurve
1886 ) const {
1888 qx, qy, icurve_begin, icurve_end, x, y, s, t, dst, icurve
1889 );
1890 t = -t;
1891 return res;
1892 }
1893
1908 integer
1910 real_type qx,
1911 real_type qy,
1912 real_type s_begin,
1913 real_type s_end,
1914 real_type & x,
1915 real_type & y,
1916 real_type & s,
1917 real_type & t,
1918 real_type & dst,
1919 integer & icurve
1920 ) const;
1921
1936 integer
1938 real_type qx,
1939 real_type qy,
1940 real_type s_begin,
1941 real_type s_end,
1942 real_type & x,
1943 real_type & y,
1944 real_type & s,
1945 real_type & t,
1946 real_type & dst,
1947 integer & icurve
1948 ) const {
1950 qx, qy, s_begin, s_end, x, y, s, t, dst, icurve
1951 );
1952 t = -t;
1953 return res;
1954 }
1955
1956 string info() const;
1957
1958 void
1959 info( ostream_type & stream ) const override
1960 { stream << this->info(); }
1961
1962 friend
1963 ostream_type &
1964 operator << ( ostream_type & stream, ClothoidList const & CL );
1965
1972 void
1973 get_SK( real_type s[], real_type kappa[] ) const;
1974
1981 void
1983 vector<real_type> & s,
1984 vector<real_type> & kappa
1985 ) const {
1986 s.resize( m_clothoid_list.size()+1 );
1987 kappa.resize( m_clothoid_list.size()+1 );
1988 get_SK( &s.front(), &kappa.front() );
1989 }
1990
1998 void
1999 get_STK(
2000 real_type s[],
2001 real_type theta[],
2003 ) const;
2004
2012 void
2014 vector<real_type> & s,
2015 vector<real_type> & theta,
2016 vector<real_type> & kappa
2017 ) const {
2018 s.resize( m_clothoid_list.size()+1 );
2019 theta.resize( m_clothoid_list.size()+1 );
2020 kappa.resize( m_clothoid_list.size()+1 );
2021 get_STK( &s.front(), &theta.front(), &kappa.front() );
2022 }
2023
2030 void
2031 get_XY( real_type x[], real_type y[] ) const;
2032
2033 void
2034 get_delta_theta( real_type delta_theta[] ) const;
2035
2036 void
2037 get_delta_kappa( real_type deltaKappa[] ) const;
2038
2049 integer
2050 findST1(
2051 real_type x,
2052 real_type y,
2053 real_type & s,
2054 real_type & t
2055 ) const;
2056
2069 integer
2070 findST1(
2071 integer ibegin,
2072 integer iend,
2073 real_type x,
2074 real_type y,
2075 real_type & s,
2076 real_type & t
2077 ) const;
2078
2079 /*\
2080 | _ _ _ _
2081 | ___ ___ | | (_)___(_) ___ _ __
2082 | / __/ _ \| | | / __| |/ _ \| '_ \
2083 | | (_| (_) | | | \__ \ | (_) | | | |
2084 | \___\___/|_|_|_|___/_|\___/|_| |_|
2085 \*/
2086
2090 bool
2091 collision( ClothoidList const & CL ) const {
2092 return collision_ISO( 0, CL, 0 );
2093 }
2094
2102 bool
2104 real_type offs,
2105 ClothoidList const & CL,
2106 real_type offs_C
2107 ) const;
2108
2109 bool
2110 collision( BaseCurve const * pC ) const override;
2111
2112 bool
2114 real_type offs,
2115 BaseCurve const * pC,
2116 real_type offs_C
2117 ) const override;
2118
2119 /*\
2120 | _ _ _
2121 | (_)_ __ | |_ ___ _ __ ___ ___ ___| |_
2122 | | | '_ \| __/ _ \ '__/ __|/ _ \/ __| __|
2123 | | | | | | || __/ | \__ \ __/ (__| |_
2124 | |_|_| |_|\__\___|_| |___/\___|\___|\__|
2125 \*/
2126
2133 void
2135 ClothoidList const & CL,
2136 IntersectList & ilist
2137 ) const {
2138 this->intersect_ISO( 0, CL, 0, ilist );
2139 }
2140
2149 void
2151 real_type offs,
2152 ClothoidList const & CL,
2153 real_type offs_obj,
2154 IntersectList & ilist
2155 ) const;
2156
2157 void
2158 intersect(
2159 BaseCurve const * pC,
2160 IntersectList & ilist
2161 ) const override;
2162
2163 void
2165 real_type offs,
2166 BaseCurve const * pC,
2167 real_type offs_LS,
2168 IntersectList & ilist
2169 ) const override;
2170
2176 void
2177 export_table( ostream_type & stream ) const;
2178
2184 void
2185 export_ruby( ostream_type & stream ) const;
2186
2197 void save( ostream_type & stream ) const;
2198
2209 void load( istream_type & stream, real_type epsi = 1e-8 );
2210
2211#ifdef CLOTHOIDS_BACK_COMPATIBILITY
2212#include "ClothoidList_compatibility.hxx"
2213#endif
2214
2215 };
2216
2217 /*\
2218 |
2219 | ___ _ _ _ _ _ ___ _ _ ___ ___
2220 | / __| |___| |_| |_ ___(_)__| / __|_ __| (_)_ _ ___ / __|_ )
2221 | | (__| / _ \ _| ' \/ _ \ / _` \__ \ '_ \ | | ' \/ -_) (_ |/ /
2222 | \___|_\___/\__|_||_\___/_\__,_|___/ .__/_|_|_||_\___|\___/___|
2223 | |_|
2224 \*/
2225
2230 public:
2234 using TargetType = enum class TargetType : integer
2235 { P1, P2, P3, P4, P5, P6, P7, P8, P9 };
2236
2243 static
2244 inline
2245 string
2247 string res{""};
2248 switch ( n ) {
2249 case TargetType::P1: res = "P1"; break;
2250 case TargetType::P2: res = "P2"; break;
2251 case TargetType::P3: res = "P3"; break;
2252 case TargetType::P4: res = "P4"; break;
2253 case TargetType::P5: res = "P5"; break;
2254 case TargetType::P6: res = "P6"; break;
2255 case TargetType::P7: res = "P7"; break;
2256 case TargetType::P8: res = "P8"; break;
2257 case TargetType::P9: res = "P9"; break;
2258 }
2259 return res;
2260 };
2261
2262 private:
2263
2264 Utils::Malloc<real_type> real_values{"ClothoidSplineG2"};
2265
2266 real_type * m_x{nullptr};
2267 real_type * m_y{nullptr};
2268 TargetType m_tt{TargetType::P1};
2269 real_type m_theta_I{real_type(0)};
2270 real_type m_theta_F{real_type(0)};
2271 integer m_npts{0};
2272
2273 // work vector
2274 mutable real_type * m_k{nullptr};
2275 mutable real_type * m_dk{nullptr};
2276 mutable real_type * m_L{nullptr};
2277 mutable real_type * m_kL{nullptr};
2278 mutable real_type * m_L_1{nullptr};
2279 mutable real_type * m_L_2{nullptr};
2280 mutable real_type * m_k_1{nullptr};
2281 mutable real_type * m_k_2{nullptr};
2282 mutable real_type * m_dk_1{nullptr};
2283 mutable real_type * m_dk_2{nullptr};
2284
2285 real_type
2286 diff2pi( real_type in ) const {
2287 return in-Utils::m_2pi*round(in/Utils::m_2pi);
2288 }
2289
2290 public:
2291
2292 ClothoidSplineG2() = default;
2293 ~ClothoidSplineG2() = default;
2294
2295 void
2296 setP1( real_type theta0, real_type thetaN ) {
2297 m_tt = TargetType::P1;
2298 m_theta_I = theta0;
2299 m_theta_F = thetaN;
2300 }
2301
2302 void setP2() { m_tt = TargetType::P2; }
2303 void setP3() { m_tt = TargetType::P3; }
2304 void setP4() { m_tt = TargetType::P4; }
2305 void setP5() { m_tt = TargetType::P5; }
2306 void setP6() { m_tt = TargetType::P6; }
2307 void setP7() { m_tt = TargetType::P7; }
2308 void setP8() { m_tt = TargetType::P8; }
2309 void setP9() { m_tt = TargetType::P9; }
2310
2311 void
2312 build(
2313 real_type const xvec[],
2314 real_type const yvec[],
2315 integer npts
2316 );
2317
2318 integer numPnts() const { return m_npts; }
2319 integer numTheta() const;
2320 integer numConstraints() const;
2321
2322 void
2323 guess(
2324 real_type theta_guess[],
2325 real_type theta_min[],
2326 real_type theta_max[]
2327 ) const;
2328
2329 bool
2330 objective( real_type const theta[], real_type & f ) const;
2331
2332 bool
2333 gradient( real_type const theta[], real_type g[] ) const;
2334
2335 bool
2336 constraints( real_type const theta[], real_type c[] ) const;
2337
2338 integer
2339 jacobian_nnz() const;
2340
2341 bool
2342 jacobian_pattern( integer i[], integer j[] ) const;
2343
2344 bool
2345 jacobian_pattern_matlab( real_type i[], real_type j[] ) const;
2346
2347 bool
2348 jacobian( real_type const theta[], real_type vals[] ) const;
2349
2350 string info() const;
2351
2352 void
2353 info( ostream_type & stream ) const
2354 { stream << this->info(); }
2355
2356 friend
2357 ostream_type &
2358 operator << ( ostream_type & stream, ClothoidSplineG2 const & c );
2359
2360 };
2361
2362}
2363
Definition BaseCurve.hxx:192
real_type kappa(real_type s) const
Definition BaseCurve.hxx:560
virtual real_type kappa_end() const
Definition BaseCurve.hxx:398
Definition Biarc.hxx:39
Definition BiarcList.hxx:42
Definition Circle.hxx:37
Definition Clothoid.hxx:48
virtual real_type theta_end() const
Definition BaseCurve.hxx:388
real_type integral_snap2() const
Definition Clothoid.cc:1209
real_type kappa_begin() const override
Definition Clothoid.hxx:643
real_type y_end() const override
Definition Clothoid.hxx:647
void translate(real_type tx, real_type ty) override
translate curve by
Definition Clothoid.hxx:898
real_type theta_begin() const override
Definition Clothoid.hxx:642
real_type x_begin() const override
Definition Clothoid.hxx:644
real_type integral_curvature2() const
Definition Clothoid.cc:1187
real_type y_begin() const override
Definition Clothoid.hxx:646
real_type curvature_total_variation() const
Definition Clothoid.cc:1176
real_type length() const override
Definition Clothoid.hxx:638
real_type integral_jerk2() const
Definition Clothoid.cc:1195
void rotate(real_type angle, real_type cx, real_type cy) override
Definition Clothoid.hxx:902
void reverse() override
Definition Clothoid.hxx:913
real_type theta_total_variation() const
Definition Clothoid.cc:1121
real_type x_end() const override
Definition Clothoid.hxx:645
Definition ClothoidList.hxx:861
real_type ty_D(real_type s) const override
Definition ClothoidList.cc:931
void get_STK(vector< real_type > &s, vector< real_type > &theta, vector< real_type > &kappa) const
Definition ClothoidList.hxx:2013
void bbox_ISO(real_type offs, real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const override
Definition ClothoidList.cc:824
real_type theta(real_type s) const override
Definition ClothoidList.cc:862
real_type closure_gap_ty() const
Definition ClothoidList.hxx:1183
real_type ny_begin_ISO() const override
Definition ClothoidList.hxx:1536
CurveType type() const override
Definition ClothoidList.hxx:932
friend ostream_type & operator<<(ostream_type &stream, ClothoidList const &CL)
Definition ClothoidList.cc:2428
real_type theta_DD(real_type s) const override
Definition ClothoidList.cc:880
integer findST1(real_type x, real_type y, real_type &s, real_type &t) const
Definition ClothoidList.cc:2307
void make_closed()
Definition ClothoidList.hxx:1158
real_type X_ISO(real_type s, real_type offs) const override
Definition ClothoidList.cc:1189
real_type Y_ISO_DDD(real_type s, real_type offs) const override
Definition ClothoidList.cc:1252
bool build_G1(integer n, real_type const x[], real_type const y[])
Definition ClothoidList.cc:578
real_type X(real_type s) const override
Definition ClothoidList.cc:1059
bool build_raw(integer n, real_type const x[], real_type const y[], real_type const abscissa[], real_type const theta[], real_type const kappa[])
Definition ClothoidList.cc:698
bool collision(ClothoidList const &CL) const
Definition ClothoidList.hxx:2091
real_type length() const override
Definition ClothoidList.cc:756
real_type Y_D(real_type s) const override
Definition ClothoidList.cc:1086
real_type Y_DDD(real_type s) const override
Definition ClothoidList.cc:1122
real_type X_ISO_DD(real_type s, real_type offs) const override
Definition ClothoidList.cc:1225
real_type theta_D(real_type s) const override
Definition ClothoidList.cc:871
real_type x_begin() const override
Definition ClothoidList.hxx:1484
void init()
Definition ClothoidList.cc:286
integer closest_point_in_s_range_ISO(real_type qx, real_type qy, real_type s_begin, real_type s_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, integer &icurve) const
Definition ClothoidList.cc:2087
real_type x_end_ISO(real_type offs) const override
Definition ClothoidList.hxx:1508
integer find_at_s(real_type &s) const
Definition ClothoidList.cc:254
real_type closure_gap_tx() const
Definition ClothoidList.hxx:1178
void evaluate(real_type s, real_type &th, real_type &k, real_type &x, real_type &y) const override
Definition ClothoidList.cc:1028
real_type closure_gap_y() const
Definition ClothoidList.hxx:1173
void export_table(ostream_type &stream) const
Definition ClothoidList.cc:2387
void tg_DD(real_type s, real_type &tg_x_DD, real_type &tg_y_DD) const override
Definition ClothoidList.cc:1002
void scale(real_type sc) override
Definition ClothoidList.cc:1337
real_type tx_D(real_type s) const override
Definition ClothoidList.cc:922
integer closest_point_in_range_SAE(real_type qx, real_type qy, integer icurve_begin, integer icurve_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, integer &icurve) const
Definition ClothoidList.hxx:1875
void eval_ISO_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const override
Definition ClothoidList.cc:1303
real_type X_ISO_DDD(real_type s, real_type offs) const override
Definition ClothoidList.cc:1243
real_type Y_ISO_D(real_type s, real_type offs) const override
Definition ClothoidList.cc:1216
real_type ty_DDD(real_type s) const override
Definition ClothoidList.cc:967
void make_open()
Definition ClothoidList.hxx:1163
void export_ruby(ostream_type &stream) const
Definition ClothoidList.cc:2404
void intersect(ClothoidList const &CL, IntersectList &ilist) const
Definition ClothoidList.hxx:2134
void push_back(LineSegment const &c)
Definition ClothoidList.cc:319
void tg_D(real_type s, real_type &tg_x_D, real_type &tg_y_D) const override
Definition ClothoidList.cc:989
void evaluate_ISO(real_type s, real_type offs, real_type &th, real_type &k, real_type &x, real_type &y) const override
Definition ClothoidList.cc:1043
real_type X_ISO_D(real_type s, real_type offs) const override
Definition ClothoidList.cc:1207
bool build(real_type x0, real_type y0, real_type theta0, vector< real_type > const &s, vector< real_type > const &kappa)
Definition ClothoidList.hxx:1276
void eval_ISO(real_type s, real_type offs, real_type &x, real_type &y) const override
Definition ClothoidList.cc:1261
real_type length_ISO(real_type offs) const override
Definition ClothoidList.cc:762
ClothoidList(ClothoidList const &s)
Definition ClothoidList.hxx:929
void save(ostream_type &stream) const
Definition ClothoidList.cc:2500
real_type segment_length_SAE(integer nseg, real_type offs) const
Definition ClothoidList.hxx:1391
void tg(real_type s, real_type &tg_x, real_type &tg_y) const override
Definition ClothoidList.cc:976
integer closest_point_in_range_ISO(real_type qx, real_type qy, integer icurve_begin, integer icurve_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, integer &icurve) const
Definition ClothoidList.cc:2011
real_type y_end_ISO(real_type offs) const override
Definition ClothoidList.hxx:1512
void reserve(integer n)
Definition ClothoidList.cc:311
real_type Y_ISO(real_type s, real_type offs) const override
Definition ClothoidList.cc:1198
ClothoidCurve const & get_at_s(real_type s) const
Definition ClothoidList.cc:741
real_type nx_begin_ISO() const override
Definition ClothoidList.hxx:1532
real_type tx_end() const override
Definition ClothoidList.hxx:1524
real_type nx_end_ISO() const override
Definition ClothoidList.hxx:1540
bool is_closed() const
Definition ClothoidList.hxx:1153
void push_back_G1(real_type x1, real_type y1, real_type theta1)
Definition ClothoidList.cc:545
void bb_triangles(vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/6, real_type max_size=1e100, integer icurve=0) const override
Definition ClothoidList.cc:789
real_type Y(real_type s) const override
Definition ClothoidList.cc:1068
void tg_DDD(real_type s, real_type &tg_x_DDD, real_type &tg_y_DDD) const override
Definition ClothoidList.cc:1015
void eval_D(real_type s, real_type &x_D, real_type &y_D) const override
Definition ClothoidList.cc:1144
integer closest_point_ISO(real_type qx, real_type qy, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const override
Definition ClothoidList.cc:1910
void rotate(real_type angle, real_type cx, real_type cy) override
Definition ClothoidList.cc:1330
real_type ty_DD(real_type s) const override
Definition ClothoidList.cc:949
void get_SK(vector< real_type > &s, vector< real_type > &kappa) const
Definition ClothoidList.hxx:1982
void bb_triangles_ISO(real_type offs, vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/6, real_type max_size=1e100, integer icurve=0) const override
Definition ClothoidList.cc:803
real_type closure_gap_x() const
Definition ClothoidList.hxx:1168
real_type ty_begin() const override
Definition ClothoidList.hxx:1520
real_type X_DD(real_type s) const override
Definition ClothoidList.cc:1095
real_type Y_DD(real_type s) const override
Definition ClothoidList.cc:1104
void eval(real_type s, real_type &x, real_type &y) const override
Definition ClothoidList.cc:1131
real_type X_D(real_type s) const override
Definition ClothoidList.cc:1077
ClothoidCurve const & get(integer idx) const
Definition ClothoidList.cc:725
real_type ny_end_ISO() const override
Definition ClothoidList.hxx:1544
real_type closest_point_by_sample(real_type ds, real_type qx, real_type qy, real_type &X, real_type &Y, real_type &S) const
Definition ClothoidList.cc:2189
void translate(real_type tx, real_type ty) override
translate curve by
Definition ClothoidList.cc:1323
real_type ty_end() const override
Definition ClothoidList.hxx:1528
real_type y_end() const override
Definition ClothoidList.hxx:1496
real_type theta_end() const override
Definition ClothoidList.hxx:1480
ClothoidList(string const &name)
Definition ClothoidList.hxx:915
void get_SK(real_type s[], real_type kappa[]) const
Definition ClothoidList.cc:2219
void get_XY(real_type x[], real_type y[]) const
Definition ClothoidList.cc:2266
real_type segment_length(integer nseg) const
Definition ClothoidList.cc:769
real_type tx_begin() const override
Definition ClothoidList.hxx:1516
void intersect_ISO(real_type offs, ClothoidList const &CL, real_type offs_obj, IntersectList &ilist) const
Definition ClothoidList.cc:1637
void wrap_in_range(real_type &s) const
Definition ClothoidList.cc:271
integer num_segments() const
Definition ClothoidList.hxx:1356
real_type Y_ISO_DD(real_type s, real_type offs) const override
Definition ClothoidList.cc:1234
void load(istream_type &stream, real_type epsi=1e-8)
Definition ClothoidList.cc:2513
real_type x_begin_ISO(real_type offs) const override
Definition ClothoidList.hxx:1500
real_type y_begin() const override
Definition ClothoidList.hxx:1488
bool closure_check(real_type tol_xy=1e-6, real_type tol_tg=1e-6) const
Definition ClothoidList.hxx:1194
void get_STK(real_type s[], real_type theta[], real_type kappa[]) const
Definition ClothoidList.cc:2241
real_type y_begin_ISO(real_type offs) const override
Definition ClothoidList.hxx:1504
integer closest_segment(real_type qx, real_type qy) const
Definition ClothoidList.cc:1931
bool build_raw(vector< real_type > const &x, vector< real_type > const &y, vector< real_type > const &abscissa, vector< real_type > const &theta, vector< real_type > const &kappa)
Definition ClothoidList.hxx:1325
void eval_ISO_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const override
Definition ClothoidList.cc:1289
void info(ostream_type &stream) const override
Definition ClothoidList.hxx:1959
real_type segment_length_ISO(integer nseg, real_type offs) const
Definition ClothoidList.cc:775
void eval_ISO_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const override
Definition ClothoidList.cc:1275
real_type theta_DDD(real_type s) const override
Definition ClothoidList.cc:889
void bb_triangles_SAE(real_type offs, vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/6, real_type max_size=1e100, integer icurve=0) const override
Definition ClothoidList.hxx:1420
real_type tx_DDD(real_type s) const override
Definition ClothoidList.cc:958
void trim(real_type s_begin, real_type s_end) override
Definition ClothoidList.cc:1386
real_type x_end() const override
Definition ClothoidList.hxx:1492
real_type X_DDD(real_type s) const override
Definition ClothoidList.cc:1113
bool collision_ISO(real_type offs, ClothoidList const &CL, real_type offs_C) const
Definition ClothoidList.cc:1563
real_type tx_DD(real_type s) const override
Definition ClothoidList.cc:940
void change_origin(real_type newx0, real_type newy0) override
Definition ClothoidList.cc:1375
void bbox(real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const override
Definition ClothoidList.hxx:1448
void eval_DDD(real_type s, real_type &x_DDD, real_type &y_DDD) const override
Definition ClothoidList.cc:1170
void reverse() override
Definition ClothoidList.cc:1354
ClothoidList const & operator=(ClothoidList const &s)
Definition ClothoidList.hxx:952
void eval_DD(real_type s, real_type &x_DD, real_type &y_DD) const override
Definition ClothoidList.cc:1157
real_type ty(real_type s) const override
Definition ClothoidList.cc:913
integer closest_point_in_s_range_SAE(real_type qx, real_type qy, real_type s_begin, real_type s_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, integer &icurve) const
Definition ClothoidList.hxx:1937
real_type tx(real_type s) const override
Definition ClothoidList.cc:904
real_type theta_begin() const override
Definition ClothoidList.hxx:1476
void copy(ClothoidList const &L)
Definition ClothoidList.cc:298
Definition ClothoidList.hxx:2229
enum class TargetType :integer { P1, P2, P3, P4, P5, P6, P7, P8, P9 } TargetType
Definition ClothoidList.hxx:2234
static string to_string(TargetType n)
Definition ClothoidList.hxx:2246
friend ostream_type & operator<<(ostream_type &stream, ClothoidSplineG2 const &c)
Definition ClothoidG2.cc:1678
Definition Dubins3p.hxx:78
Definition Dubins.hxx:74
Definition ClothoidList.hxx:74
ClothoidCurve const & S0() const
Definition ClothoidList.hxx:209
G2solve2arc()=default
void set_max_iter(integer miter)
Definition ClothoidG2.cc:132
ClothoidCurve const & S1() const
Definition ClothoidList.hxx:214
int solve()
Definition ClothoidG2.cc:260
int build(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type x1, real_type y1, real_type theta1, real_type kappa1)
Definition ClothoidG2.cc:73
void set_tolerance(real_type tol)
Definition ClothoidG2.cc:121
Definition ClothoidList.hxx:427
real_type x_end() const
Definition ClothoidList.hxx:715
void translate(real_type tx, real_type ty)
Definition ClothoidList.hxx:808
void eval_ISO_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const
Definition ClothoidG2.cc:1163
void rotate(real_type angle, real_type cx, real_type cy)
Definition ClothoidList.hxx:798
void set_tolerance(real_type tol)
Definition ClothoidG2.cc:487
real_type theta_begin() const
Definition ClothoidList.hxx:710
real_type curvature_total_variation() const
Definition ClothoidList.hxx:604
void eval_ISO_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const
Definition ClothoidG2.cc:1141
real_type X(real_type s) const
Definition ClothoidG2.cc:989
void eval_DD(real_type s, real_type &x_DD, real_type &y_DD) const
Definition ClothoidG2.cc:1076
real_type theta_total_variation() const
Definition ClothoidList.hxx:594
ClothoidCurve const & S1() const
Definition ClothoidList.hxx:572
real_type y_begin() const
Definition ClothoidList.hxx:700
int build(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type x1, real_type y1, real_type theta1, real_type kappa1, real_type Dmax=0, real_type dmax=0)
Definition ClothoidG2.cc:509
real_type Y(real_type s) const
Definition ClothoidG2.cc:1000
void eval_ISO_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const
Definition ClothoidG2.cc:1185
friend ostream_type & operator<<(ostream_type &stream, ClothoidCurve const &c)
Definition Clothoid.cc:1251
real_type curvature_min_max(real_type &kMin, real_type &kMax) const
Definition ClothoidG2.cc:930
ClothoidCurve const & SM() const
Definition ClothoidList.hxx:577
real_type integral_jerk2() const
Definition ClothoidList.hxx:624
void eval_DDD(real_type s, real_type &x_DDD, real_type &y_DDD) const
Definition ClothoidG2.cc:1097
real_type kappa_end() const
Definition ClothoidList.hxx:725
int build_fixed_length(real_type s0, real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type s1, real_type x1, real_type y1, real_type theta1, real_type kappa1)
Definition ClothoidG2.cc:618
void set_max_iter(integer miter)
Definition ClothoidG2.cc:498
void reverse()
Definition ClothoidList.hxx:818
real_type integral_curvature2() const
Definition ClothoidList.hxx:614
real_type delta_theta() const
Definition ClothoidList.hxx:652
void eval(real_type s, real_type &theta, real_type &kappa, real_type &x, real_type &y) const
Definition ClothoidG2.cc:1011
real_type y_end() const
Definition ClothoidList.hxx:720
real_type theta_min_max(real_type &thMin, real_type &thMax) const
Definition ClothoidG2.cc:915
real_type x_begin() const
Definition ClothoidList.hxx:695
void eval_ISO(real_type s, real_type offs, real_type &x, real_type &y) const
Definition ClothoidG2.cc:1119
void eval_D(real_type s, real_type &x_D, real_type &y_D) const
Definition ClothoidG2.cc:1055
real_type theta_DDD(real_type s) const
Definition ClothoidG2.cc:978
real_type theta(real_type s) const
Definition ClothoidG2.cc:945
real_type kappa_begin() const
Definition ClothoidList.hxx:705
void save(ostream_type &stream) const
save clothoid list of a file stream
Definition ClothoidList.cc:2543
ClothoidCurve const & S0() const
Definition ClothoidList.hxx:567
real_type theta_end() const
Definition ClothoidList.hxx:730
real_type integral_snap2() const
Definition ClothoidList.hxx:634
real_type total_length() const
Definition ClothoidList.hxx:583
real_type theta_D(real_type s) const
Definition ClothoidG2.cc:956
real_type theta_DD(real_type s) const
Definition ClothoidG2.cc:967
Definition ClothoidList.hxx:267
int build(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type x1, real_type y1, real_type theta1, real_type kappa1)
Definition ClothoidG2.cc:337
G2solveCLC()=default
void set_tolerance(real_type tol)
Definition ClothoidG2.cc:382
int solve()
Definition ClothoidG2.cc:404
ClothoidCurve const & SM() const
Definition ClothoidList.hxx:360
void set_max_iter(integer miter)
Definition ClothoidG2.cc:393
ClothoidCurve const & S1() const
Definition ClothoidList.hxx:365
ClothoidCurve const & S0() const
Definition ClothoidList.hxx:355
Definition Line.hxx:37
Class to manage a collection of straight segment.
Definition PolyLine.hxx:42
Definition BBox.cc:42
Utils::AABBtree< real_type > AABB_TREE
AABB tree type
Definition Clothoids.hh:81
GC_namespace::GenericContainer GenericContainer
Generic container object.
Definition Clothoids.hh:84
std::basic_ostream< char > ostream_type
output streaming
Definition Clothoids.hh:78
std::vector< Ipair > IntersectList
Vector of pair of two real number.
Definition BaseCurve.hxx:36
enum class CurveType :integer { LINE, POLYLINE, CIRCLE, BIARC, BIARC_LIST, CLOTHOID, CLOTHOID_LIST, DUBINS, DUBINS3P } CurveType
Definition Clothoids.hh:89
std::basic_istream< char > istream_type
input streaming
Definition Clothoids.hh:77
double real_type
real type number
Definition Clothoids.hh:79
int integer
integer type number
Definition Clothoids.hh:80