Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Curve.h
1// trax track library
2// AD 2013
3//
4// "If there is something they need
5// If there is something they want
6// They've got to raise their hand!"
7//
8// Bruce Springsteen
9//
10// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
11// Copyright (c) 2019 Marc-Michael Horstmann
12//
13// Permission is hereby granted to any person obtaining a copy of this software
14// and associated source code (the "Software"), to use, view, and study the
15// Software for personal or internal business purposes, subject to the following
16// conditions:
17//
18// 1. Redistribution, modification, sublicensing, or commercial use of the
19// Software is NOT permitted without prior written consent from the copyright
20// holder.
21//
22// 2. The Software is provided "AS IS", without warranty of any kind, express
23// or implied.
24//
25// 3. All copies of the Software must retain this license notice.
26//
27// For further information, please contact: horstmann.marc@trendverlag.de
28
29#pragma once
30
173
174#include "Configuration.h"
175#include "Units.h"
176
177#include <memory>
178
179#include "common/Interval.h"
180#include "spat/Frame.h"
181#include "spat/Matrix.h"
182#include "spat/VectorBundle.h"
183#include "spat/VectorBundle2.h"
184#include "spat/Vector2D.h"
185
186
187namespace trax
188{
198 struct Curve{
199
226
227
229 virtual const char* TypeName() const noexcept = 0;
230
231
233 virtual CurveType GetCurveType() const noexcept = 0;
234
235
238 virtual bool IsValid() const noexcept = 0;
239
240
243 virtual AnglePerLength Curvature( Length s ) const = 0;
244
245
248 virtual AnglePerLength Torsion( Length s ) const = 0;
249
250
252 virtual bool IsFlat() const noexcept = 0;
253
254
259 virtual void Transition( Length s, spat::Position<Length>& pos ) const = 0;
260
261
266 virtual void Transition( Length s, spat::Vector<One>& tan ) const = 0;
267
268
273 virtual void Transition( Length s, spat::VectorBundle<Length,One>& bundle ) const = 0;
274
275
280 virtual void Transition( Length s, spat::VectorBundle2<Length,One>& bundle ) const = 0;
281
282
287 virtual void Transition( Length s, spat::Frame<Length,One>& frame ) const = 0;
288
289
299 virtual std::vector<Length> ZeroSet() const = 0;
300
301
306 virtual common::Interval<Length> Range() const = 0;
307
308
315 virtual spat::Vector<One> LocalUp() const = 0;
316
317
327
328
331 virtual std::unique_ptr<Curve> Clone() const = 0;
332
333
336 virtual bool Mirror( const spat::VectorBundle<Length,One>& mirrorPlane ) = 0;
337
338
347 virtual bool Equals( const Curve& toCurve, common::Interval<Length> range,
348 Length epsilon_length = epsilon__length,
349 Angle epsilon_angle = epsilon__angle ) const = 0;
350
351
352 virtual ~Curve() = default;
353 Curve( Curve&& ) = delete;
354 Curve& operator=( const Curve& ) = delete;
355 Curve& operator=( Curve&& ) = delete;
356 protected:
357 Curve() = default;
358 Curve( const Curve& ) = default;
359 };
360
361
367 template<class CurveType> inline
368 std::unique_ptr<CurveType> Clone( const CurveType& curve ) noexcept{
369 return common::dynamic_unique_cast<CurveType>(curve.Clone());
370 }
371
372
378
383 bool dclspc Equals(
384 const std::pair<std::shared_ptr<const Curve>,common::Interval<Length>>& A,
385 const std::pair<std::shared_ptr<const Curve>,common::Interval<Length>>& B,
386 Length epsilon_length = epsilon__length,
387 Angle epsilon_angle = epsilon__angle );
388
393 bool dclspc Equals(
394 const Curve& A,
395 const Curve& B,
397 Length epsilon_length = epsilon__length ) noexcept;
399
400
402 dclspc const char* TypeToName( Curve::CurveType ct );
403
404
406 dclspc Curve::CurveType CurveNameToType( const std::string& name ) noexcept;
407
408
412 Length s;
415
416 inline bool operator<( const CurveSample& sample ) const noexcept{
417 return s < sample.s;
418 }
419
420 bool dclspc Equals( const CurveSample& sample, Length epsilon_length = epsilon__length, One epsilon_angle = epsilon__angle ) const noexcept;
421 };
422
423 inline bool operator<( Length s, const CurveSample& sample ) noexcept{
424 return s < sample.s;
425 }
426
427
434 struct CubicData{
437 CubicData() noexcept
439 b{25_m * spat::Ex<One>},
440 c{-15_m * spat::Ex<One> + 15_m * spat::Ey<One>},
441 d{10_m * spat::Ex<One> - 10_m * spat::Ey<One>}
442 {}
443
444 CubicData( const spat::Position<Length>& a, const spat::Vector<Length>& b, const spat::Vector<Length>& c, const spat::Vector<Length>& d ) noexcept
445 : a{a},
446 b{b},
447 c{c},
448 d{d}
449 {}
450
451 CubicData( const spat::VectorBundle<Length>& start, const spat::VectorBundle<Length>& end ) noexcept
452 : a{start.P},
453 b{start.T},
454 c{3_1*(end.P - start.P) - end.T - 2_1*start.T},
455 d{2_1*(start.P - end.P) + start.T + end.T}
456 {}
458
466
467 inline bool operator!=( const CubicData& other ) const noexcept{
468 return a != other.a ||
469 b != other.b ||
470 c != other.c ||
471 d != other.d;
472 }
473
474 inline bool operator==( const CubicData& other ) const noexcept{
475 return !operator!=( other );
476 }
477
478 inline spat::Position<Length> CubicPositionAtStart() const noexcept{
479 return a;
480 }
481 inline spat::Vector<Length> CubicOvershootAtStart() const noexcept{
482 return b;
483 }
484 inline spat::Position<Length> CubicPositionAtEnd() const noexcept{
485 return a + b + c + d;
486 }
487 inline spat::Vector<Length> CubicOvershootAtEnd() const noexcept{
488 return b + 2_1*c + 3_1*d;
489 }
490 };
491
492
498 struct Line : Curve{
499
501 static dclspc std::unique_ptr<Line> Make() noexcept;
502 };
503
504
511 struct LineP : Curve{
512
514 static dclspc std::unique_ptr<LineP> Make() noexcept;
515
516
523 struct Data{
524
527 Data() noexcept{
528 vb.Init();
529 }
530 Data( const spat::VectorBundle<Length,One>& vb, const spat::Vector<One>& up ) noexcept
531 : vb{vb}, up{up}{}
533
536 };
537
538
549
552
555 virtual void Create( const spat::VectorBundle<Length,One>& start, const spat::Vector<One>& up = Up ) = 0;
556
557 virtual void Create( const spat::VectorBundle2<Length,One>& start ) = 0;
558
559 virtual void Create( const spat::Frame<Length,One>& start ) = 0;
560
564 virtual void Create( const spat::Position<Length>& start, const spat::Vector<One>& tan, const spat::Vector<One>& up = Up ) = 0;
565
566 virtual common::Interval<Length> Create( const Data& data ) = 0;
568
569
572 virtual const Data& GetData() const noexcept = 0;
573 };
574
575
579
585 bool dclspc Equals( const LineP::Data& A, const LineP::Data& B, common::Interval<Length> range,
586 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle );
588
589
602 struct Arc : Curve{
603
605 static dclspc std::unique_ptr<Arc> Make() noexcept;
606
613 struct Data{
615
616 inline Length radius() const noexcept { return 1/k; }
617 };
618
619
627 virtual spat::Matrix<One,2,3> Jacobian( Length s ) const = 0;
628
629
633 virtual common::Interval<Length> Create( const Data& data ) = 0;
634
635
638 virtual const Data& GetData() const noexcept = 0;
639 };
640
641
644
649 bool dclspc Equals( const Arc::Data& A, const Arc::Data& B, Length epsilon_length = epsilon__length ) noexcept;
651
652
669 struct ArcP : Curve{
670
672 static dclspc std::unique_ptr<ArcP> Make() noexcept;
673
674
681 struct Data{
684 Data() noexcept{
685 vb2.Init();
686 vb2.N *= _m(10_m);
687 }
688 Data( Length radius ) noexcept{
689 vb2.Init();
690 vb2.N *= _m(radius);
691 }
692 Data( const spat::VectorBundle2<Length,One>& vb2 ) noexcept
693 : vb2{vb2}{}
695
697 };
698
699
701 virtual Length Radius() const noexcept = 0;
702
703
712 virtual spat::Matrix<One,2,3> Jacobian( Length s ) const = 0;
713
714
717
725 virtual void Create( const spat::VectorBundle2<Length,One>& center ) = 0;
726
727
734 virtual common::Interval<Length> Create( const spat::VectorBundle<Length,One>& start, const spat::Position<Length>& end, Angle e_angle = epsilon__angle ) = 0;
735
736
744 virtual common::Interval<Length> Create( const spat::Position<Length>& start, const spat::VectorBundle<Length,One>& end, Angle e_angle = epsilon__angle ) = 0;
745
746
754 virtual void Create( const spat::Position<Length>& start, const spat::Vector<One>& tan, const spat::Vector<One>& nor, AnglePerLength curvature ) = 0;
755
756
762 virtual void Create( const spat::VectorBundle2<Length,One>& start, AnglePerLength curvature ) = 0;
763
764
768 virtual common::Interval<Length> Create( const Data& data ) = 0;
770
771
774 virtual const Data& GetData() const noexcept = 0;
775 };
776
777
780
787 bool dclspc Equals( const ArcP::Data& A, const ArcP::Data& B, common::Interval<Length> range,
788 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle );
790
791
812 struct Helix : Curve{
813
815 static dclspc std::unique_ptr<Helix> Make() noexcept;
816
823 struct Data{
824 Data() noexcept
825 : k{0_1Im}, t{0_1Im}
826 {}
827 Data( AnglePerLength k, AnglePerLength t ) noexcept
828 : k{k}, t{t}
829 {}
830 Data( Length a, Length b ) noexcept
831 : k{a / (a*a + b*b)}, t{b / (a*a + b*b)}
832 {}
833
836
837 constexpr Length a() const noexcept { return k / (k*k + t*t); }
838 constexpr Length b() const noexcept { return t / (k*k + t*t); }
839 constexpr One slope() const noexcept { return b()/a(); };
840 };
841
842
856
857
861 virtual common::Interval<Length> Create( const Data& data ) = 0;
862
863
866 virtual const Data& GetData() const noexcept = 0;
867 };
868
869
872
877 bool dclspc Equals( const Helix::Data& A, const Helix::Data& B, Length epsilon_length = epsilon__length ) noexcept;
879
880
903 struct HelixP : Curve{
904
906 static dclspc std::unique_ptr<HelixP> Make() noexcept;
907
908
915 struct Data{
918 Data() noexcept
919 : a{10_m},
920 b{5_m/(2*pi)}
921 {
922 center.Init();
923 }
924 Data( Length radius, One slope ) noexcept
925 : a{radius},
926 b{radius*slope}
927 {
928 center.Init();
929 }
930 constexpr Data( const spat::VectorBundle2<Length,One>& center, Length a, Length b ) noexcept
931 : center{center},
932 a{a},
933 b{b}
934 {}
936
937
942
943 constexpr AnglePerLength Curvature() noexcept { return a / (a*a + b*b); }
944 constexpr AnglePerLength Torsion() noexcept { return b / (a*a + b*b); }
945 constexpr One Slope() const noexcept { return b/a; };
946 };
947
948
951 virtual spat::VectorBundle2<Length,One> Center() const noexcept = 0;
952
953
955 virtual Length Radius() const noexcept = 0;
956
957
959 virtual One Slope() const noexcept = 0;
960
961
969 virtual spat::SquareMatrix<One,3> Jacobian( Length s ) const = 0;
970
971
974
981 virtual void Create( const spat::Frame<Length,One>& start, AnglePerLength curvature, AnglePerLength torsion ) = 0;
982
983
992 virtual common::Interval<Length> Create( const spat::VectorBundle<Length,One>& start, const spat::Position<Length>& end, const spat::Vector<One>& up = Up, Angle e_angle = epsilon__angle ) = 0;
993
994
1002 virtual common::Interval<Length> Create( const spat::Position<Length>& start, const spat::VectorBundle<Length,One>& end, const spat::Vector<One>& up = Up, Angle e_angle = epsilon__angle ) = 0;
1003
1004
1011 virtual void Create( const spat::VectorBundle2<Length,One>& center, AnglePerLength curvature, AnglePerLength torsion ) = 0;
1012
1013
1017 virtual common::Interval<Length> Create( const Data& data ) = 0;
1019
1020
1023 virtual const Data& GetData() const noexcept = 0;
1024 };
1025
1026
1029
1036 bool dclspc Equals( const HelixP::Data& A, const HelixP::Data& B, common::Interval<Length> range,
1037 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle );
1039
1040
1067 struct Cubic : Curve{
1068
1070 static dclspc std::unique_ptr<Cubic> Make() noexcept;
1071
1072
1073 using Data = CubicData;
1074
1075
1080 virtual spat::Vector<Length> CubicOvershootAt( Length s ) const noexcept = 0;
1081
1082
1085
1091 virtual common::Interval<Length> Create( const spat::VectorBundle<Length,Length>& start, const spat::VectorBundle<Length,Length>& end ) = 0;
1092
1093
1101 virtual common::Interval<Length> CreateBezier( const spat::Position<Length>& P0, const spat::Position<Length>& P1, const spat::Position<Length>& P2, const spat::Position<Length>& P3 ) = 0;
1102
1103
1118 virtual std::pair<common::Interval<Length>,Length> Create( const Curve& originalCurve, common::Interval<Length> range, Length maxDeviation = epsilon__length ) = 0;
1119
1120
1125 virtual common::Interval<Length> Create( const Data& data ) = 0;
1127
1128
1138 virtual common::Interval<Length> Shorten( common::Interval<Length> toRange ) = 0;
1139
1140
1143 virtual const Data& GetData() const noexcept = 0;
1144 };
1145
1146
1149
1156 bool dclspc Equals( const Cubic::Data& A, const Cubic::Data& B, common::Interval<Length> range,
1157 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1159
1160
1162 struct Spline : Curve{
1163
1165 static dclspc std::unique_ptr<Spline> Make() noexcept;
1166
1167
1169 enum class WrapTypes{
1170 none = 0,
1171 nonperiodic,
1172 periodic,
1173 pinned
1174 };
1175
1183 using Data = std::vector<SegmentValueType>;
1184
1185
1187 virtual int CountControlPoints() const noexcept = 0;
1188
1189
1199 virtual common::Interval<Length> ResetControlPointAndTangent( int idx, const spat::VectorBundle<Length>& controlPointAndTangent ) = 0;
1200
1201
1206 virtual spat::VectorBundle<Length> GetControlPointAndTangent( int idx ) const = 0;
1207
1208
1212 virtual Length GetParameter( int idx ) const = 0;
1213
1214
1222 virtual int UpperBound( Length s ) const = 0;
1223
1224
1226 virtual bool HasGaps( Length epsilon = epsilon__length ) const noexcept = 0;
1227
1228
1230 virtual bool HasKinks( Angle epsilon = epsilon__angle ) const noexcept = 0;
1231
1232
1235
1245 virtual common::Interval<Length> Create( const Curve& originalCurve, common::Interval<Length> range, Length maxDeviation = epsilon__length, common::Interval<Length> sampleDistanceLimits = { 1_m, 1000_m } ) = 0;
1246
1247
1254 virtual common::Interval<Length> Create( std::pair<std::shared_ptr<const Curve>,common::Interval<Length>> originalCurve, Length maxDeviation = epsilon__length, common::Interval<Length> sampleDistanceLimits = { 1_m, 1000_m } ) = 0;
1255
1256
1263 virtual common::Interval<Length> Create( const std::vector<spat::VectorBundle<Length>>& controlPointsAndTangents ) = 0;
1264
1265
1273 virtual common::Interval<Length> Create( const std::vector<spat::Position<Length>>& controlPoints ) = 0;
1274
1275
1288 virtual common::Interval<Length> Create( const std::vector<spat::Position<Length>>& controlPoints, bool bClampedAtStart, const spat::Vector<Length>& startTangent, bool bClampedAtEnd, const spat::Vector<Length>& endTangent ) = 0;
1289
1290
1302 virtual common::Interval<Length> CreateCatmullRom( const std::vector<spat::Position<Length>>& controlPoints, One tension = 0.5f, WrapTypes wrap = WrapTypes::nonperiodic ) = 0;
1303
1304
1315 virtual common::Interval<Length> CreateCatmullRom( const std::vector<spat::VectorBundle<Length,One>>& controlPoints, One tension = 0.5f, WrapTypes wrap = WrapTypes::nonperiodic ) = 0;
1316
1317
1345 virtual common::Interval<Length> CreateBezier( const std::vector<spat::Position<Length>>& controlPoints, WrapTypes wrap = WrapTypes::nonperiodic ) = 0;
1346
1347
1352 virtual common::Interval<Length> Create( const Data& data ) = 0;
1354
1355
1366
1367
1370 virtual const Data& GetData() const noexcept = 0;
1371 };
1372
1373
1376
1383 bool dclspc Equals( const Spline::Data& A, const Spline::Data& B, common::Interval<Length> range,
1384 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1386
1387
1388
1393 struct Clothoid : Curve{
1394
1396 static dclspc std::unique_ptr<Clothoid> Make() noexcept;
1397
1398
1405 struct Data{
1406 Length a{ 100_m };
1407 };
1408
1409
1416 static Angle dclspc MaxAngle() noexcept;
1417
1418
1432
1434 dclspc Limits( AnglePerLength curvature0, AnglePerLength curvature1, Length length );
1435
1437 dclspc Limits( Length radius0, Length radius1, Length length );
1439
1440
1454 virtual spat::SquareMatrix<One,2> Jacobian( Length s ) const = 0;
1455
1456
1461
1465 virtual common::Interval<Length> Create( Area a2 ) = 0;
1466
1467
1475 virtual common::Interval<Length> Create( AnglePerLength curvature0, AnglePerLength curvature1, Length length ) = 0;
1476
1477
1482 virtual common::Interval<Length> Create( Length radius0, Length radius1, Length length ) = 0;
1483
1484
1488 virtual common::Interval<Length> Create( const Data& data ) = 0;
1490
1491
1494 virtual const Data& GetData() const noexcept = 0;
1495 };
1496
1497
1500
1507 bool dclspc Equals( const Clothoid::Data& A, const Clothoid::Data& B, common::Interval<Length> range,
1508 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle );
1510
1511
1568 struct Rotator : Curve{
1569
1571 static dclspc std::unique_ptr<Rotator> Make( CurveType type = CurveType::Rotator ) noexcept;
1572
1573
1586
1587
1595
1596
1600 virtual common::Interval<Length> Create( const Data& data ) = 0;
1601
1602
1605 virtual const Data& GetData() const noexcept = 0;
1606 };
1607
1608
1611
1618 bool dclspc Equals( const Rotator::Data& A, const Rotator::Data& B, common::Interval<Length> range,
1619 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1621
1622
1631 struct RotatorChain : Curve{
1632
1634 static dclspc std::unique_ptr<RotatorChain> Make() noexcept;
1635
1636 using SegmentValueType = std::tuple<Angle,Angle,Length>;
1641 using Data = std::vector<SegmentValueType>;
1642
1643
1646
1653 virtual common::Interval<Length> Create( const spat::Vector<Length>& advance ) = 0;
1654
1655
1659 virtual common::Interval<Length> Create( const Data& data ) = 0;
1661
1664 virtual const Data& GetData() const noexcept = 0;
1665 };
1666
1667
1670
1677 bool dclspc Equals( const RotatorChain::Data& A, const RotatorChain::Data& B, common::Interval<Length> range,
1678 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1680
1681
1682 struct Track;
1683
1688 {
1689 struct Data{
1690 const Track* pTrack = nullptr;
1691 spat::Vector2D<Length> d = { 0_m, 0_m };
1692 };
1693
1696 virtual common::Interval<Length> Create( const Data& data ) = 0;
1697
1698
1701 virtual const Data& GetData() const noexcept = 0;
1702
1703 virtual Length OriginalParameterFrom( Length sParallelParameter ) const noexcept = 0;
1704
1705 virtual Length ParallelParameterFrom( Length sOriginalParameter ) const noexcept = 0;
1706
1707 virtual bool IsTrackRelative() const noexcept = 0;
1708 };
1709
1710
1713
1720 bool dclspc Equals( const PointToPointParallel::Data& A, const PointToPointParallel::Data& B, common::Interval<Length> range,
1721 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1723
1724
1744 struct PolygonalChain : Curve{
1745
1747 static dclspc std::unique_ptr<PolygonalChain> Make() noexcept;
1748
1749
1751 enum class WrapTypes{
1752 none = 0,
1753 nonperiodic,
1754 periodic,
1755 };
1756
1758 using Data = std::vector<SegmentValueType>;
1759
1762 virtual Length GetParameter( int idx ) const = 0;
1763
1764
1772 virtual int UpperBound( Length s ) const = 0;
1773
1774
1777
1788 virtual common::Interval<Length> Create( const Curve& originalCurve, common::Interval<Length> range, Length maxDeviation, Length minPointDistance ) = 0;
1789
1790
1798 virtual common::Interval<Length> Create( std::pair<std::shared_ptr<const Curve>, common::Interval<Length>> originalCurve, Length maxDeviation, Length minPointDistance ) = 0;
1799
1800
1807 virtual common::Interval<Length> Create( const std::vector<spat::Position<Length>>& samples, WrapTypes wrap = WrapTypes::nonperiodic ) = 0;
1808
1809
1816 virtual common::Interval<Length> CreateCatmullRom( const std::vector<spat::Position<Length>>& samples, WrapTypes wrap = WrapTypes::nonperiodic ) = 0;
1817
1818
1823 virtual common::Interval<Length> Create( const Data& data ) = 0;
1825
1826
1829 virtual const Data& GetData() const noexcept = 0;
1830 };
1831
1832
1835
1842 bool dclspc Equals( const PolygonalChain::Data& A, const PolygonalChain::Data& B, common::Interval<Length> range,
1843 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle );
1845
1846
1856 struct SampledCurve : Curve{
1857
1859 static dclspc std::unique_ptr<SampledCurve> Make() noexcept;
1860
1861
1862 using Data = std::vector<CurveSample>;
1863
1864
1872 virtual int UpperBound( Length s ) const = 0;
1873
1874
1877
1888 virtual common::Interval<Length> Create( const Curve& originalCurve, common::Interval<Length> range, Length maxDeviationLength = epsilon__length, Angle maxDeviationAngle = epsilon__angle, common::Interval<Length> sampleDistanceLimits = { epsilon__length, 20_m } ) = 0;
1889
1890
1897 virtual common::Interval<Length> Create( std::pair<std::shared_ptr<const Curve>,common::Interval<Length>> originalCurve, Length maxDeviationLength = epsilon__length, Angle maxDeviationAngle = epsilon__angle, common::Interval<Length> sampleDistanceLimits = { epsilon__length, 20_m } ) = 0;
1898
1899
1905 virtual common::Interval<Length> Create( const Data& data ) = 0;
1907
1908
1911 virtual const Data& GetData() const noexcept = 0;
1912 };
1913
1914
1917
1924 bool dclspc Equals( const SampledCurve::Data& A, const SampledCurve::Data& B, common::Interval<Length> range,
1925 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle ) noexcept;
1927
1928
1932 struct EEPCurve : Curve {
1933
1935 static dclspc std::unique_ptr<EEPCurve> Make(CurveType type = CurveType::EEPCurve) noexcept;
1936
1937
1944 struct Data {
1946
1947 Data() noexcept
1948 : gc_Kruemmung{ 0 },
1949 gc_Windung{ 0 },
1950 gc_Verdrillung{ 0 },
1951 gc_Laenge{ _cm(10_m) }, //cm
1952 gc_Kurve{ 0 },
1953 m_FuehrungsVerdrehung{ 0 }
1954 {
1955 m_AnfangsBein.Init();
1956 }
1957
1958
1959 Data(const Data&) noexcept = default;
1960 Data& operator=(const Data&) noexcept = default;
1961
1962 bool operator==(const Data& data) const noexcept {
1963 return gc_Kruemmung == data.gc_Kruemmung &&
1964 gc_Windung == data.gc_Windung &&
1965 gc_Verdrillung == data.gc_Verdrillung &&
1966 gc_Laenge == data.gc_Laenge &&
1967 gc_Kurve == data.gc_Kurve &&
1968 m_FuehrungsVerdrehung == data.m_FuehrungsVerdrehung &&
1969 m_AnfangsBein == data.m_AnfangsBein;
1970 }
1971
1972
1974
1983 };
1984
1985
1991 //virtual common::Interval<Length> Create( const spat::Frame<Length,One>& start, const spat::Position<Length>& end ) = 0;
1992
1993
1997 virtual common::Interval<Length> Create(const Data& data) = 0;
1998
1999
2002 virtual const Data& GetData() const noexcept = 0;
2003 };
2004
2005
2008
2015 bool dclspc Equals(const EEPCurve::Data& A, const EEPCurve::Data& B, common::Interval<Length> range,
2016 Length epsilon_length = epsilon__length, Angle epsilon_angle = epsilon__angle) noexcept;
2018
2019
2023 std::unique_ptr<Curve> dclspc CreateNonEEPCurve(const EEPCurve::Data& fromEEPCurveData);
2024
2025
2037
2045 Angle dclspc TotalAngle( const Curve& curve, common::Interval<Length> range, Angle accuracy = epsilon__angle );
2046
2054 Angle dclspc TotalAngle( std::pair<std::shared_ptr<const Curve>,common::Interval<Length>> curve, Angle accuracy = epsilon__angle );
2056
2057
2079
2081 std::pair<std::unique_ptr<Curve>,common::Interval<Length>> dclspc CreateCurve(
2082 const spat::Position<Length>& start,
2083 const spat::Position<Length>& end,
2084 const spat::Vector<One>& up );
2085
2088 std::pair<std::unique_ptr<Curve>,common::Interval<Length>> dclspc CreateCurve(
2089 spat::VectorBundle<Length,One> start,
2090 const spat::Position<Length>& end,
2091 const spat::Vector<One>& up, Length e_length = epsilon__length );
2092
2095 std::pair<std::unique_ptr<Curve>,common::Interval<Length>> dclspc CreateCurve(
2096 const spat::Position<Length>& start,
2097 spat::VectorBundle<Length,One> end,
2098 const spat::Vector<One>& up, Length e_length = epsilon__length );
2099
2101 std::pair<std::unique_ptr<Curve>,common::Interval<Length>> dclspc CreateCurve(
2102 const spat::VectorBundle<Length,One>& start,
2103 const spat::VectorBundle<Length,One>& end,
2104 const spat::Vector<One>& up, Length e_length = epsilon__length, Angle e_angle = epsilon__angle );
2106
2107
2119
2120 std::pair<std::unique_ptr<Curve>, common::Interval<Length>> dclspc CreateCurve( Curve::CurveType type, std::pair<std::shared_ptr<const Curve>,common::Interval<Length>> fromCurve );
2121
2122 std::pair<std::unique_ptr<Curve>,common::Interval<Length>> dclspc CreateCurve( Curve::CurveType type, const Curve& fromCurve, common::Interval<Length> range );
2123
2124 std::pair<std::unique_ptr<Line>,common::Interval<Length>> dclspc CreateLine( const Curve& fromCurve, common::Interval<Length> range );
2125
2126 std::pair<std::unique_ptr<LineP>,common::Interval<Length>> dclspc CreateLineP( const Curve& fromCurve, common::Interval<Length> range );
2127
2128 std::pair<std::unique_ptr<Arc>,common::Interval<Length>> dclspc CreateArc( const Curve& fromCurve, common::Interval<Length> range );
2129
2130 std::pair<std::unique_ptr<ArcP>,common::Interval<Length>> dclspc CreateArcP( const Curve& fromCurve, common::Interval<Length> range );
2131
2132 std::pair<std::unique_ptr<Helix>,common::Interval<Length>> dclspc CreateHelix( const Curve& fromCurve, common::Interval<Length> range );
2133
2134 std::pair<std::unique_ptr<HelixP>,common::Interval<Length>> dclspc CreateHelixP( const Curve& fromCurve, common::Interval<Length> range );
2135
2136 std::pair<std::unique_ptr<Cubic>,common::Interval<Length>> dclspc CreateCubic( const Curve& fromCurve, common::Interval<Length> range );
2137
2138 std::pair<std::unique_ptr<Spline>,common::Interval<Length>> dclspc CreateSpline( const Curve& fromCurve, common::Interval<Length> range );
2139
2140 std::pair<std::unique_ptr<Clothoid>,common::Interval<Length>> dclspc CreateClothoid( const Curve& fromCurve, common::Interval<Length> range );
2141
2142 std::pair<std::unique_ptr<Rotator>,common::Interval<Length>> dclspc CreateRotator( const Curve& fromCurve, common::Interval<Length> range );
2143
2144 std::pair<std::unique_ptr<Rotator>,common::Interval<Length>> dclspc CreateRotatorWithOffset( const Curve& fromCurve, common::Interval<Length> range );
2145
2146 std::pair<std::unique_ptr<RotatorChain>,common::Interval<Length>> dclspc CreateRotatorChain( const Curve& fromCurve, common::Interval<Length> range );
2147
2148 std::pair<std::unique_ptr<PolygonalChain>,common::Interval<Length>> dclspc CreatePolygonalChain( const Curve& fromCurve, common::Interval<Length> range );
2150
2151
2160 struct CurvatureStrecher{
2161
2165 static dclspc const CurvatureStrecher* InterfaceFrom( const Curve& curve ) noexcept;
2166
2167 static dclspc CurvatureStrecher* InterfaceFrom( Curve& curve ) noexcept;
2169
2170
2172 virtual spat::Vector<One> Direction( Length s ) const = 0;
2173
2174 virtual AnglePerLength Start( Length s, const spat::Position<Length>& Z, common::Interval<AnglePerLength> curvatureLimits = {epsilon__angle/maximum__length,180_deg/epsilon__length} ) = 0;
2175
2176 virtual AnglePerLength Strech( Length s, const spat::Position<Length>& Z ) = 0;
2177
2178
2179 virtual ~CurvatureStrecher() = default;
2181 CurvatureStrecher& operator=( const CurvatureStrecher& ) = delete;
2182 CurvatureStrecher& operator=( CurvatureStrecher&& ) = delete;
2183 protected:
2184 CurvatureStrecher() = default;
2185 CurvatureStrecher( const CurvatureStrecher& ) = default;
2186 };
2187}
Matrix template for arbitrary dimensions and value type.
Definition Matrix.h:63
Square matrix with nColumns == nRows.
Definition Matrix.h:278
std::pair< std::unique_ptr< Curve >, common::Interval< Length > > dclspc CreateCurve(const spat::Position< Length > &start, const spat::Position< Length > &end, const spat::Vector< One > &up)
Will create a Line. Guarantees start and end.
Namespace of common utility classes and methods.
Definition Helpers.h:43
constexpr bool operator!=(const Interval< Valtype > &i1, const Interval< Valtype > &i2) noexcept
Interval operator.
Definition Interval.h:701
constexpr bool operator==(const Interval< Valtype > &i1, const Interval< Valtype > &i2) noexcept
Interval operator.
Definition Interval.h:696
constexpr bool Equals(T a, T b, T epsilon) noexcept
Tests equality in the sense |a-b| < epsilon.
Definition Helpers.h:66
constexpr bool operator<(const Interval< Valtype > &i1, const Interval< Valtype > &i2) noexcept
Definition Interval.h:657
Value< Dimension< 2, 0, 0 > > Area
Area.
Definition DimensionedValues.h:325
constexpr Real _1(One one) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1186
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
constexpr Real _1Im(AnglePerLength a) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1347
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
constexpr Angle pi
Circle number pi.
Definition DimensionedValues.h:1145
constexpr Real _m(Length l) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1210
Value< Dimension<-1, 0, 0 > > AnglePerLength
Angle per length.
Definition DimensionedValues.h:321
float Real
Underlying floating point type to be used with the dim library.
Definition DimensionedValues.h:190
constexpr Real epsilon
Marginal difference in calculations.
Definition DimensionedValues.h:344
constexpr Real _deg(Angle a) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1194
Value< Dimension< 0, 0, 0 > > Angle
Angle in radians.
Definition DimensionedValues.h:320
constexpr Value< Dimension< 0, 0, 0 > > tan(Value< Dimension< 0, 0, 0 > > a) noexcept
Dimensionated Values math function.
Definition DimensionedValues.h:702
The namespace provides classes and methods for spatial computations.
Definition Box.h:32
constexpr Position< Valtype > Origin3D
Origin of coordinate system.
Definition Position.h:143
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
bool dclspc Strech(TrackBuilder &track, spat::VectorBundle< Length, One > start, spat::VectorBundle< Length, One > end, common::Interval< Length > length_limits={0_m,+infinite__length}, common::Interval< Length > overshoot_limits={ 0_m,+infinite__length }, const spat::Vector< One > &up=Up, Length e_length=epsilon__length, Angle e_angle=epsilon__angle)
dclspc Curve::CurveType CurveNameToType(const std::string &name) noexcept
Gets the type enumerator of a curve from its type name.
dclspc const char * TypeToName(Curve::CurveType ct)
Gets the type name of a curve from its type enumerator.
constexpr spat::Vector< One > Up
Vector pointing in the up direction with respect to gravity.
Definition Units.h:144
std::unique_ptr< Curve > dclspc CreateNonEEPCurve(const EEPCurve::Data &fromEEPCurveData)
Creates a matching Curve from the data that is not an EEPCurve.
Angle dclspc TotalAngle(const Curve &curve, common::Interval< Length > range, Angle accuracy=epsilon__angle)
std::unique_ptr< CurveType > Clone(const CurveType &curve) noexcept
Creates a clone of the given curve.
Definition Curve.h:368
An interval describes the area between two numbers. It is understood to contain the near one and exlu...
Definition Interval.h:42
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
Implements a 3D - position in cartesian coordinates.
Definition Position.h:46
Implements a 2D - vector in cartesian coordinates.
Definition Vector2D.h:46
Implements a tangential space bundle.
Definition VectorBundle2.h:43
Implements a Vector bundle.
Definition VectorBundle.h:42
Position< Valtype > P
Base space postion.
Definition VectorBundle.h:43
Vector< ValtypeT > T
Tangent vector or x-axis.
Definition VectorBundle.h:44
Implements a 3D - vector in cartesian coordinates.
Definition Vector.h:48
Data definig the curve.
Definition Curve.h:613
AnglePerLength k
Curvature of the arc.
Definition Curve.h:614
Length radius() const noexcept
Radius of Arc.
Definition Curve.h:616
A plane arc.
Definition Curve.h:602
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
static dclspc std::unique_ptr< Arc > Make() noexcept
Makes a Arc object.
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen e....
virtual spat::Matrix< One, 2, 3 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P to the curves radius r and parameter s in a matrix,...
Data definig the curve.
Definition Curve.h:681
spat::VectorBundle2< Length, One > vb2
Center point, tangent and normal of the arc. The curve radius is the length of vb2....
Definition Curve.h:696
A plane arc with owned parameters.
Definition Curve.h:669
static dclspc std::unique_ptr< ArcP > Make() noexcept
Makes a ArcP object.
virtual void Create(const spat::VectorBundle2< Length, One > &center)=0
Creates an Arc.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual Length Radius() const noexcept=0
virtual spat::Matrix< One, 2, 3 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P-C to the curve radius r and parameter s in a matrix...
Data defining the curve.
Definition Curve.h:1405
Length a
Single parameter to specify a clothoid.
Definition Curve.h:1406
Curve with linear increasing curvature. Also called 'Euler Spiral'.
Definition Curve.h:1393
virtual common::Interval< Length > Create(Area a2)=0
Create a clothoid with a*a.
static Angle dclspc MaxAngle() noexcept
Gets a limiting angle value.
virtual spat::SquareMatrix< One, 2 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P to the parameters a and s in a matrix,...
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
static dclspc std::unique_ptr< Clothoid > Make() noexcept
Makes a Clothoid object.
Data definig a cubic curve.
Definition Curve.h:434
spat::Vector< Length > c
Definition Curve.h:463
spat::Position< Length > a
Definition Curve.h:461
spat::Vector< Length > b
Definition Curve.h:462
spat::Vector< Length > d
Definition Curve.h:464
Cubic polynom curve.
Definition Curve.h:1067
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual common::Interval< Length > CreateBezier(const spat::Position< Length > &P0, const spat::Position< Length > &P1, const spat::Position< Length > &P2, const spat::Position< Length > &P3)=0
Cubic from Cubic Bezier control points.
virtual spat::Vector< Length > CubicOvershootAt(Length s) const noexcept=0
Gets the first derivative (with respect to the internal parameter u) of the Cubic function at arc len...
virtual common::Interval< Length > Create(const spat::VectorBundle< Length, Length > &start, const spat::VectorBundle< Length, Length > &end)=0
Create the Cubic.
CubicData Data
Data definig the curve.
Definition Curve.h:1073
static dclspc std::unique_ptr< Cubic > Make() noexcept
Makes a Cubic object.
virtual common::Interval< Length > Shorten(common::Interval< Length > toRange)=0
Transforms the Cubic to one with the given parameter range.
Interface for streching the curvature of a curve, by trying to reach an end point Z,...
Definition Curve.h:2160
virtual spat::Vector< One > Direction(Length s) const =0
Curves implement this interface that then can get attached to a track to define the tracks geometry.
Definition Curve.h:198
virtual AnglePerLength Torsion(Length s) const =0
virtual bool Mirror(const spat::VectorBundle< Length, One > &mirrorPlane)=0
Make a Curve with mirrored geometry (but of course one thet returns right handed frames).
virtual std::vector< Length > ZeroSet() const =0
Returns a list of parameters at which the normal vector flips from one side to the other.
virtual common::Interval< Length > Range() const =0
virtual bool IsValid() const noexcept=0
virtual spat::Frame< Length, One > GetCurveLocalTransformation() const =0
virtual std::unique_ptr< Curve > Clone() const =0
make an exact copy of this curve.
virtual bool IsFlat() const noexcept=0
virtual bool Equals(const Curve &toCurve, common::Interval< Length > range, Length epsilon_length=epsilon__length, Angle epsilon_angle=epsilon__angle) const =0
Comparison.
virtual spat::Vector< One > LocalUp() const =0
Gives the Curve's idiosyncratic up direction. Some curves maintain some idea about where they have th...
virtual CurveType GetCurveType() const noexcept=0
virtual AnglePerLength Curvature(Length s) const =0
virtual void Transition(Length s, spat::Position< Length > &pos) const =0
Copies the 3D Position at the specified location to pos.
CurveType
Curve type identification values.
Definition Curve.h:201
@ EEPAlternative
Definition Curve.h:221
@ EEPCurve
Definition Curve.h:218
@ EEPResidual
Arc length parametrized EEP curve, but only for u != 0, l!= 0 and k²+w² != 0.
Definition Curve.h:220
@ Rotator
A curve with linearly rotating tangent vector.
Definition Curve.h:212
@ RotatorWithOffset
A Rotator curve that starts with certain offset angles.
Definition Curve.h:213
virtual const char * TypeName() const noexcept=0
The dynamic data of a curve at one point.
Definition Curve.h:410
Data definig the curve.
Definition Curve.h:1944
Data() noexcept
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1947
Real gc_Laenge
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1978
Real gc_Windung
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1976
Real gc_Kurve
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1979
Data & operator=(const Data &) noexcept=default
data for EEPCurve. Lengthes in cm.
Real gc_Kruemmung
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1975
bool operator==(const Data &data) const noexcept
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1962
spat::Frame< Real > m_AnfangsBein
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1981
Real gc_Verdrillung
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1977
Data(const Data &) noexcept=default
data for EEPCurve. Lengthes in cm.
Real m_FuehrungsVerdrehung
data for EEPCurve. Lengthes in cm.
Definition Curve.h:1980
Idiosyncratic curve used in EEP up to version 16.
Definition Curve.h:1932
static dclspc std::unique_ptr< EEPCurve > Make(CurveType type=CurveType::EEPCurve) noexcept
Makes a EEPCurve object.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual common::Interval< Length > Create(const Data &data)=0
Create a curve from start and end point.
Data definig the curve.
Definition Curve.h:823
constexpr Length a() const noexcept
radius
Definition Curve.h:837
AnglePerLength k
Curvature of the helix.
Definition Curve.h:834
constexpr Length b() const noexcept
b == a * slope
Definition Curve.h:838
AnglePerLength t
Torsion of the helix.
Definition Curve.h:835
A three dimensional spiral.
Definition Curve.h:812
virtual common::Interval< Length > Create(const Data &data)=0
Create the Helix from data set for wich it is guaranteed, that no calculational drift will happen e....
static dclspc std::unique_ptr< Helix > Make() noexcept
Makes a Helix object.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual spat::SquareMatrix< One, 3 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P to the parameters a, b and s in a matrix,...
Data definig the curve.
Definition Curve.h:915
Length a
radius (not curve radius)
Definition Curve.h:940
spat::VectorBundle2< Length, One > center
Definition Curve.h:938
Length b
b/a == tan(alpha) : slope
Definition Curve.h:941
A three dimensional spiral with owned parameters.
Definition Curve.h:903
virtual spat::VectorBundle2< Length, One > Center() const noexcept=0
static dclspc std::unique_ptr< HelixP > Make() noexcept
Makes a HelixP object.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual spat::SquareMatrix< One, 3 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P to the parameters a, b and s in a matrix,...
virtual Length Radius() const noexcept=0
virtual One Slope() const noexcept=0
virtual void Create(const spat::Frame< Length, One > &start, AnglePerLength curvature, AnglePerLength torsion)=0
Create the Helix.
A straight line.
Definition Curve.h:498
static dclspc std::unique_ptr< Line > Make() noexcept
Makes a Line object.
Data definig the curve.
Definition Curve.h:523
spat::VectorBundle< Length, One > vb
Position of parameter s=0 and tangent of the line.
Definition Curve.h:534
spat::Vector< One > up
Up direction.
Definition Curve.h:535
A straight line with owned parameters.
Definition Curve.h:511
virtual common::Interval< Length > Create(const spat::Position< Length > &start, const spat::Position< Length > &end, const spat::Vector< One > &up=Up)=0
Creates a straight line.
virtual void Create(const spat::Position< Length > &start, const spat::Vector< One > &tan, const spat::Vector< One > &up=Up)=0
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
static dclspc std::unique_ptr< LineP > Make() noexcept
Makes a LineP object.
virtual common::Interval< Length > Create(const Data &data)=0
Creates a straight line.
virtual void Create(const spat::VectorBundle< Length, One > &start, const spat::Vector< One > &up=Up)=0
virtual void Create(const spat::Frame< Length, One > &start)=0
Creates a straight line.
virtual void Create(const spat::VectorBundle2< Length, One > &start)=0
Creates a straight line.
Definition Curve.h:1689
A Curve parallel to a given track.
Definition Curve.h:1688
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen e....
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
A series of samples of points and tangents that make up a curve.
Definition Curve.h:1744
virtual common::Interval< Length > Create(std::pair< std::shared_ptr< const Curve >, common::Interval< Length > > originalCurve, Length maxDeviation, Length minPointDistance)=0
virtual common::Interval< Length > Create(const Curve &originalCurve, common::Interval< Length > range, Length maxDeviation, Length minPointDistance)=0
Creates a polygonal chain from an existing curve.
virtual Length GetParameter(int idx) const =0
virtual int UpperBound(Length s) const =0
The index of the polygonal vertex that is the first one to have greater parameter than s.
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen e....
static dclspc std::unique_ptr< PolygonalChain > Make() noexcept
Makes a PolygonalChain object.
virtual common::Interval< Length > Create(const std::vector< spat::Position< Length > > &samples, WrapTypes wrap=WrapTypes::nonperiodic)=0
Creates a polygonal chain from a list of sample points.
WrapTypes
Type of handling the ends:
Definition Curve.h:1751
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
spat::VectorBundle< Length, One > SegmentValueType
Type of the segments.
Definition Curve.h:1757
virtual common::Interval< Length > CreateCatmullRom(const std::vector< spat::Position< Length > > &samples, WrapTypes wrap=WrapTypes::nonperiodic)=0
Creates a polygonal chain from a list of sample points.
Data definig the curve.
Definition Curve.h:1580
Angle a0
Starting angle in the plain.
Definition Curve.h:1583
AnglePerLength b
Angular factor to rotate towards the up direction.
Definition Curve.h:1582
Angle b0
Starting angle.
Definition Curve.h:1584
AnglePerLength a
Angular factor to rotate in the plain.
Definition Curve.h:1581
A series of Rotator curves that continue each other.
Definition Curve.h:1631
std::vector< SegmentValueType > Data
Data defining the curve.
Definition Curve.h:1641
virtual common::Interval< Length > Create(const spat::Vector< Length > &advance)=0
Create a RotatorChain that starts and ends with the same tangent and advances by the given vector.
static dclspc std::unique_ptr< RotatorChain > Make() noexcept
Makes a RotatorChain object.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
Curve with evenly (with respect to arc length) rotating tangent vector.
Definition Curve.h:1568
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen e....
static dclspc std::unique_ptr< Rotator > Make(CurveType type=CurveType::Rotator) noexcept
Makes a Rotator object.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual spat::SquareMatrix< Real, 3 > Jacobian(Length s) const =0
Returns the partial derivatives of the position P to the parameters a, b and s in a matrix,...
A curve given by Fi,ki,ti,si samples of a real curveT.
Definition Curve.h:1856
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen e....
virtual int UpperBound(Length s) const =0
The index of the sample that is the first one to have greater parameter than s.
virtual common::Interval< Length > Create(const Curve &originalCurve, common::Interval< Length > range, Length maxDeviationLength=epsilon__length, Angle maxDeviationAngle=epsilon__angle, common::Interval< Length > sampleDistanceLimits={ epsilon__length, 20_m })=0
Creates a sampled curve from an existing curve.
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
static dclspc std::unique_ptr< SampledCurve > Make() noexcept
Makes a SampledCurve object.
virtual common::Interval< Length > Create(std::pair< std::shared_ptr< const Curve >, common::Interval< Length > > originalCurve, Length maxDeviationLength=epsilon__length, Angle maxDeviationAngle=epsilon__angle, common::Interval< Length > sampleDistanceLimits={ epsilon__length, 20_m })=0
\ brief Cubic Hermite Spline.
Definition Curve.h:1162
virtual common::Interval< Length > Create(const Data &data)=0
Create the curve from data set for which it is guaranteed, that no calculational drift will happen,...
virtual common::Interval< Length > Create(const std::vector< spat::Position< Length > > &controlPoints)=0
Natural Cubic C2 - smooth Spline (points, tangent, normal and curvature of the segments match).
CubicData SegmentValueType
Definition Curve.h:1176
virtual common::Interval< Length > Create(const std::vector< spat::Position< Length > > &controlPoints, bool bClampedAtStart, const spat::Vector< Length > &startTangent, bool bClampedAtEnd, const spat::Vector< Length > &endTangent)=0
Clamped Cubic C2 - smooth Spline (points, tangent, normal and curvature of the segments match).
WrapTypes
Type of handling the ends:
Definition Curve.h:1169
std::vector< SegmentValueType > Data
Data definig the curve.
Definition Curve.h:1183
virtual common::Interval< Length > Create(const Curve &originalCurve, common::Interval< Length > range, Length maxDeviation=epsilon__length, common::Interval< Length > sampleDistanceLimits={ 1_m, 1000_m })=0
Creates a spline curve from an existing curve.
virtual common::Interval< Length > Shorten(common::Interval< Length > toRange)=0
Transforms the Spline to one with the given parameter range.
virtual common::Interval< Length > ResetControlPointAndTangent(int idx, const spat::VectorBundle< Length > &controlPointAndTangent)=0
Resets a control point.
virtual spat::VectorBundle< Length > GetControlPointAndTangent(int idx) const =0
static dclspc std::unique_ptr< Spline > Make() noexcept
Makes a Spline object.
virtual Length GetParameter(int idx) const =0
virtual bool HasGaps(Length epsilon=epsilon__length) const noexcept=0
Check smoothness of the curve at the control points.
virtual common::Interval< Length > CreateBezier(const std::vector< spat::Position< Length > > &controlPoints, WrapTypes wrap=WrapTypes::nonperiodic)=0
C0 Spline from Cubic Bezier control points.
virtual common::Interval< Length > CreateCatmullRom(const std::vector< spat::Position< Length > > &controlPoints, One tension=0.5f, WrapTypes wrap=WrapTypes::nonperiodic)=0
C1 Spline with Pi'th tangent being: tension * (Pi+1 - Pi-1).
virtual common::Interval< Length > CreateCatmullRom(const std::vector< spat::VectorBundle< Length, One > > &controlPoints, One tension=0.5f, WrapTypes wrap=WrapTypes::nonperiodic)=0
C1 Spline with Pi'th tangent being: tension * (Pi+1 - Pi-1).Length() * Ti.
virtual int UpperBound(Length s) const =0
The index of the control point that is the first one to have greater parameter than s.
virtual bool HasKinks(Angle epsilon=epsilon__angle) const noexcept=0
Check smoothness of the tangets of the curve at the control points.
virtual int CountControlPoints() const noexcept=0
virtual const Data & GetData() const noexcept=0
Retrieves the data to construct this curve type. A roundtrip is guaranteed to be invariant.
virtual common::Interval< Length > Create(std::pair< std::shared_ptr< const Curve >, common::Interval< Length > > originalCurve, Length maxDeviation=epsilon__length, common::Interval< Length > sampleDistanceLimits={ 1_m, 1000_m })=0
virtual common::Interval< Length > Create(const std::vector< spat::VectorBundle< Length > > &controlPointsAndTangents)=0
Creates a Cubic Hermite Spline, guaranteed to be C1 (points and tangents match).
Interface for a track used to calculate 3D positions.
Definition Track.h:275