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