# Class ClothoidList

- Defined in File ClothoidList.hxx

## Inheritance Relationships

### Base Type

- `public G2lib::BaseCurve` (Class BaseCurve)

## Class Documentation

class G2lib::ClothoidList : public G2lib::BaseCurve

  Manage a piecewise clothoids \( G(s) \) composed by n clothoids (not necessarily G2 or G1 connected)

  Public Functions

  inline ClothoidList()

    Build an empty clothoid list

  inline ~ClothoidList() override
  inline ClothoidList(ClothoidList const &s)

    Build a copy of an existing clothoid list

  void init()

    Initialize the clothoid list

  void reserve(int_type n)

    Reserve memory for `n` clothoid

  void copy(ClothoidList const &L)

    Build a clothoid list copying an existing one

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

    Copy an existing clothoid list

  explicit ClothoidList(LineSegment const &LS)

    Build a clothoid from a line segment

  explicit ClothoidList(CircleArc const &C)

    Build a clothoid from a circle arc

  explicit ClothoidList(Biarc const &B)

    Build a clothoid from a biarc

  explicit ClothoidList(BiarcList const &BL)

    Build a clothoid from a list of biarc

  explicit ClothoidList(ClothoidCurve const &CL)

    Build a clothoid from a clothoid curve

  explicit ClothoidList(PolyLine const &PL)

    Build a clothoid from a list line segment

  explicit ClothoidList(BaseCurve const &C)

    Build a clothoid from a curve

  void push_back(LineSegment const &c)

    Add a line segment to the tail of clothoid list

  void push_back(CircleArc const &c)

    Add a circle arc to the tail of clothoid list

  void push_back(Biarc const &c)

    Add a biarc to the tail of clothoid list

  void push_back(BiarcList const &c)

    Add a biarc list to the tail of clothoid list

  void push_back(ClothoidCurve const &c)

    Add a clothoid curve to the tail of clothoid list

  void push_back(ClothoidList const &c)

    Add a clothoid list to the tail of clothoid list

  void push_back(PolyLine const &c)

    Add a list of line segment to the tail of clothoid list

  void push_back(real_type kappa0, real_type dkappa, real_type L)

    Add a clothoid to the tail of the clothoid list.

    Parameters

      - kappa0 – initial curvature

      - dkappa – derivative of the curvature

      - L – length of the segment

  void push_back(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type dkappa, real_type L)

    Add a clothoid to the tail of the clothoid list. The builded clothoid is translated to the tail of the clothioid list.

    Parameters

      - x0 – initial x

      - y0 – initial y

      - theta0 – initial angle

      - kappa0 – initial curvature

      - dkappa – derivative of the curvature

      - L – length of the segment

  void push_back_G1(real_type x1, real_type y1, real_type theta1)

    Add a clothoid to the tail of the clothoid list solving the G1 problem. The initial point and angle are taken from the tail of the clothoid list.

    Parameters

      - x1 – final x

      - y1 – final y

      - theta1 – final angle

  void push_back_G1(real_type x0, real_type y0, real_type theta0, real_type x1, real_type y1, real_type theta1)

    Add a clothoid to the tail of the clothoid list solving the G1 problem. The initial point and angle are taken from the tail of the clothoid list. The builded clothoid is translated to the tail of the clothioid list.

    Parameters

      - x0 – initial x

      - y0 – initial y

      - theta0 – initial angle

      - x1 – final x

      - y1 – final y

      - theta1 – final angle

  inline bool is_closed() const

    True if curve is closed

  inline void make_closed()

    Set clousure flag to true

  inline void make_open()

    Set clousure flag to false

  inline real_type closure_gap_x() const

    Difference initial final point x component

  inline real_type closure_gap_y() const

    Difference initial final point y component

  inline real_type closure_gap_tx() const

    Difference initial final tangent x component

  inline real_type closure_gap_ty() const

    Difference initial final tangent y component

  inline bool closure_check(real_type tol_xy = 1e-6, real_type tol_tg = 1e-6) const

    check if clothoid list is closed

    Parameters

      - tol_xy – [in] position tolerance

      - tol_tg – [in] angle (tangent) tolerance

    Returns

      true if curve is closed

  bool build_G1(int_type n, real_type const *x, real_type const *y)

    Build clothoid list passing to a list of points solving a series of G1 fitting problems. The angle at points are estimated using the routine `xy_to_guess_angle`

    Parameters

      - n – [in] number of points

      - x – [in] x-coordinates

      - y – [in] y-coordinates

    Returns

      false if routine fails

  bool build_G1(int_type n, real_type const *x, real_type const *y, real_type const *theta)

    Build clothoid list passing to a list of points solving a series of G1 fitting problems.

    Parameters

      - n – [in] number of points

      - x – [in] x-coordinates

      - y – [in] y-coordinates

      - theta – [in] angles at the points

    Returns

      false if routine fails

  bool build(real_type x0, real_type y0, real_type theta0, int_type n, real_type const *s, real_type const *kappa)

    Build clothoid list with G2 continuity. The vector `s` contains the breakpoints of the curve. Between two breakpoint the curvature change linearly (is a clothoid)

    Parameters

      - x0 – [in] initial x

      - y0 – [in] initial y

      - theta0 – [in] initial angle

      - n – [in] number of segments

      - s – [in] break point of the piecewise curve

      - kappa – [in] curvature at the break point

    Returns

      true if curve is closed

  inline bool build(real_type x0, real_type y0, real_type theta0, vector<real_type> const &s, vector<real_type> const &kappa)

    Build clothoid list with G2 continuity. The vector `s` contains the breakpoints of the curve. Between two breakpoint the curvature change linearly (is a clothoid)

    Parameters

      - x0 – [in] initial x

      - y0 – [in] initial y

      - theta0 – [in] initial angle

      - s – [in] break point of the piecewise curve

      - kappa – [in] curvature at the break point

    Returns

      true if curve is closed

  bool build_raw(int_type n, real_type const *x, real_type const *y, real_type const *abscissa, real_type const *theta, real_type const *kappa)

    Build clothoid listy using raw data.

    Parameters

      - n – [in] number of points

      - x – [in] x-coordinates

      - y – [in] y-coordinates

      - abscissa – [in] break point of the piecewise curve

      - theta – [in] angles at breakpoints

      - kappa – [in] curvature at the break point

    Returns

      false if fails

  inline bool build_raw(vector<real_type> const &x, vector<real_type> const &y, vector<real_type> const &abscissa, vector<real_type> const &theta, vector<real_type> const &kappa)

    Build clothoid listy using raw data.

    Parameters

      - x – [in] x-coordinates

      - y – [in] y-coordinates

      - abscissa – [in] break point of the piecewise curve

      - theta – [in] angles at breakpoints

      - kappa – [in] curvature at the break point

    Returns

      false if fails

  ClothoidCurve const &get(int_type idx) const

    Get the `idx`-th clothoid of the list

  ClothoidCurve const &getAtS(real_type s) const

    Get the `idx`-th clothoid of the list where `idx` is the clothoid at parameter `s`

  inline int_type numSegments() const

    Return the numbber of clothoid of the list

  void wrap_in_range(real_type &s) const

    The list of clothoid has total length \( L \) the parameter \( s \) us recomputed as \( s+kL\) in such a way \( s+kL\in[0,L)\) with \( k\in\mathbb{Z} \).

  int_type findAtS(real_type &s) const

    Find the clothoid segment whose definiton range contains `s`

  virtual real_type length() const override

    The length of the curve

  virtual real_type length_ISO(real_type offs) const override

    The length of the curve with offset (ISO)

  real_type segment_length(int_type nseg) const

    Return the length of the `nseg`-th clothoid of the list

  real_type segment_length_ISO(int_type nseg, real_type offs) const

    Return the length of the `nseg`-th clothoid of the list with offset

  inline real_type segment_length_SAE(int_type nseg, real_type offs) const

    Return the length of the `nseg`-th clothoid of the list with offset

  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.

    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

  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 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 thetaBegin() const override

    Initial angle of the curve.

  inline virtual real_type thetaEnd() const override

    Final angle of the curve.

  inline virtual real_type xBegin() const override

    Initial x-coordinate.

  inline virtual real_type yBegin() const override

    Initial y-coordinate.

  inline virtual real_type xEnd() const override

    Final x-coordinate.

  inline virtual real_type yEnd() const override

    Final y-coordinate.

  inline virtual real_type xBegin_ISO(real_type offs) const override

    Initial x-coordinate with offset (ISO standard).

  inline virtual real_type yBegin_ISO(real_type offs) const override

    Initial y-coordinate with offset (ISO standard).

  inline virtual real_type xEnd_ISO(real_type offs) const override

    Final x-coordinate with offset (ISO standard).

  inline virtual real_type yEnd_ISO(real_type offs) const override

    Final y-coordinate with offset (ISO standard).

  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 tx_End() const override

    Final tangent x-coordinate.

  inline virtual real_type ty_End() const override

    Final 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 nx_End_ISO() const override

    Final normal x-coordinate (ISO).

  inline virtual real_type ny_End_ISO() const override

    Final normal y-coordinate (ISO).

  virtual real_type theta(real_type s) const override

    Angle at curvilinear coodinate `s`.

  virtual real_type theta_D(real_type s) const override

    Angle derivative (curvature) at curvilinear coodinate `s`.

  virtual real_type theta_DD(real_type s) const override

    Angle second derivative (devitive of curvature) at curvilinear coodinate `s`.

  virtual real_type theta_DDD(real_type s) const override

    Angle third derivative at curvilinear coodinate `s`.

  virtual real_type tx(real_type s) const override

    Tangent x-coordinate at curvilinear coodinate `s`.

  virtual real_type ty(real_type s) const override

    Tangent y-coordinate at curvilinear coodinate `s`.

  virtual real_type tx_D(real_type s) const override

    Tangent derivative x-coordinate at curvilinear coodinate `s`.

  virtual real_type ty_D(real_type s) const override

    Tangent derivative y-coordinate at curvilinear coodinate `s`.

  virtual real_type tx_DD(real_type s) const override

    Tangent second derivative x-coordinate at curvilinear coodinate `s`.

  virtual real_type ty_DD(real_type s) const override

    Tangent second derivative y-coordinate at curvilinear coodinate `s`.

  virtual real_type tx_DDD(real_type s) const override

    Tangent third derivative x-coordinate at curvilinear coodinate `s`.

  virtual real_type ty_DDD(real_type s) const override

    Tangent third derivative y-coordinate at curvilinear coodinate `s`.

  virtual void tg(real_type s, real_type &tg_x, real_type &tg_y) const override

    Tangent at curvilinear coodinate `s`.

  virtual void tg_D(real_type s, real_type &tg_x_D, real_type &tg_y_D) const override

    Tangent derivative at curvilinear coodinate `s`.

  virtual void tg_DD(real_type s, real_type &tg_x_DD, real_type &tg_y_DD) const override

    Tangent second derivative at curvilinear coodinate `s`.

  virtual void tg_DDD(real_type s, real_type &tg_x_DDD, real_type &tg_y_DDD) const override

    Tangent third derivative at curvilinear coodinate `s`.

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

    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

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

    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

  virtual real_type X(real_type s) const override

    x-coordinate at curvilinear coordinate `s`.

  virtual real_type Y(real_type s) const override

    y-coordinate at curvilinear coordinate `s`.

  virtual real_type X_D(real_type s) const override

    x-coordinate derivative at curvilinear coordinate `s`.

  virtual real_type Y_D(real_type s) const override

    y-coordinate derivative at curvilinear coordinate `s`.

  virtual real_type X_DD(real_type s) const override

    x-coordinate second derivative at curvilinear coordinate `s`.

  virtual real_type Y_DD(real_type s) const override

    y-coordinate second derivative at curvilinear coordinate `s`.

  virtual real_type X_DDD(real_type s) const override

    x-coordinate third derivative at curvilinear coordinate `s`.

  virtual real_type Y_DDD(real_type s) const override

    y-coordinate third derivative at curvilinear coordinate `s`.

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

    x and y-coordinate at curvilinear coordinate `s`.

  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`.

  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`.

  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`.

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

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

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

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

  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).

  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).

  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).

  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).

  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).

  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).

  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

  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

  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

  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

  virtual void translate(real_type tx, real_type ty) override

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

  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\)

  virtual void scale(real_type sc) override

    Scale curve by factor `sc`.

  virtual void reverse() override

    Reverse curve parameterization.

  virtual void changeOrigin(real_type newx0, real_type newy0) override

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

  virtual void trim(real_type s_begin, real_type s_end) override

    Cut curve at parametrix coordinate `s_begin` and `s_end`.

  void trim(real_type s_begin, real_type s_end, ClothoidList &newCL) const
  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
    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

      n >= 0 point is projected orthogonal, n is the number of the segment at minimum distance

      -(n+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
    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

      n > 0 point is projected orthogonal, n-1 is the number of the segment at minimum distance

      -(n+1) minimum point is not othogonal projection to curve

  int_type closestSegment(real_type qx, real_type qy) const
    Parameters

      - qx – x-coordinate of the point

      - qy – y-coordinate of the point

    Returns

      the segment at minimal distance from point (qx,qy)

  int_type closestPointInRange_ISO(real_type qx, real_type qy, int_type icurve_begin, int_type icurve_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, int_type &icurve) const
    Parameters

      - qx – x-coordinate of the point

      - qy – y-coordinate of the point

      - icurve_begin – index of the initial segment

      - icurve_end – index of the past to the last segment

      - 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

      - icurve – number of the segment with the 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 closestPointInRange_SAE(real_type qx, real_type qy, int_type icurve_begin, int_type icurve_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, int_type &icurve) const
    Parameters

      - qx – x-coordinate of the point

      - qy – y-coordinate of the point

      - icurve_begin – index of the initial segment

      - icurve_end – index of the past to the last segment

      - 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

      - icurve – number of the segment with the projected point

    Returns

      1 point is projected orthogonal

      0 = more than one projection (first returned)

      -1 = minimum point is not othogonal projection to curve
  int_type closestPointInSRange_ISO(real_type qx, real_type qy, real_type s_begin, real_type s_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, int_type &icurve) const
    Parameters

      - qx – x-coordinate of the point

      - qy – y-coordinate of the point

      - s_begin – initial curvilinear coordinate of the search range

      - s_end – final curvilinear coordinate of the search range

      - 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

      - icurve – number of the segment with the projected point

    Returns

      1 ok -1 projection failed

  inline int_type closestPointInSRange_SAE(real_type qx, real_type qy, int_type s_begin, int_type s_end, real_type &x, real_type &y, real_type &s, real_type &t, real_type &dst, int_type &icurve) const
    Parameters

      - qx – x-coordinate of the point

      - qy – y-coordinate of the point

      - s_begin – initial curvilinear coordinate of the search range

      - s_end – final curvilinear coordinate of the search range

      - 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

      - icurve – number of the segment with the projected point

    Returns

      1 ok -1 projection failed

  inline virtual void info(ostream_type &stream) const override

    Pretty print of the curve data.

  void getSK(real_type *s, real_type *kappa) const

    Return the clothoid list as a list of nodes and curvatures

    Parameters

      - s – [out] nodes

      - kappa – [out] curvature

  inline void getSK(std::vector<real_type> &s, std::vector<real_type> &kappa) const

    Return the clothoid list as a list of nodes and curvatures

    Parameters

      - s – [out] nodes

      - kappa – [out] curvature

  void getSTK(real_type *s, real_type *theta, real_type *kappa) const

    Return the clothoid list as a list of nodes angles and curvatures

    Parameters

      - s – [out] nodes

      - theta – [out] angles

      - kappa – [out] curvature

  inline void getSTK(std::vector<real_type> &s, std::vector<real_type> &theta, std::vector<real_type> &kappa) const

    Return the clothoid list as a list of nodes angles and curvatures

    Parameters

      - s – [out] nodes

      - theta – [out] angles

      - kappa – [out] curvature

  void getXY(real_type *x, real_type *y) const

    Return the points of the clothoid list at breakpoints

    Parameters

      - x – [out] x-coordinates

      - y – [out] y-coordinates

  void getDeltaTheta(real_type *deltaTheta) const
  void getDeltaKappa(real_type *deltaKappa) const
  int_type findST1(real_type x, real_type y, real_type &s, real_type &t) const

    Find parametric coordinate.

    Parameters

      - x – x-coordinate point

      - y – y-coordinate point

      - s – value \( s \)

      - t – value \( t \)

    Returns

      idx the segment with point at minimal distance, otherwise -(idx+1) if (x,y) cannot be projected orthogonally on the segment

  int_type findST1(int_type ibegin, int_type iend, real_type x, real_type y, real_type &s, real_type &t) const

    Find parametric coordinate.

    Parameters

      - ibegin – initial segment to compute the distance

      - iend – final segment to compute the distance

      - x – x-coordinate point

      - y – y-coordinate point

      - s – value \( s \)

      - t – value \( t \)

    Returns

      idx the segment with point at minimal distance, otherwise -(idx+1) if (x,y) cannot be projected orthogonally on the segment

  bool collision(ClothoidList const &C) const

    Detect a collision with another clothoid list

  bool collision_ISO(real_type offs, ClothoidList const &CL, real_type offs_C) const

    Detect a collision with another clothoid list with offset

    Parameters

      - offs – [in] offset of first clothoid list

      - CL – [in] second clothoid list

      - offs_C – [in] offset of second clothoid list

  inline void intersect(ClothoidList const &CL, IntersectList &ilist, bool swap_s_vals) const

    Intersect a clothoid list with another clothoid list

    Parameters

      - CL – [in] second clothoid list

      - 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

  void intersect_ISO(real_type offs, ClothoidList const &CL, real_type offs_obj, IntersectList &ilist, bool swap_s_vals) const

    Intersect a clothoid list with another clothoid list with offset (ISO)

    Parameters

      - offs – [in] offset of first clothoid list

      - CL – [in] second clothoid list

      - offs_obj – [in] offset of second clothoid list

      - 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

  void export_table(ostream_type &stream) const

    Save Clothoid list to a stream

    Parameters

      stream – stream to save

  void export_ruby(ostream_type &stream) const

    Save Clothoid list to a stream

    Parameters

      stream – streamstream to save

  void save(ostream_type &stream) const

    Save the clothoid list on a stream. The data is saved as follows

          # x y theta kappa
          x0 y0 theta0 kappa0
          x1 y1 theta1 kappa1
          ...
          xn yn thetan kappan

  void load(istream_type &stream, real_type epsi = 1e-8)

    Read the clothoid list from a stream. The data is assumed to be saved as follows

          # x y theta kappa
          x0 y0 theta0 kappa0
          x1 y1 theta1 kappa1
          ...
          xn yn thetan kappan

  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 kappaBegin() const

    Initial curvature.

  inline virtual real_type kappaEnd() const

    Final curvature.

  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 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_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, ClothoidList const &CL)