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