Class ClothoidCurve

Inheritance Relationships

Base Type

Class Documentation

class G2lib::ClothoidCurve : public G2lib::BaseCurve

Class to manage Clothoid Curve. A clothoid curve is described by the following generalized Fresnel integrals

\[\begin{split} \begin{cases} x(s) = x_0 + \displaystyle\int_0^s \cos(as^2+bs+c) \mathrm{d}t \\[1em] y(s) = y_0 + \displaystyle\int_0^s \sin(as^2+bs+c) \mathrm{d}t \end{cases} \end{split}\]

../_images/G1problem.jpg

Public Functions

inline ClothoidCurve()

Build an empty clothoid curve

inline ClothoidCurve(ClothoidCurve const &s)

Build a copy of an existing clothoid curve

inline explicit ClothoidCurve(real_type x0, real_type y0, real_type theta0, real_type k, real_type dk, real_type L)

Construct a clothoid with the standard parameters.

Parameters
  • x0[in] starting position x-coordinate

  • y0[in] starting position y-coordinate

  • theta0[in] initial angle

  • k[in] curvature

  • dk[in] curvature derivative

  • L[in] length

inline explicit ClothoidCurve(real_type const *P0, real_type theta0, real_type const *P1, real_type theta1)

Construct a clothoid \( \G(s) \) solving the G1 problem.

\[\begin{split} \begin{cases} G(0) = \mathbf{p}_0 & \\[1em] G(L) = \mathbf{p}_1 & \\[1em] G'(0) = (\cos\theta_0,\sin\theta_0)^T & \\[1em] G'(L) = (\cos\theta_1,\sin\theta_1)^T & \\[1em] \end{cases} \end{split}\]
Parameters
  • P0[in] initial point \( \mathbf{p}_0 \)

  • theta0[in] initial angle \( \theta_0 \)

  • P1[in] final point \( \mathbf{p}_1 \)

  • theta1[in] final angle \( \theta_1 \)

inline void copy(ClothoidCurve const &c)

Build a clothoid copying an existing one.

inline explicit ClothoidCurve(LineSegment const &LS)

Build a clothoid copying an existing line segment.

inline explicit ClothoidCurve(CircleArc const &C)

Build a clothoid copying an existing circle arc.

explicit ClothoidCurve(BaseCurve const &C)

Build a clothoid copying an existing curve.

inline ClothoidCurve const &operator=(ClothoidCurve const &s)

Copy an existing clothoid.

void build(real_type x0, real_type y0, real_type theta0, real_type k, real_type dk, real_type L)

Build a clothoid with the standard parameters

Parameters
  • x0[in] starting position x-coordinate

  • y0[in] starting position y-coordinate

  • theta0[in] initial angle

  • k[in] curvature

  • dk[in] curvature derivative

  • L[in] length

inline int build_G1(real_type x0, real_type y0, real_type theta0, real_type x1, real_type y1, real_type theta1, real_type tol = 1e-12)

Build a clothoid by solving the hermite G1 problem.

Parameters
  • x0[in] initial x position \( x_0 \)

  • y0[in] initial y position \( y_0 \)

  • theta0[in] initial angle \( \theta_0 \)

  • x1[in] final x position \( x_1 \)

  • y1[in] final y position \( y_1 \)

  • theta1[in] final angle \( \theta_1 \)

  • tol[in] tolerance

Returns

number of iteration performed

inline int build_G1_D(real_type x0, real_type y0, real_type theta0, real_type x1, real_type y1, real_type theta1, real_type L_D[2], real_type k_D[2], real_type dk_D[2], real_type tol = 1e-12)

Build a clothoid by solving the hermite G1 problem.

