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

Clothoids: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Clothoids/src/Clothoids/BaseCurve.hxx Source File
Clothoids
BaseCurve.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 | | |_) | (_| \__ \ __/ |__| |_| | | \ V / __/
32 | |____/ \__,_|___/\___|\____\__,_|_| \_/ \___|
33 \*/
34
35 using Ipair = std::pair<real_type,real_type>;
36 using IntersectList = std::vector<Ipair>;
37
38 /*\
39 | _ _ _
40 | (_)_ __ | |_ ___ _ __ ___ ___ ___| |_
41 | | | '_ \| __/ _ \ '__/ __|/ _ \/ __| __|
42 | | | | | | || __/ | \__ \ __/ (__| |_
43 | |_|_| |_|\__\___|_| |___/\___|\___|\__|
44 \*/
45
46 class BaseCurve;
47
55 bool
56 collision( BaseCurve const * pC1, BaseCurve const * pC2 );
57
67 bool
69 BaseCurve const * pC1,
70 real_type offs_C1,
71 BaseCurve const * pC2,
72 real_type offs_C2
73 );
74
84 inline
85 bool
87 BaseCurve const * pC1,
88 real_type offs_C1,
89 BaseCurve const * pC2,
90 real_type offs_C2
91 ) {
92 return collision_ISO( pC1, -offs_C1, pC2, -offs_C2 );
93 }
94
102 void
103 intersect(
104 BaseCurve const * pC1,
105 BaseCurve const * pC2,
106 IntersectList & ilist
107 );
108
118 void
120 BaseCurve const * pC1, real_type offs_C1,
121 BaseCurve const * pC2, real_type offs_C2,
122 IntersectList & ilist
123 );
124
134 inline
135 void
137 BaseCurve const * pC1, real_type offs_C1,
138 BaseCurve const * pC2, real_type offs_C2,
139 IntersectList & ilist
140 ) {
141 G2lib::intersect_ISO( pC1, -offs_C1, pC2, -offs_C2, ilist );
142 }
143
144 #ifdef CLOTHOIDS_BACK_COMPATIBILITY
145
155 inline
156 bool
157 collision(
158 BaseCurve const * pC1,
159 real_type offs_C1,
160 BaseCurve const * pC2,
161 real_type offs_C2
162 ) {
163 if ( G2lib::use_ISO ) return collision_ISO( pC1, offs_C1, pC2, offs_C2 );
164 else return collision_SAE( pC1, offs_C1, pC2, offs_C2 );
165 }
166
176 inline
177 void
178 intersect(
179 BaseCurve const * pC1, real_type offs_C1,
180 BaseCurve const * pC2, real_type offs_C2,
181 IntersectList & ilist
182 ) {
183 if ( G2lib::use_ISO ) G2lib::intersect_ISO( pC1, offs_C1, pC2, offs_C2, ilist );
184 else G2lib::intersect_SAE( pC1, -offs_C1, pC2, -offs_C2, ilist );
185 }
186
187 #endif
188
192 class BaseCurve {
193
194 string const m_name;
195
196 public:
197
198 // block default constructor
199 BaseCurve( ) = delete;
200 BaseCurve( BaseCurve const & ) = delete;
201 BaseCurve const & operator = ( BaseCurve const & ) = delete;
202
206 BaseCurve( string const & name ) : m_name(name) {}
207
208 virtual
209 ~BaseCurve() = default;
210
211 virtual void setup( GenericContainer const & gc ) = 0;
212
213 void build( GenericContainer const & gc ) { this->setup( gc ); }
214
218 virtual CurveType type() const = 0;
219
220 string name() const { return m_name; }
221 string type_name() const { return to_string(type()); }
222
223 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
224
228 virtual real_type length() const = 0;
229
233 virtual real_type length_ISO( real_type offs ) const = 0;
234
239 length_SAE( real_type offs ) const
240 { return this->length_ISO(-offs); }
241
242 /*\
243 | _ _
244 | | |__ | |__ _____ __
245 | | '_ \| '_ \ / _ \ \/ /
246 | | |_) | |_) | (_) > <
247 | |_.__/|_.__/ \___/_/\_\
248 \*/
249
258 virtual
259 void
261 real_type & xmin,
262 real_type & ymin,
263 real_type & xmax,
264 real_type & ymax
265 ) const = 0;
266
276 virtual
277 void
279 real_type offs,
280 real_type & xmin,
281 real_type & ymin,
282 real_type & xmax,
283 real_type & ymax
284 ) const = 0;
285
295 void
297 real_type offs,
298 real_type & xmin,
299 real_type & ymin,
300 real_type & xmax,
301 real_type & ymax
302 ) const {
303 this->bbox_ISO( -offs, xmin, ymin, xmax, ymax );
304 }
305
306 /*\
307 | _ _ _____ _ _
308 | | |__| |_|_ _| _(_)__ _ _ _ __ _| |___
309 | | '_ \ '_ \| || '_| / _` | ' \/ _` | / -_)
310 | |_.__/_.__/|_||_| |_\__,_|_||_\__, |_\___|
311 | |___/
312 \*/
313
324 virtual
325 void
327 vector<Triangle2D> & tvec,
328 real_type max_angle = Utils::m_pi/18,
329 real_type max_size = 1e100,
330 integer icurve = 0
331 ) const = 0;
332
342 virtual
343 void
345 real_type offs,
346 vector<Triangle2D> & tvec,
347 real_type max_angle = Utils::m_pi/18,
348 real_type max_size = 1e100,
349 integer icurve = 0
350 ) const = 0;
351
361 virtual
362 void
364 real_type offs,
365 vector<Triangle2D> & tvec,
366 real_type max_angle = Utils::m_pi/18,
367 real_type max_size = 1e100,
368 integer icurve = 0
369 ) const = 0;
370
371 /*\
372 | ____ _ _______ _
373 | | __ ) ___ __ _(_)_ __ / / ____|_ __ __| |
374 | | _ \ / _ \/ _` | | '_ \ / /| _| | '_ \ / _` |
375 | | |_) | __/ (_| | | | | |/ / | |___| | | | (_| |
376 | |____/ \___|\__, |_|_| |_/_/ |_____|_| |_|\__,_|
377 | |___/
378 \*/
379
383 virtual real_type theta_begin() const { return this->theta(0); }
384
388 virtual real_type theta_end() const { return this->theta(this->length()); }
389
393 virtual real_type kappa_begin() const { return this->kappa(0); }
394
398 virtual real_type kappa_end() const { return this->kappa(this->length()); }
399
403 virtual real_type x_begin() const { return this->X(0); }
404
408 virtual real_type y_begin() const { return this->Y(0); }
409
413 virtual real_type x_end() const { return this->X(this->length()); }
414
418 virtual real_type y_end() const { return this->Y(this->length()); }
419
423 virtual real_type x_begin_ISO( real_type offs ) const { return this->X_ISO(0,offs); }
424
428 virtual real_type y_begin_ISO( real_type offs ) const { return this->Y_ISO(0,offs); }
429
433 virtual real_type x_end_ISO( real_type offs ) const { return this->X_ISO(this->length(),offs); }
434
438 virtual real_type y_end_ISO( real_type offs ) const { return this->Y_ISO(this->length(),offs); }
439
443 real_type x_begin_SAE( real_type offs ) const { return this->x_begin_ISO(-offs); }
444
448 real_type y_begin_SAE( real_type offs ) const { return this->y_begin_ISO(-offs); }
449
453 real_type x_end_SAE( real_type offs ) const { return this->x_end_ISO(-offs); }
454
458 real_type y_end_SAE( real_type offs ) const { return this->y_end_ISO(-offs); }
459
463 virtual real_type tx_begin() const { return this->tx(0); }
464
468 virtual real_type ty_begin() const { return this->ty(0); }
469
473 virtual real_type tx_end() const { return this->tx(this->length()); }
474
478 virtual real_type ty_end() const { return this->ty(this->length()); }
479
483 virtual real_type nx_begin_ISO() const { return -this->ty(0); }
484
488 virtual real_type ny_begin_ISO() const { return this->tx(0); }
489
493 virtual real_type nx_end_ISO() const { return -this->ty(this->length()); }
494
498 virtual real_type ny_end_ISO() const { return this->tx(this->length()); }
499
503 real_type nx_begin_SAE() const { return -nx_begin_ISO(); }
504
508 real_type ny_begin_SAE() const { return -ny_begin_ISO(); }
509
513 real_type nx_end_SAE() const { return -nx_end_ISO(); }
514
518 real_type ny_end_SAE() const { return -ny_end_ISO(); }
519
520 /*\
521 | _ _ _
522 | | |_| |__ ___| |_ __ _
523 | | __| '_ \ / _ \ __/ _` |
524 | | |_| | | | __/ || (_| |
525 | \__|_| |_|\___|\__\__,_|
526 \*/
527
531 virtual real_type theta( real_type s ) const = 0;
532
536 virtual real_type theta_D( real_type s ) const = 0;
537
541 virtual real_type theta_DD( real_type s ) const = 0;
542
546 virtual real_type theta_DDD( real_type s ) const = 0;
547
548 /*\
549 | _
550 | | | ____ _ _ __ _ __ __ _
551 | | |/ / _` | '_ \| '_ \ / _` |
552 | | < (_| | |_) | |_) | (_| |
553 | |_|\_\__,_| .__/| .__/ \__,_|
554 | |_| |_|
555 \*/
556
560 real_type kappa( real_type s ) const { return theta_D(s); }
561
565 real_type kappa_D( real_type s ) const { return theta_DD(s); }
566
570 real_type kappa_DD( real_type s ) const { return theta_DDD(s); }
571
572 /*\
573 | _____ _ _ _
574 | |_ _| __ _ _ __ __| | | \ | |
575 | | | / _` | '_ \ / _` | | \| |
576 | | | | (_| | | | | (_| | | |\ |
577 | |_| \__,_|_| |_|\__,_| |_| \_|
578 \*/
579
583 virtual real_type tx( real_type s ) const;
584
588 virtual real_type ty( real_type s ) const;
589
593 virtual real_type tx_D( real_type s ) const;
594
598 virtual real_type ty_D( real_type s ) const;
599
603 virtual real_type tx_DD( real_type s ) const;
604
608 virtual real_type ty_DD( real_type s ) const;
609
613 virtual real_type tx_DDD( real_type s ) const;
614
618 virtual real_type ty_DDD( real_type s ) const;
619
620 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
624 real_type nx_ISO( real_type s ) const { return -ty(s); }
625
629 real_type nx_ISO_D( real_type s ) const { return -ty_D(s); }
630
634 real_type nx_ISO_DD( real_type s ) const { return -ty_DD(s); }
635
639 real_type nx_ISO_DDD( real_type s ) const { return -ty_DDD(s); }
640
644 real_type ny_ISO( real_type s ) const { return tx(s); }
645
649 real_type ny_ISO_D( real_type s ) const { return tx_D(s); }
650
654 real_type ny_ISO_DD( real_type s ) const { return tx_DD(s); }
655
659 real_type ny_ISO_DDD( real_type s ) const { return tx_DDD(s); }
660
664 real_type nx_SAE( real_type s ) const { return ty(s); }
665
669 real_type nx_SAE_D( real_type s ) const { return ty_D(s); }
670
674 real_type nx_SAE_DD( real_type s ) const { return ty_DD(s); }
675
679 real_type nx_SAE_DDD( real_type s ) const { return ty_DDD(s); }
680
684 real_type ny_SAE( real_type s ) const { return -tx(s); }
685
689 real_type ny_SAE_D( real_type s ) const { return -tx_D(s); }
690
694 real_type ny_SAE_DD ( real_type s ) const { return -tx_DD(s); }
695
699 real_type ny_SAE_DDD( real_type s ) const { return -tx_DDD(s); }
700
701 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
702
706 virtual
707 void
708 tg( real_type s, real_type & tg_x, real_type & tg_y ) const {
709 tg_x = this->tx(s);
710 tg_y = this->ty(s);
711 }
712
716 virtual
717 void
718 tg_D( real_type s, real_type & tg_x_D, real_type & tg_y_D ) const {
719 tg_x_D = this->tx_D(s);
720 tg_y_D = this->ty_D(s);
721 }
722
726 virtual
727 void
728 tg_DD( real_type s, real_type & tg_x_DD, real_type & tg_y_DD ) const {
729 tg_x_DD = this->tx_DD(s);
730 tg_y_DD = this->ty_DD(s);
731 }
732
736 virtual
737 void
738 tg_DDD( real_type s, real_type & tg_x_DDD, real_type & tg_y_DDD ) const {
739 tg_x_DDD = this->tx_DDD(s);
740 tg_y_DDD = this->ty_DDD(s);
741 }
742
743 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
744
748 void
749 nor_ISO( real_type s, real_type & nx, real_type & ny ) const
750 { tg( s, ny, nx ); nx = -nx; }
751
755 void
756 nor_ISO_D( real_type s, real_type & nx_D, real_type & ny_D ) const
757 { tg_D( s, ny_D, nx_D ); nx_D = -nx_D; }
758
762 void
763 nor_ISO_DD( real_type s, real_type & nx_DD, real_type & ny_DD ) const
764 { tg_DD( s, ny_DD, nx_DD ); nx_DD = -nx_DD; }
765
769 void
770 nor_ISO_DDD( real_type s, real_type & nx_DDD, real_type & ny_DDD ) const
771 { tg_DDD( s, ny_DDD, nx_DDD ); nx_DDD = -nx_DDD; }
772
776 void
777 nor_SAE( real_type s, real_type & nx, real_type & ny ) const
778 { tg( s, ny, nx ); ny = -ny; }
779
783 void
784 nor_SAE_D( real_type s, real_type & nx_D, real_type & ny_D ) const
785 { tg_D( s, ny_D, nx_D ); ny_D = -ny_D; }
786
790 void
791 nor_SAE_DD( real_type s, real_type & nx_DD, real_type & ny_DD ) const
792 { tg_DD( s, ny_DD, nx_DD ); ny_DD = -ny_DD; }
793
797 void
798 nor_SAE_DDD( real_type s, real_type & nx_DDD, real_type & ny_DDD ) const
799 { tg_DDD( s, ny_DDD, nx_DDD ); ny_DDD = -ny_DDD; }
800
801 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
802
812 virtual
813 void
815 real_type s,
816 real_type & th,
817 real_type & k,
818 real_type & x,
819 real_type & y
820 ) const {
821 eval( s, x, y );
822 th = theta( s );
823 k = theta_D( s );
824 }
825
836 virtual
837 void
839 real_type s,
840 real_type offs,
841 real_type & th,
842 real_type & k,
843 real_type & x,
844 real_type & y
845 ) const {
846 eval_ISO( s, offs, x, y );
847 th = theta( s );
848 k = theta_D( s );
849 k /= 1+offs*k; // scale curvature
850 }
851
862 virtual
863 void
865 real_type s,
866 real_type offs,
867 real_type & th,
868 real_type & k,
869 real_type & x,
870 real_type & y
871 ) const {
872 eval_SAE( s, offs, x, y );
873 th = theta( s );
874 k = theta_D( s );
875 k /= 1-offs*k; // scale curvature
876 }
877
878 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
879
883 virtual real_type X( real_type s ) const = 0;
884
888 virtual real_type Y( real_type s ) const = 0;
889
893 virtual real_type X_D( real_type s ) const = 0;
894
898 virtual real_type Y_D( real_type s ) const = 0;
899
903 virtual real_type X_DD( real_type s ) const = 0;
904
908 virtual real_type Y_DD( real_type s ) const = 0;
909
913 virtual real_type X_DDD( real_type s ) const = 0;
914
918 virtual real_type Y_DDD( real_type s ) const = 0;
919
920 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
921
925 virtual
926 void
927 eval( real_type s, real_type & x, real_type & y ) const = 0;
928
932 virtual
933 void
934 eval_D( real_type s, real_type & x_D, real_type & y_D ) const = 0;
935
939 virtual
940 void
941 eval_DD( real_type s, real_type & x_DD, real_type & y_DD ) const = 0;
942
946 virtual
947 void
948 eval_DDD( real_type s, real_type & x_DDD, real_type & y_DDD ) const = 0;
949
950 /*\
951 | __ __ _
952 | ___ / _|/ _|___ ___| |_
953 | / _ \| |_| |_/ __|/ _ \ __|
954 | | (_) | _| _\__ \ __/ |_
955 | \___/|_| |_| |___/\___|\__|
956 \*/
957
961 virtual real_type X_ISO( real_type s, real_type offs ) const;
962
966 virtual real_type Y_ISO( real_type s, real_type offs ) const;
967
971 virtual real_type X_ISO_D( real_type s, real_type offs ) const;
972
976 virtual real_type Y_ISO_D( real_type s, real_type offs ) const;
977
981 virtual real_type X_ISO_DD( real_type s, real_type offs ) const;
982
986 virtual real_type Y_ISO_DD( real_type s, real_type offs ) const;
987
991 virtual real_type X_ISO_DDD( real_type s, real_type offs ) const;
992
996 virtual real_type Y_ISO_DDD( real_type s, real_type offs ) const;
997
1001 real_type X_SAE( real_type s, real_type offs ) const { return this->X_ISO(s,-offs); }
1002
1006 real_type Y_SAE( real_type s, real_type offs ) const { return this->Y_ISO(s,-offs); }
1007
1011 real_type X_SAE_D( real_type s, real_type offs ) const { return this->X_ISO_D(s,-offs); }
1012
1016 real_type Y_SAE_D( real_type s, real_type offs ) const { return this->Y_ISO_D(s,-offs); }
1017
1021 real_type X_SAE_DD( real_type s, real_type offs ) const { return this->X_ISO_DD(s,-offs); }
1022
1026 real_type Y_SAE_DD( real_type s, real_type offs ) const { return this->Y_ISO_DD(s,-offs); }
1027
1031 real_type X_SAE_DDD( real_type s, real_type offs ) const { return this->X_ISO_DDD(s,-offs); }
1032
1036 real_type Y_SAE_DDD( real_type s, real_type offs ) const { return this->Y_ISO_DDD(s,-offs); }
1037
1038 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1039
1048 virtual
1049 void
1051 real_type s,
1052 real_type offs,
1053 real_type & x,
1054 real_type & y
1055 ) const;
1056
1065 void
1067 real_type s,
1068 real_type offs,
1069 real_type & x,
1070 real_type & y
1071 ) const {
1072 this->eval_ISO( s, -offs, x, y );
1073 }
1074
1083 virtual
1084 void
1086 real_type s,
1087 real_type offs,
1088 real_type & x_D,
1089 real_type & y_D
1090 ) const;
1091
1100 void
1102 real_type s,
1103 real_type offs,
1104 real_type & x_D,
1105 real_type & y_D
1106 ) const {
1107 this->eval_ISO_D( s, -offs, x_D, y_D );
1108 }
1109
1118 virtual
1119 void
1121 real_type s,
1122 real_type offs,
1123 real_type & x_DD,
1124 real_type & y_DD
1125 ) const;
1126
1135 void
1137 real_type s,
1138 real_type offs,
1139 real_type & x_DD,
1140 real_type & y_DD
1141 ) const {
1142 this->eval_ISO_DD( s, -offs, x_DD, y_DD );
1143 }
1144
1153 virtual
1154 void
1156 real_type s,
1157 real_type offs,
1158 real_type & x_DDD,
1159 real_type & y_DDD
1160 ) const;
1161
1170 void
1172 real_type s,
1173 real_type offs,
1174 real_type & x_DDD,
1175 real_type & y_DDD
1176 ) const {
1177 this->eval_ISO_DDD( s, -offs, x_DDD, y_DDD );
1178 }
1179
1180 /*\
1181 | _ __
1182 | | |_ _ __ __ _ _ __ ___ / _| ___ _ __ _ __ ___
1183 | | __| '__/ _` | '_ \/ __| |_ / _ \| '__| '_ ` _ \
1184 | | |_| | | (_| | | | \__ \ _| (_) | | | | | | | |
1185 | \__|_| \__,_|_| |_|___/_| \___/|_| |_| |_| |_|
1186 \*/
1187
1189 virtual
1190 void
1192
1200 virtual
1201 void
1202 rotate( real_type angle, real_type cx, real_type cy ) = 0;
1203
1207 virtual
1208 void
1209 scale( real_type sc ) = 0;
1210
1214 virtual
1215 void
1216 reverse() = 0;
1217
1221 virtual
1222 void
1223 change_origin( real_type newx0, real_type newy0 ) = 0;
1224
1228 virtual
1229 void
1230 trim( real_type s_begin, real_type s_end ) = 0;
1231
1232 /*\
1233 | _ _ _
1234 | (_)_ __ | |_ ___ _ __ ___ ___ ___| |_
1235 | | | '_ \| __/ _ \ '__/ __|/ _ \/ __| __|
1236 | | | | | | || __/ | \__ \ __/ (__| |_
1237 | |_|_| |_|\__\___|_| |___/\___|\___|\__|
1238 \*/
1239
1243 virtual bool collision( BaseCurve const * pC ) const = 0;
1244
1253 virtual
1254 bool
1256 real_type offs,
1257 BaseCurve const * pC,
1258 real_type offs_C
1259 ) const = 0;
1260
1269 bool
1271 real_type offs,
1272 BaseCurve const * pC,
1273 real_type offs_C
1274 ) const {
1275 return this->collision_ISO( -offs, pC, -offs_C );
1276 }
1277
1284 virtual
1285 void
1287 BaseCurve const * pC,
1288 IntersectList & ilist
1289 ) const = 0;
1290
1299 virtual
1300 void
1302 real_type offs,
1303 BaseCurve const * pC,
1304 real_type offs_C,
1305 IntersectList & ilist
1306 ) const = 0;
1307
1316 void
1318 real_type offs,
1319 BaseCurve const * pC,
1320 real_type offs_C,
1321 IntersectList & ilist
1322 ) const {
1323 this->intersect_ISO( -offs, pC, -offs_C, ilist );
1324 }
1325
1326 /*\
1327 | _ _ _
1328 | __| (_)___| |_ __ _ _ __ ___ ___
1329 | / _` | / __| __/ _` | '_ \ / __/ _ \
1330 | | (_| | \__ \ || (_| | | | | (_| __/
1331 | \__,_|_|___/\__\__,_|_| |_|\___\___|
1332 \*/
1333
1348 virtual
1349 integer
1351 real_type qx,
1352 real_type qy,
1353 real_type & x,
1354 real_type & y,
1355 real_type & s,
1356 real_type & t,
1357 real_type & dst
1358 ) const = 0;
1359
1374 integer
1376 real_type qx,
1377 real_type qy,
1378 real_type & x,
1379 real_type & y,
1380 real_type & s,
1381 real_type & t,
1382 real_type & dst
1383 ) const {
1384 integer res = this->closest_point_ISO( qx, qy, x, y, s, t, dst );
1385 t = -t;
1386 return res;
1387 }
1388
1404 virtual
1405 integer // true if projection is unique and orthogonal
1407 real_type qx,
1408 real_type qy,
1409 real_type offs,
1410 real_type & x,
1411 real_type & y,
1412 real_type & s,
1413 real_type & t,
1414 real_type & dst
1415 ) const = 0;
1416
1432 integer
1434 real_type qx,
1435 real_type qy,
1436 real_type offs,
1437 real_type & x,
1438 real_type & y,
1439 real_type & s,
1440 real_type & t,
1441 real_type & dst
1442 ) const {
1443 integer res = this->closest_point_ISO( qx, qy, -offs, x, y, s, t, dst );
1444 t = -t;
1445 return res;
1446 }
1447
1455 virtual
1456 real_type
1457 distance( real_type qx, real_type qy ) const {
1458 real_type x, y, s, t, dst;
1459 closest_point_ISO( qx, qy, x, y, s, t, dst );
1460 return dst;
1461 }
1462
1471 real_type
1473 real_type qx,
1474 real_type qy,
1475 real_type offs
1476 ) const {
1477 real_type x, y, s, t, dst;
1478 this->closest_point_ISO( qx, qy, offs, x, y, s, t, dst );
1479 return dst;
1480 }
1481
1490 real_type
1492 real_type qx,
1493 real_type qy,
1494 real_type offs
1495 ) const {
1496 real_type x, y, s, t, dst;
1497 this->closest_point_SAE( qx, qy, offs, x, y, s, t, dst );
1498 return dst;
1499 }
1500
1501 /*\
1502 | __ _ _ ____ _____
1503 | / _(_)_ __ __| / ___|_ _|
1504 | | |_| | '_ \ / _` \___ \ | |
1505 | | _| | | | | (_| |___) || |
1506 | |_| |_|_| |_|\__,_|____/ |_|
1507 \*/
1508
1526 bool
1528 real_type x,
1529 real_type y,
1530 real_type & s,
1531 real_type & t
1532 ) const {
1533 real_type X, Y, dst;
1534 integer icode = this->closest_point_ISO( x, y, X, Y, s, t, dst );
1535 return icode >= 0;
1536 }
1537
1555 bool
1557 real_type x,
1558 real_type y,
1559 real_type & s,
1560 real_type & t
1561 ) const {
1562 real_type X, Y, dst;
1563 integer icode = this->closest_point_SAE( x, y, X, Y, s, t, dst );
1564 return icode >= 0;
1565 }
1566
1567 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1568
1572 virtual
1573 void
1574 info( ostream_type & stream ) const = 0;
1575
1576#ifdef CLOTHOIDS_BACK_COMPATIBILITY
1577#include "BaseCurve_compatibility.hxx"
1578#endif
1579
1580 };
1581
1582}
1583
Definition BaseCurve.hxx:192
void nor_ISO(real_type s, real_type &nx, real_type &ny) const
Definition BaseCurve.hxx:749
virtual real_type theta_D(real_type s) const =0
virtual void eval_DDD(real_type s, real_type &x_DDD, real_type &y_DDD) const =0
virtual void eval_D(real_type s, real_type &x_D, real_type &y_D) const =0
real_type nx_ISO(real_type s) const
Definition BaseCurve.hxx:624
void intersect_SAE(real_type offs, BaseCurve const *pC, real_type offs_C, IntersectList &ilist) const
Definition BaseCurve.hxx:1317
real_type ny_SAE_D(real_type s) const
Definition BaseCurve.hxx:689
virtual real_type theta_end() const
Definition BaseCurve.hxx:388
virtual real_type y_end_ISO(real_type offs) const
Definition BaseCurve.hxx:438
virtual real_type X_ISO_DD(real_type s, real_type offs) const
virtual real_type ty_end() const
Definition BaseCurve.hxx:478
virtual bool collision(BaseCurve const *pC) const =0
bool collision_SAE(real_type offs, BaseCurve const *pC, real_type offs_C) const
Definition BaseCurve.hxx:1270
real_type nx_ISO_D(real_type s) const
Definition BaseCurve.hxx:629
bool findST_SAE(real_type x, real_type y, real_type &s, real_type &t) const
Definition BaseCurve.hxx:1556
virtual real_type Y_D(real_type s) const =0
virtual real_type X_DD(real_type s) const =0
virtual void bb_triangles_ISO(real_type offs, vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/18, real_type max_size=1e100, integer icurve=0) const =0
void nor_SAE(real_type s, real_type &nx, real_type &ny) const
Definition BaseCurve.hxx:777
virtual real_type X_ISO_DDD(real_type s, real_type offs) const
virtual void tg_DD(real_type s, real_type &tg_x_DD, real_type &tg_y_DD) const
Definition BaseCurve.hxx:728
real_type distance_ISO(real_type qx, real_type qy, real_type offs) const
Definition BaseCurve.hxx:1472
virtual real_type tx(real_type s) const
virtual void tg(real_type s, real_type &tg_x, real_type &tg_y) const
Definition BaseCurve.hxx:708
virtual real_type theta_DDD(real_type s) const =0
virtual void change_origin(real_type newx0, real_type newy0)=0
virtual void tg_D(real_type s, real_type &tg_x_D, real_type &tg_y_D) const
Definition BaseCurve.hxx:718
real_type ny_begin_SAE() const
Definition BaseCurve.hxx:508
real_type nx_end_SAE() const
Definition BaseCurve.hxx:513
virtual real_type Y(real_type s) const =0
void nor_ISO_DDD(real_type s, real_type &nx_DDD, real_type &ny_DDD) const
Definition BaseCurve.hxx:770
virtual void evaluate_SAE(real_type s, real_type offs, real_type &th, real_type &k, real_type &x, real_type &y) const
Definition BaseCurve.hxx:864
real_type kappa(real_type s) const
Definition BaseCurve.hxx:560
integer closest_point_SAE(real_type qx, real_type qy, real_type offs, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const
Definition BaseCurve.hxx:1433
virtual real_type ty_DD(real_type s) const
integer closest_point_SAE(real_type qx, real_type qy, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const
Definition BaseCurve.hxx:1375
real_type nx_SAE_D(real_type s) const
Definition BaseCurve.hxx:669
virtual real_type tx_D(real_type s) const
virtual real_type x_end_ISO(real_type offs) const
Definition BaseCurve.hxx:433
virtual real_type X_ISO_D(real_type s, real_type offs) const
virtual real_type tx_end() const
Definition BaseCurve.hxx:473
virtual void trim(real_type s_begin, real_type s_end)=0
real_type nx_ISO_DD(real_type s) const
Definition BaseCurve.hxx:634
virtual real_type nx_begin_ISO() const
Definition BaseCurve.hxx:483
real_type ny_ISO(real_type s) const
Definition BaseCurve.hxx:644
virtual void intersect_ISO(real_type offs, BaseCurve const *pC, real_type offs_C, IntersectList &ilist) const =0
real_type Y_SAE(real_type s, real_type offs) const
Definition BaseCurve.hxx:1006
real_type y_end_SAE(real_type offs) const
Definition BaseCurve.hxx:458
virtual real_type Y_DD(real_type s) const =0
void nor_SAE_DDD(real_type s, real_type &nx_DDD, real_type &ny_DDD) const
Definition BaseCurve.hxx:798
virtual void eval_ISO_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const
void nor_SAE_D(real_type s, real_type &nx_D, real_type &ny_D) const
Definition BaseCurve.hxx:784
real_type nx_begin_SAE() const
Definition BaseCurve.hxx:503
virtual real_type theta_DD(real_type s) const =0
void nor_ISO_D(real_type s, real_type &nx_D, real_type &ny_D) const
Definition BaseCurve.hxx:756
real_type nx_SAE(real_type s) const
Definition BaseCurve.hxx:664
virtual void tg_DDD(real_type s, real_type &tg_x_DDD, real_type &tg_y_DDD) const
Definition BaseCurve.hxx:738
real_type ny_ISO_DD(real_type s) const
Definition BaseCurve.hxx:654
virtual void eval(real_type s, real_type &x, real_type &y) const =0
real_type kappa_DD(real_type s) const
Definition BaseCurve.hxx:570
real_type Y_SAE_DD(real_type s, real_type offs) const
Definition BaseCurve.hxx:1026
virtual real_type x_end() const
Definition BaseCurve.hxx:413
virtual real_type y_begin() const
Definition BaseCurve.hxx:408
virtual CurveType type() const =0
real_type X_SAE_D(real_type s, real_type offs) const
Definition BaseCurve.hxx:1011
virtual void scale(real_type sc)=0
virtual void translate(real_type tx, real_type ty)=0
translate curve by
virtual real_type tx_DDD(real_type s) const
virtual void bb_triangles(vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/18, real_type max_size=1e100, integer icurve=0) const =0
virtual real_type ny_begin_ISO() const
Definition BaseCurve.hxx:488
virtual void eval_ISO_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const
virtual real_type X_ISO(real_type s, real_type offs) const
void eval_SAE_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const
Definition BaseCurve.hxx:1136
virtual void bbox(real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const =0
virtual void reverse()=0
void eval_SAE_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const
Definition BaseCurve.hxx:1101
virtual void eval_DD(real_type s, real_type &x_DD, real_type &y_DD) const =0
virtual real_type x_begin() const
Definition BaseCurve.hxx:403
real_type ny_SAE_DD(real_type s) const
Definition BaseCurve.hxx:694
virtual integer closest_point_ISO(real_type qx, real_type qy, real_type offs, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const =0
virtual real_type nx_end_ISO() const
Definition BaseCurve.hxx:493
virtual real_type Y_DDD(real_type s) const =0
virtual real_type X(real_type s) const =0
void nor_ISO_DD(real_type s, real_type &nx_DD, real_type &ny_DD) const
Definition BaseCurve.hxx:763
real_type x_begin_SAE(real_type offs) const
Definition BaseCurve.hxx:443
virtual real_type y_end() const
Definition BaseCurve.hxx:418
virtual void evaluate_ISO(real_type s, real_type offs, real_type &th, real_type &k, real_type &x, real_type &y) const
Definition BaseCurve.hxx:838
bool findST_ISO(real_type x, real_type y, real_type &s, real_type &t) const
Definition BaseCurve.hxx:1527
virtual real_type length() const =0
virtual bool collision_ISO(real_type offs, BaseCurve const *pC, real_type offs_C) const =0
virtual real_type tx_begin() const
Definition BaseCurve.hxx:463
virtual void info(ostream_type &stream) const =0
virtual void bbox_ISO(real_type offs, real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const =0
virtual real_type kappa_end() const
Definition BaseCurve.hxx:398
virtual void intersect(BaseCurve const *pC, IntersectList &ilist) const =0
virtual real_type ny_end_ISO() const
Definition BaseCurve.hxx:498
virtual real_type distance(real_type qx, real_type qy) const
Definition BaseCurve.hxx:1457
real_type nx_SAE_DD(real_type s) const
Definition BaseCurve.hxx:674
virtual real_type Y_ISO_DD(real_type s, real_type offs) const
virtual real_type x_begin_ISO(real_type offs) const
Definition BaseCurve.hxx:423
virtual void bb_triangles_SAE(real_type offs, vector< Triangle2D > &tvec, real_type max_angle=Utils::m_pi/18, real_type max_size=1e100, integer icurve=0) const =0
real_type y_begin_SAE(real_type offs) const
Definition BaseCurve.hxx:448
void bbox_SAE(real_type offs, real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const
Definition BaseCurve.hxx:296
virtual real_type theta(real_type s) const =0
real_type distance_SAE(real_type qx, real_type qy, real_type offs) const
Definition BaseCurve.hxx:1491
void eval_SAE_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const
Definition BaseCurve.hxx:1171
virtual real_type kappa_begin() const
Definition BaseCurve.hxx:393
virtual real_type theta_begin() const
Definition BaseCurve.hxx:383
real_type Y_SAE_DDD(real_type s, real_type offs) const
Definition BaseCurve.hxx:1036
virtual 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 =0
real_type X_SAE_DDD(real_type s, real_type offs) const
Definition BaseCurve.hxx:1031
real_type x_end_SAE(real_type offs) const
Definition BaseCurve.hxx:453
void nor_SAE_DD(real_type s, real_type &nx_DD, real_type &ny_DD) const
Definition BaseCurve.hxx:791
virtual real_type Y_ISO_D(real_type s, real_type offs) const
virtual real_type X_DDD(real_type s) const =0
virtual real_type X_D(real_type s) const =0
real_type ny_ISO_D(real_type s) const
Definition BaseCurve.hxx:649
real_type Y_SAE_D(real_type s, real_type offs) const
Definition BaseCurve.hxx:1016
virtual real_type ty(real_type s) const
real_type ny_SAE_DDD(real_type s) const
Definition BaseCurve.hxx:699
virtual real_type ty_begin() const
Definition BaseCurve.hxx:468
virtual real_type length_ISO(real_type offs) const =0
void eval_SAE(real_type s, real_type offs, real_type &x, real_type &y) const
Definition BaseCurve.hxx:1066
virtual void eval_ISO(real_type s, real_type offs, real_type &x, real_type &y) const
real_type nx_SAE_DDD(real_type s) const
Definition BaseCurve.hxx:679
real_type ny_ISO_DDD(real_type s) const
Definition BaseCurve.hxx:659
virtual void rotate(real_type angle, real_type cx, real_type cy)=0
real_type ny_end_SAE() const
Definition BaseCurve.hxx:518
virtual real_type Y_ISO_DDD(real_type s, real_type offs) const
real_type ny_SAE(real_type s) const
Definition BaseCurve.hxx:684
virtual real_type ty_D(real_type s) const
real_type kappa_D(real_type s) const
Definition BaseCurve.hxx:565
real_type length_SAE(real_type offs) const
Definition BaseCurve.hxx:239
virtual void eval_ISO_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const
virtual real_type ty_DDD(real_type s) const
virtual void evaluate(real_type s, real_type &th, real_type &k, real_type &x, real_type &y) const
Definition BaseCurve.hxx:814
real_type nx_ISO_DDD(real_type s) const
Definition BaseCurve.hxx:639
virtual real_type y_begin_ISO(real_type offs) const
Definition BaseCurve.hxx:428
real_type X_SAE_DD(real_type s, real_type offs) const
Definition BaseCurve.hxx:1021
BaseCurve(string const &name)
Definition BaseCurve.hxx:206
real_type X_SAE(real_type s, real_type offs) const
Definition BaseCurve.hxx:1001
virtual real_type Y_ISO(real_type s, real_type offs) const
virtual real_type tx_DD(real_type s) const
Definition BBox.cc:42
void intersect_ISO(BaseCurve const *pC1, real_type offs_C1, BaseCurve const *pC2, real_type offs_C2, IntersectList &ilist)
Definition G2lib_intersect.cc:452
GC_namespace::GenericContainer GenericContainer
Generic container object.
Definition Clothoids.hh:84
string to_string(CurveType n)
Definition Clothoids.hh:106
std::basic_ostream< char > ostream_type
output streaming
Definition Clothoids.hh:78
void intersect(BaseCurve const *pC1, BaseCurve const *pC2, IntersectList &ilist)
Definition G2lib_intersect.cc:344
std::vector< Ipair > IntersectList
Vector of pair of two real number.
Definition BaseCurve.hxx:36
void intersect_SAE(BaseCurve const *pC1, real_type offs_C1, BaseCurve const *pC2, real_type offs_C2, IntersectList &ilist)
Definition BaseCurve.hxx:136
std::pair< real_type, real_type > Ipair
Pair of two real number.
Definition BaseCurve.hxx:35
bool collision_SAE(BaseCurve const *pC1, real_type offs_C1, BaseCurve const *pC2, real_type offs_C2)
Definition BaseCurve.hxx:86
enum class CurveType :integer { LINE, POLYLINE, CIRCLE, BIARC, BIARC_LIST, CLOTHOID, CLOTHOID_LIST, DUBINS, DUBINS3P } CurveType
Definition Clothoids.hh:89
double real_type
real type number
Definition Clothoids.hh:79
bool collision_ISO(BaseCurve const *pC1, real_type offs_C1, BaseCurve const *pC2, real_type offs_C2)
Definition G2lib_intersect.cc:232
bool collision(BaseCurve const *pC1, BaseCurve const *pC2)
Definition G2lib_intersect.cc:125
int integer
integer type number
Definition Clothoids.hh:80