# Class G2solveCLC

- Defined in File ClothoidList.hxx

## Class Documentation

class G2lib::G2solveCLC

  Construct a piecewise clothoids \( G(s) \) composed by 2 clothoid and one line segment that solve the G2 problem

  \[\begin{split} \begin{array}{ll} \textrm{endpoints:}\quad & \begin{cases} G(0) = \mathbf{p}_0 & \\[0.5em] G(L) = \mathbf{p}_1 & \end{cases} \\[1em] \textrm{angles:}\quad & \begin{cases} \theta(0) = \theta_0 & \\[0.5em] \theta(L) = \theta_1 & \end{cases} \\[1em] \textrm{curvature:}\quad & \begin{cases} \kappa(0) = \kappa_0 & \\[0.5em] \kappa(L) = \kappa_1 & \end{cases} \end{array} \end{split}\]

  note

  The solution do not exist for all the combination of points/angle/curvature

  Public Functions

  inline G2solveCLC()

    Build an empty clothoid list

  inline ~G2solveCLC()
  int build(real_type x0, real_type y0, real_type theta0, real_type kappa0, real_type x1, real_type y1, real_type theta1, real_type kappa1)

    Construct a piecewise clothoids \( G(s) \) composed by two clothoids and one line segment that solve the G2 problem, with data

    \[ \mathbf{p}_0 = (x_0,y_0)^T, \qquad \mathbf{p}_1 = (x_1,y_1)^T \]
    \[ \theta_0, \qquad \theta_1, \qquad \kappa_0, \qquad \kappa_1 \]
    Parameters

      - x0 – [in] \( x_0 \)

      - y0 – [in] \( y_0 \)

      - theta0 – [in] \( \theta_0 \)

      - kappa0 – [in] \( \kappa_0 \)

      - x1 – [in] \( x_1 \)

      - y1 – [in] \( y_1 \)

      - theta1 – [in] \( \theta_1 \)

      - kappa1 – [in] \( \kappa_1 \)

    Returns

      number of iterations of -1 if failed

  void setTolerance(real_type tol)

    Fix tolerance for the G2 problem

  void setMaxIter(int tol)

    Fix maximum number of iteration for the G2 problem

  int solve()

    Solve the G2 problem

    Returns

      number of iterations of -1 if failed

  inline ClothoidCurve const &getS0() const

    Return the first clothoid of the G2 clothoid list

  inline ClothoidCurve const &getSM() const

    Return the second segment (the line) as a clothoid

  inline ClothoidCurve const &getS1() const

    Return the third clothoid of the G2 clothoid list

  void save(ostream_type &stream) const