Parameters
  • x0[in] initial x position \( x_0 \)

  • y0[in] initial y position \( y_0 \)

  • theta0[in] initial angle \( \theta_0 \)

  • x1[in] final x position \( x_1 \)

  • y1[in] final y position \( y_1 \)

  • theta1[in] final angle \( \theta_1 \)

  • L_D[out] derivative of the length \( L(\theta_0,\theta_1) \)

  • k_D[out] derivative of the curvature \( \kappa(\theta_0,\theta_1) \)

  • dk_D[out] derivative of the curvature variation \( \kappa'(\theta_0,\theta_1) \)

  • tol[out] = 1e-12

Returns

number of iteration performed

inline bool build_forward(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type x1, real_type y1, real_type tol = 1e-12)

Build a clothoid by solving the forward problem.

Parameters
  • x0[in] initial x position \( x_0 \)

  • y0[in] initial y position \( y_0 \)

  • theta0[in] initial angle \( \theta_0 \)

  • kappa0[in] initial curvature \( \kappa_0 \)

  • x1[in] final x position \( x_1 \)

  • y1[in] final y position \( y_1 \)

  • tol[in] tolerance of the forward problem

inline void build(LineSegment const &LS)

Build a clothoid from a line segment.

inline void build(CircleArc const &C)

Build a clothoid from a circle arc.

inline void Pinfinity(real_type &x, real_type &y, bool plus = true) const

Return the point at infinity of the clothoids \( P(s) \).

../_images/Pinfinity.jpg

Parameters
  • x[out] x-coordinate of the infinity point

  • y[out] y-coordinate of the infinity point

  • plus[out] it true return \( \lim_{s\to+\infty} P(s) \) otherwise return \( \lim_{s\to-\infty} P(s) \)

inline real_type dkappa() const

Derivative of the curvature of the clothoid.

real_type thetaTotalVariation() const

Clothoid curve total variation of the angle.

real_type thetaMinMax(real_type &thMin, real_type &thMax) const

Max and min angle of the curve.

inline real_type deltaTheta() const

Clothoid angle range.

real_type curvatureMinMax(real_type &kMin, real_type &kMax) const

Max and min of the curvatire of the clothoid curve.

real_type curvatureTotalVariation() const

Clothoid total curvature variation.

real_type integralCurvature2() const

Given the clothoid curve \( P(s) \) compute.

\[ \int_0^L |P''(s)|^2 \mathrm{d}s \]
real_type integralJerk2() const

Given the clothoid curve \( P(s) \) compute.

\[ \int_0^L |P'''(s)|^2 \mathrm{d}s \]
real_type integralSnap2() const

Given the clothoid curve \( P(s) \) compute.

\[ \int_0^L |P''''(s)|^2 \mathrm{d}s \]
void optimized_sample_ISO(real_type offs, int_type npts, real_type max_angle, std::vector<real_type> &s) const

Return a vector of optimized sample parameters for plotting.

Parameters
  • offs – offset of the sampled curve

  • npts – suggested minimum number of sampled points

  • max_angle – maximum angle variation between two sampled points

  • s – vector of computed parameters

inline void optimized_sample_SAE(real_type offs, int_type npts, real_type max_angle, std::vector<real_type> &s) const

Return a vector of optimized sample parameters for plotting.

Parameters
  • offs – offset of the sampled curve

  • npts – suggested minimum number of sampled points

  • max_angle – maximum angle variation between two sampled points

  • s – vector of computed parameters

real_type closestPointBySample(real_type ds, real_type qx, real_type qy, real_type &X, real_type &Y, real_type &S) const

Compute the point on clothoid at minimal distance from a given point using the optimized algorithm described in the publication:

  • E.Bertolazzi, M.Frego, Point-Clothoid distance and projection computation SIAM J. Scientific Computing, Vol. 41, No. 5, pp. A3326-A3353

Parameters
  • ds – sampling step

  • qx – x-coordinate of the given point

  • qy – y-coordinate of the given point

  • X – x-coordinate of the point on clothoid at minimal distance

  • Y – y-coordinate of the point on clothoid at minimal distance

  • S – curvilinear coordinate of the point (X,Y) on the clothoid

Returns

the distance of the point from the clothoid

inline real_type distanceBySample(real_type ds, real_type qx, real_type qy, real_type &S) const

Approximate the point on clothoid at minimal distance from a given point using simple sampling.

Parameters
  • ds – sampling step

  • qx – x-coordinate of the given point

  • qy – y-coordinate of the given point

  • S – curvilinear coordinate of the point (X,Y) on the clothoid

Returns

the distance of the point from the clothoid

inline real_type distanceBySample(real_type ds, real_type qx, real_type qy) const

Approximate the point on clothoid at minimal distance from a given point using simple sampling.

Parameters
  • ds – sampling step

  • qx – x-coordinate of the given point

  • qy – y-coordinate of the given point

Returns

the distance of the point from the clothoid

inline bool bbTriangle(real_type &xx0, real_type &yy0, real_type &xx1, real_type &yy1, real_type &xx2, real_type &yy2) const

Get the triangle bounding box (if angle variation less that \( \pi/2 \) )

inline bool bbTriangle_ISO(real_type offs, real_type &xx0, real_type &yy0, real_type &xx1, real_type &yy1, real_type &xx2, real_type &yy2) const

Get the triangle bounding box (if angle variation less that \( \pi/2 \))

inline bool bbTriangle_SAE(real_type offs, real_type &xx0, real_type &yy0, real_type &xx1, real_type &yy1, real_type &xx2, real_type &yy2) const

Get the triangle bounding box (if angle variation less that \( \pi/2 \))

inline bool bbTriangle(Triangle2D &t, int_type icurve = 0) const
inline bool bbTriangle_ISO(real_type offs, Triangle2D &t, int_type icurve = 0) const
inline bool bbTriangle_SAE(real_type offs, Triangle2D &t, int_type icurve = 0) const
virtual void bbTriangles_ISO(real_type offs, std::vector<Triangle2D> &tvec, real_type max_angle = Utils::m_pi / 6, real_type max_size = 1e100, int_type icurve = 0) const override

Build a cover with triangles of the curve with offset (ISO).

Parameters
  • offs[out] curve offset

  • tvec[out] list of covering triangles

  • max_angle[out] maximum angle variation of the curve covered by a triangle

  • max_size[out] maximum admissible size of the covering tirnagles

  • icurve[out] index of the covering triangles

inline virtual void bbTriangles_SAE(real_type offs, std::vector<Triangle2D> &tvec, real_type max_angle = Utils::m_pi / 6, real_type max_size = 1e100, int_type icurve = 0) const override

Build a cover with triangles of the curve with offset (SAE).

Parameters
  • offs[out] curve offset

  • tvec[out] list of covering triangles

  • max_angle[out] maximum angle variation of the arc covered by a triangle

  • max_size[out] maximum admissible size of the covering tirnagles

  • icurve[out] index of the covering triangles

inline virtual void bbTriangles(std::vector<Triangle2D> &tvec, real_type max_angle = Utils::m_pi / 6, real_type max_size = 1e100, int_type icurve = 0) const override

Build a cover with triangles of the curve.

../_images/biarc_cover.jpg

Parameters
  • tvec[out] list of covering triangles

  • max_angle[out] maximum angle variation of the curve covered by a triangle

  • max_size[out] maximum admissible size of the covering tirnagles

  • icurve[out] index of the covering triangles

inline virtual void bbox(real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const override

Compute the bounding box of the curve.

Parameters
  • xmin[out] left bottom

  • ymin[out] left bottom

  • xmax[out] right top

  • ymax[out] right top

virtual void bbox_ISO(real_type offs, real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const override

Compute the bounding box of the curve with offset (ISO).

Parameters
  • offs[in] curve offset

  • xmin[out] left bottom

  • ymin[out] left bottom

  • xmax[out] right top

  • ymax[out] right top

inline virtual real_type length() const override

The length of the curve

inline virtual real_type length_ISO(real_type) const override

The length of the curve with offset (ISO)

inline virtual real_type thetaBegin() const override

Initial angle of the curve.

inline virtual real_type kappaBegin() const override

Initial curvature.

inline virtual real_type xBegin() const override

Initial x-coordinate.

inline virtual real_type xEnd() const override

Final x-coordinate.

inline virtual real_type yBegin() const override

Initial y-coordinate.

inline virtual real_type yEnd() const override

Final y-coordinate.

inline virtual real_type tx_Begin() const override

Initial tangent x-coordinate.

inline virtual real_type ty_Begin() const override

Initial tangent y-coordinate.

inline virtual real_type nx_Begin_ISO() const override

Intial normal x-coordinate (ISO).

inline virtual real_type ny_Begin_ISO() const override

Intial normal y-coordinate (ISO).

inline virtual real_type tx(real_type s) const override

Tangent x-coordinate at curvilinear coodinate s.

inline virtual real_type ty(real_type s) const override

Tangent y-coordinate at curvilinear coodinate s.

inline virtual real_type tx_D(real_type s) const override

Tangent derivative x-coordinate at curvilinear coodinate s.

inline virtual real_type ty_D(real_type s) const override

Tangent derivative y-coordinate at curvilinear coodinate s.

inline virtual real_type tx_DD(real_type s) const override

Tangent second derivative x-coordinate at curvilinear coodinate s.

inline virtual real_type ty_DD(real_type s) const override

Tangent second derivative y-coordinate at curvilinear coodinate s.

inline virtual real_type tx_DDD(real_type s) const override

Tangent third derivative x-coordinate at curvilinear coodinate s.

inline virtual real_type ty_DDD(real_type s) const override

Tangent third derivative y-coordinate at curvilinear coodinate s.

inline virtual void tg(real_type s, real_type &tx, real_type &ty) const override

Tangent at curvilinear coodinate s.

inline virtual void tg_D(real_type s, real_type &tx_D, real_type &ty_D) const override

Tangent derivative at curvilinear coodinate s.

inline virtual void tg_DD(real_type s, real_type &tx_DD, real_type &ty_DD) const override

Tangent second derivative at curvilinear coodinate s.

inline virtual void tg_DDD(real_type s, real_type &tx_DDD, real_type &ty_DDD) const override

Tangent third derivative at curvilinear coodinate s.

inline virtual real_type theta(real_type s) const override

Get clothoid angle at curvilinear cooordinate s.

Parameters

s – curvilinear cooordinate

Returns

angle (radiant) at curvilinear cooordinate s

inline virtual real_type theta_D(real_type s) const override

Get clothoid angle derivative (=curvature) at curvilinear cooordinate s.

Parameters

s – curvilinear cooordinate

Returns

angle derivative (radiant/s) at curvilinear cooordinate s

inline virtual real_type theta_DD(real_type) const override

Get clothoid angle second derivative at curvilinear cooordinate s.

Returns

angle second derivative (radiant/s^2) at curvilinear cooordinate s

inline virtual real_type theta_DDD(real_type) const override

Get clothoid angle third derivative at curvilinear cooordinate s.

Returns

angle third derivative (radiant/s^3) at curvilinear cooordinate s

inline virtual real_type X(real_type s) const override

Clothoid X coordinate at curvilinear coordinate s.

Parameters

s – curvilinear coordinate

Returns

clothoid X coordinate

inline virtual real_type X_D(real_type s) const override

x-coordinate derivative at curvilinear coordinate s.

inline virtual real_type X_DD(real_type s) const override

x-coordinate second derivative at curvilinear coordinate s.

inline virtual real_type X_DDD(real_type s) const override

x-coordinate third derivative at curvilinear coordinate s.

inline virtual real_type Y(real_type s) const override

Clothoid Y coordinate at curvilinear coordinate s.

Parameters

s – curvilinear coordinate

Returns

clothoid Y coordinate

inline virtual real_type Y_D(real_type s) const override

y-coordinate derivative at curvilinear coordinate s.

inline virtual real_type Y_DD(real_type s) const override

y-coordinate second derivative at curvilinear coordinate s.

inline virtual real_type Y_DDD(real_type s) const override

y-coordinate third derivative at curvilinear coordinate s.

inline virtual real_type X_ISO(real_type s, real_type offs) const override

Clothoid X coordinate at curvilinear coordinate s.

Parameters
  • s – curvilinear coordinate

  • offs – lateral offset

Returns

clothoid X coordinate

inline virtual real_type X_ISO_D(real_type s, real_type offs) const override

x-coordinate derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual real_type X_ISO_DD(real_type s, real_type offs) const override

x-coordinate second derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual real_type X_ISO_DDD(real_type s, real_type offs) const override

x-coordinate third derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual real_type Y_ISO(real_type s, real_type offs) const override

Clothoid Y coordinate at curvilinear coordinate s.

Parameters
  • s – curvilinear coordinate

  • offs – lateral offset

Returns

clothoid Y coordinate

inline virtual real_type Y_ISO_D(real_type s, real_type offs) const override

y-coordinate derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual real_type Y_ISO_DD(real_type s, real_type offs) const override

y-coordinate second derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual real_type Y_ISO_DDD(real_type s, real_type offs) const override

y-coordinate third derivative at curvilinear coordinate s with offset offs (ISO).

inline virtual void eval(real_type s, real_type &x, real_type &y) const override

x and y-coordinate at curvilinear coordinate s.

inline virtual void eval_D(real_type s, real_type &x_D, real_type &y_D) const override

x and y-coordinate derivative at curvilinear coordinate s.

inline virtual void eval_DD(real_type s, real_type &x_DD, real_type &y_DD) const override

x and y-coordinate second derivative at curvilinear coordinate s.

inline virtual void eval_DDD(real_type s, real_type &x_DDD, real_type &y_DDD) const override

x and y-coordinate third derivative at curvilinear coordinate s.

inline virtual void eval_ISO(real_type s, real_type offs, real_type &x, real_type &y) const override

Compute curve at position s with offset offs (ISO).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x[out] coordinate

  • y[out] coordinate

inline virtual void eval_ISO_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const override

Compute derivative curve at position s with offset offs (ISO).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_D[out] x-coordinate

  • y_D[out] y-coordinate

inline virtual void eval_ISO_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const override

Compute second derivative curve at position s with offset offs (ISO).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_DD[out] x-coordinate second derivative

  • y_DD[out] y-coordinate second derivative

inline virtual void eval_ISO_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const override

Compute third derivative curve at position s with offset offs (ISO).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_DDD[out] x-coordinate third derivative

  • y_DDD[out] y-coordinate third derivative

inline virtual void translate(real_type tx, real_type ty) override

translate curve by \( (t_x,t_y) \)

inline virtual void rotate(real_type angle, real_type cx, real_type cy) override

Rotate curve by angle \( theta \) centered at point \( (c_x,c_y)\).

Parameters
  • angle[in] angle \( theta \)

  • cx[in] \( c_x\)

  • cy[in] \( c_y\)

inline virtual void scale(real_type s) override

Scale curve by factor sc.

inline virtual void reverse() override

Reverse curve parameterization.

inline virtual void changeOrigin(real_type newx0, real_type newy0) override

Translate curve so that origin will be (newx0, newy0).

inline virtual void trim(real_type s_begin, real_type s_end) override

Cut curve at parametrix coordinate s_begin and s_end.

inline void changeCurvilinearOrigin(real_type s0, real_type newL)

change the origin of the clothoid at \( s_0 \) and the length to \( L \).

Parameters
  • s0[in] \( s_0 \)

  • newL[in] \( L \)

virtual int_type closestPoint_ISO(real_type qx, real_type qy, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const override

Given a point find closest point on the curve.

Parameters
  • qx – x-coordinate of the point

  • qy – y-coordinate of the point

  • x – x-coordinate of the projected point on the curve

  • y – y-coordinate of the projected point on the curve

  • s – parameter on the curve of the projection

  • t – curvilinear coordinate of the point x,y (if orthogonal projection)

  • dst – distance point projected point

Returns

1 = point is projected orthogonal 0 = more than one projection (first returned) -1 = minimum point is not othogonal projection to curve

virtual int_type closestPoint_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 override

Given a point find closest point on the curve.

Parameters
  • qx – x-coordinate of the point

  • qy – y-coordinate of the point

  • offs – offset of the curve

  • x – x-coordinate of the projected point on the curve

  • y – y-coordinate of the projected point on the curve

  • s – parameter on the curve of the projection

  • t – curvilinear coordinate of the point x,y (if orthogonal projection)

  • dst – distance point projected point

Returns

1 = point is projected orthogonal 0 = more than one projection (first returned) -1 = minimum point is not othogonal projection to curve

bool approximate_collision_ISO(real_type offs, ClothoidCurve const &c, real_type c_offs, real_type max_angle, real_type max_size) const

Collision detection

Parameters
  • offs[in] curve offset

  • C[in] curve to compare for collision detection

  • offs_C[in] curve offset

  • max_angle[in] maximum angle variation

  • max_size[in] if the segment is larger then this parameter is split

bool collision(ClothoidCurve const &C) const
bool collision_ISO(real_type offs, ClothoidCurve const &C, real_type offs_C) const
inline void intersect(ClothoidCurve const &C, IntersectList &ilist, bool swap_s_vals) const
void intersect_ISO(real_type offs, ClothoidCurve const &C, real_type offs_C, IntersectList &ilist, bool swap_s_vals) const
inline virtual void info(ostream_type &stream) const override

Pretty print of the curve data.

inline CurveType type() const

The name of the curve type

inline real_type length_SAE(real_type offs) const

The length of the curve with offset (SAE)

inline void bbox_SAE(real_type offs, real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const

Compute the bounding box of the curve (SAE).

Parameters
  • offs[in] curve offset

  • xmin[out] left bottom

  • ymin[out] left bottom

  • xmax[out] right top

  • ymax[out] right top

inline virtual real_type thetaEnd() const

Final angle of the curve.

inline virtual real_type kappaEnd() const

Final curvature.

inline virtual real_type xBegin_ISO(real_type offs) const

Initial x-coordinate with offset (ISO standard).

inline virtual real_type yBegin_ISO(real_type offs) const

Initial y-coordinate with offset (ISO standard).

inline virtual real_type xEnd_ISO(real_type offs) const

Final x-coordinate with offset (ISO standard).

inline virtual real_type yEnd_ISO(real_type offs) const

Final y-coordinate with offset (ISO standard).

inline real_type xBegin_SAE(real_type offs) const

Initial x-coordinate with offset (SAE standard).

inline real_type yBegin_SAE(real_type offs) const

Initial y-coordinate with offset (SAE standard).

inline real_type xEnd_SAE(real_type offs) const

Final y-coordinate with offset (SAE standard).

inline real_type yEnd_SAE(real_type offs) const

Final y-coordinate with offset (ISO standard).

inline virtual real_type tx_End() const

Final tangent x-coordinate.

inline virtual real_type ty_End() const

Final tangent y-coordinate.

inline virtual real_type nx_End_ISO() const

Final normal x-coordinate (ISO).

inline virtual real_type ny_End_ISO() const

Final normal y-coordinate (ISO).

inline real_type nx_Begin_SAE() const

Intial normal x-coordinate (SAE).

inline real_type ny_Begin_SAE() const

Intial normal y-coordinate (SAE).

inline real_type nx_End_SAE() const

Final normal x-coordinate (SAE).

inline real_type ny_End_SAE() const

Intial normal y-coordinate (SAE).

inline real_type kappa(real_type s) const

Ccurvature at curvilinear coodinate s.

inline real_type kappa_D(real_type s) const

Curvature derivative at curvilinear coodinate s.

inline real_type kappa_DD(real_type s) const

Curvature second derivative at curvilinear coodinate s.

inline real_type nx_ISO(real_type s) const

Normal x-coordinate at curvilinear coodinate s (ISO).

inline real_type nx_ISO_D(real_type s) const

Normal derivative x-coordinate at curvilinear coodinate s (ISO).

inline real_type nx_ISO_DD(real_type s) const

Normal second derivative x-coordinate at curvilinear coodinate s (ISO).

inline real_type nx_ISO_DDD(real_type s) const

Normal third derivative x-coordinate at curvilinear coodinate s (ISO).

inline real_type ny_ISO(real_type s) const

Normal y-coordinate at curvilinear coodinate s (ISO).

inline real_type ny_ISO_D(real_type s) const

Normal derivative y-coordinate at curvilinear coodinate s (ISO).

inline real_type ny_ISO_DD(real_type s) const

Normal second derivative y-coordinate at curvilinear coodinate s (ISO).

inline real_type ny_ISO_DDD(real_type s) const

Normal third derivative y-coordinate at curvilinear coodinate s (ISO).

inline real_type nx_SAE(real_type s) const

Normal x-coordinate at curvilinear coodinate s (SAE).

inline real_type nx_SAE_D(real_type s) const

Normal derivative x-coordinate at curvilinear coodinate s (SAE).

inline real_type nx_SAE_DD(real_type s) const

Normal second derivative x-coordinate at curvilinear coodinate s (SAE).

inline real_type nx_SAE_DDD(real_type s) const

Normal third derivative x-coordinate at curvilinear coodinate s (SAE).

inline real_type ny_SAE(real_type s) const

Normal y-coordinate at curvilinear coodinate s (ISO)

inline real_type ny_SAE_D(real_type s) const

Normal derivative y-coordinate at curvilinear coodinate s (SAE).

inline real_type ny_SAE_DD(real_type s) const

Normal second derivative x-coordinate at curvilinear coodinate s (SAE).

inline real_type ny_SAE_DDD(real_type s) const

Normal third derivative y-coordinate at curvilinear coodinate s (SAE).

inline void nor_ISO(real_type s, real_type &nx, real_type &ny) const

Normal at curvilinear coodinate s (ISO).

inline void nor_ISO_D(real_type s, real_type &nx_D, real_type &ny_D) const

Normal derivative at curvilinear coodinate s (ISO).

inline void nor_ISO_DD(real_type s, real_type &nx_DD, real_type &ny_DD) const

Normal second derivative at curvilinear coodinate s (ISO).

inline void nor_ISO_DDD(real_type s, real_type &nx_DDD, real_type &ny_DDD) const

Normal third derivative at curvilinear coodinate s (ISO).

inline void nor_SAE(real_type s, real_type &nx, real_type &ny) const

Normal at curvilinear coodinate s (SAE).

inline void nor_SAE_D(real_type s, real_type &nx_D, real_type &ny_D) const

Normal derivative at curvilinear coodinate s (SAE).

inline void nor_SAE_DD(real_type s, real_type &nx_DD, real_type &ny_DD) const

Normal second derivative at curvilinear coodinate s (SAE).

inline void nor_SAE_DDD(real_type s, real_type &nx_DDD, real_type &ny_DDD) const

Normal third at curvilinear coodinate s (SAE).

inline virtual void evaluate(real_type s, real_type &th, real_type &k, real_type &x, real_type &y) const

Evaluate curve at curvilinear coordinate s.

Parameters
  • s[in] curvilinear coordinate

  • th[out] angle

  • k[out] curvature

  • x[out] x-coordinate

  • y[out] y-coordinate

inline virtual void evaluate_ISO(real_type s, real_type offs, real_type &th, real_type &k, real_type &x, real_type &y) const

Evaluate curve with offset at curvilinear coordinate s (ISO).

Parameters
  • s[in] curvilinear coordinate

  • offs[in] offset

  • th[out] angle

  • k[out] curvature

  • x[out] x-coordinate

  • y[out] y-coordinate

inline virtual void evaluate_SAE(real_type s, real_type offs, real_type &th, real_type &k, real_type &x, real_type &y) const

Evaluate curve with offset at curvilinear coordinate s (SAE).

Parameters
  • s[in] curvilinear coordinate

  • offs[in] offset

  • th[out] angle

  • k[out] curvature

  • x[out] x-coordinate

  • y[out] y-coordinate

inline real_type X_SAE(real_type s, real_type offs) const

x-coordinate at curvilinear coordinate s with offset offs (SAE).

inline real_type Y_SAE(real_type s, real_type offs) const

y-coordinate at curvilinear coordinate s with offset offs (SAE).

inline real_type X_SAE_D(real_type s, real_type offs) const

x-coordinate derivative at curvilinear coordinate s with offset offs (SAE).

inline real_type Y_SAE_D(real_type s, real_type offs) const

y-coordinate derivative at curvilinear coordinate s with offset offs (SAE).

inline real_type X_SAE_DD(real_type s, real_type offs) const

x-coordinate second derivative at curvilinear coordinate s with offset offs (SAE).

inline real_type Y_SAE_DD(real_type s, real_type offs) const

y-coordinate second derivative at curvilinear coordinate s with offset offs (SAE).

inline real_type X_SAE_DDD(real_type s, real_type offs) const

x-coordinate third derivative at curvilinear coordinate s with offset offs (SAE).

inline real_type Y_SAE_DDD(real_type s, real_type offs) const

y-coordinate third derivative at curvilinear coordinate s with offset offs (SAE).

inline void eval_SAE(real_type s, real_type offs, real_type &x, real_type &y) const

Compute curve at position s with offset offs (SAE).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x[out] coordinate

  • y[out] coordinate

inline void eval_SAE_D(real_type s, real_type offs, real_type &x_D, real_type &y_D) const

Compute derivative curve at position s with offset offs (SAE).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_D[out] x-coordinate first derivative

  • y_D[out] y-coordinate first derivative

inline void eval_SAE_DD(real_type s, real_type offs, real_type &x_DD, real_type &y_DD) const

Compute second derivative curve at position s with offset offs (SAE).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_DD[out] x-coordinate second derivative

  • y_DD[out] y-coordinate second derivative

inline void eval_SAE_DDD(real_type s, real_type offs, real_type &x_DDD, real_type &y_DDD) const

Compute third derivative curve at position s with offset offs (SAE).

Parameters
  • s[in] parameter on the curve

  • offs[in] offset of the curve

  • x_DDD[out] x-coordinate third derivative

  • y_DDD[out] y-coordinate third derivative

inline bool collision(BaseCurve const &C) const

Check collision with another curve.

inline bool collision_ISO(real_type offs, BaseCurve const &C, real_type offs_C) const

Check collision with another curve with offset (ISO).

Parameters
  • offs[in] curve offset

  • C[in] second curve to check collision

  • offs_C[in] curve offset of the second curve

Returns

true if collision is detected

inline bool collision_SAE(real_type offs, BaseCurve const &C, real_type offs_C) const

Check collision with another curve with offset (SAE).

Parameters
  • offs[in] curve offset

  • C[in] second curve to check collision

  • offs_C[in] curve offset of the second curve

Returns

true if collision is detected

inline void intersect(BaseCurve const &C, IntersectList &ilist, bool swap_s_vals) const

Intersect the curve with another curve.

Parameters
  • C[in] second curve intersect

  • ilist[out] list of the intersection (as parameter on the curves)

  • swap_s_vals[in] if true store (s2,s1) instead of (s1,s2) for each intersection

inline void intersect_ISO(real_type offs, BaseCurve const &C, real_type offs_C, IntersectList &ilist, bool swap_s_vals) const

Intersect the curve with another curve with offset (ISO)

Parameters
  • offs[in] offset first curve

  • C[in] second curve intersect

  • offs_C[in] offset second curve

  • ilist[out] list of the intersection (as parameter on the curves)

  • swap_s_vals[in] if true store (s2,s1) instead of (s1,s2) for each intersection

inline void intersect_SAE(real_type offs, BaseCurve const &C, real_type offs_C, IntersectList &ilist, bool swap_s_vals) const

Intersect the curve with another curve with offset (SAE).

Parameters
  • offs[in] offset first curve

  • C[in] second curve intersect

  • offs_C[in] offset second curve

  • ilist[out] list of the intersection (as parameter on the curves)

  • swap_s_vals[in] if true store (s2,s1) instead of (s1,s2) for each intersection

inline int_type closestPoint_SAE(real_type qx, real_type qy, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst) const

Given a point find closest point on the curve.

Parameters
  • qx – x-coordinate of the point

  • qy – y-coordinate of the point

  • x – x-coordinate of the projected point on the curve

  • y – y-coordinate of the projected point on the curve

  • s – parameter on the curve of the projection

  • t – curvilinear coordinate of the point x,y (if orthogonal projection)

  • dst – distance point projected point

Returns

1 = point is projected orthogonal 0 = more than one projection (first returned) -1 = minimum point is not othogonal projection to curve

inline int_type closestPoint_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

Given a point find closest point on the curve.

Parameters
  • qx – x-coordinate of the point

  • qy – y-coordinate of the point

  • offs – offset of the curve

  • x – x-coordinate of the projected point on the curve

  • y – y-coordinate of the projected point on the curve

  • s – parameter on the curve of the projection

  • t – curvilinear coordinate of the point x,y (if orthogonal projection)

  • dst – distance point projected point

Returns

1 = point is projected orthogonal 0 = more than one projection (first returned) -1 = minimum point is not othogonal projection to curve

inline virtual real_type distance(real_type qx, real_type qy) const

Compute the distance between a point \( q=(q_x,q_y) \) and the curve.

Parameters
  • qx[in] component \( q_x \)

  • qy[in] component \( q_y \)

Returns

the computed distance

inline real_type distance_ISO(real_type qx, real_type qy, real_type offs) const

Compute the distance between a point \( q=(q_x,q_y) \) and the curve with offset (ISO).

Parameters
  • qx[in] component \( q_x \)

  • qy[in] component \( q_y \)

  • offs[in] offset of the curve

Returns

the computed distance

inline real_type distance_SAE(real_type qx, real_type qy, real_type offs) const

Compute the distance between a point \( q=(q_x,q_y) \) and the curve with offset (SAE).

Parameters
  • qx[in] component \( q_x \)

  • qy[in] component \( q_y \)

  • offs[in] offset of the curve

Returns

the computed distance

inline bool findST_ISO(real_type x, real_type y, real_type &s, real_type &t) const

Find the curvilinear coordinate of point \( P=(x,y) \) respect to the curve (ISO), i.e.

\[ P = C(s)+N(s)t \]

where \( C(s) \) is the curve position respect to the curvilinear coordinates and \( C(s) \) is the normal at the point \( C(s) \).

Parameters
  • x[in] component \( x \)

  • y[in] component \( y \)

  • s[out] curvilinear coordinate

  • t[out] offset respect to the curve of \( (x,y) \)

Returns

true if the coordinate are found

inline bool findST_SAE(real_type x, real_type y, real_type &s, real_type &t) const

Find the curvilinear coordinate of point \( (x,y) \) respect to the curve (SAE), i.e.

\[ P = C(s)+N(s)t \]

where \( C(s) \) is the curve position respect to the curvilinear coordinates and \( C(s) \) is the normal at the point \( C(s) \).

Parameters
  • x[in] component \( x \)

  • y[in] component \( y \)

  • s[out] curvilinear coordinate

  • t[out] offset respect to the curve of \( (x,y) \)

Returns

true if the coordinate are found

Friends

friend ostream_type &operator<<(ostream_type &stream, ClothoidCurve const &c)