OpenLexocad  27.0
Clothoid2d.h
Go to the documentation of this file.
1 #ifndef CLOTHOID2D_H
2 #define CLOTHOID2D_H
3 
4 #include <Geom/Ax2d.h>
5 #include <Geom/XY.h>
6 #include <Geom/geom_defines.h>
7 
8 #include <vector>
9 
10 namespace Geom
11 {
12 /*
13  "The clothoid is the standard transition curve used in railroad engineering/highway engineering for connecting a straight and a circular curve.
14  A clothoid has a CONSTANT INCREASING curvature proportional to its curve length.
15  Two input parameters are required : the radius R and the parameter A. Suggested values of A : R / 3 <= A <= R.
16  All clothoids are geometrically similar : as with the radius R, the parameter A serves as a modification factor(enlargement / reduction).
17  For practical applications, a clothoid is viewed in the *1st quadrant* of the coordinate system."
18  The smaller the parameter A is, the faster the curvature increases.The length of the transition arc L grows with the parameter A.
19  (Source "Fundamentals of Road Design" - ISBN 9781845643362)
20 */
22 {
23 public:
24  Clothoid2d();
25  Clothoid2d(const double& R, const double& A);
26  Clothoid2d(const Clothoid2d& other);
27  Clothoid2d(Clothoid2d&& other);
28  Clothoid2d& operator=(const Clothoid2d& other);
29  Clothoid2d& operator=(Clothoid2d&& other);
30  ~Clothoid2d() = default;
31 
33  double getR() const;
34  void setR(const double& R);
36  double getA() const;
37  void setA(const double& A);
38 
40  double computeTauFromRA() const;
41 
43  double getDeltaR(const double& tau) const;
45  double getLength(const double& tau) const;
47  double getTau(const double& L) const;
48 
50  Geom::XY getCoordinate(const double& L) const;
52  Geom::XY getCenter(const double& L) const;
53 
55  double computeTk() const;
57  double computeTl() const;
58 
59  std::vector<Geom::XY> approximate(const unsigned int& segments) const;
60 
61 private:
62  double _R; // Radius
63  double _A; // Constant A
64 
65  // Helper function to compute the angle between Ax2d-Direction and the X-Axis.
66  static double getAngle(const Geom::Ax2d& position);
67  // Helper function to compute a Pnt2d given an Ax2d (origin, direction) and a distance u along the direction.
68  static Geom::Pnt2d lineValue(const double& u, const Geom::Ax2d& ax2);
69  // Helper function to rotate a XY coordinate around (0., 0.) about angle.
70  static Geom::XY rotate2D(const Geom::XY& xy, const double& angle);
71 };
72 } // namespace Geom
73 
74 #endif /* CLOTHOID2D_H */
Definition: Rotation.h:5
Definition: XY.h:35
Definition: Ax2d.h:48
#define GEOM_EXPORT
Definition: geom_defines.h:8
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33
Definition: Clothoid2d.h:21