CARLA
RoadInfoElevation.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
11 
12 namespace carla {
13 namespace road {
14 namespace element {
15 
16  class RoadInfoElevation final : public RoadInfo {
17  public:
18 
20  double s,
21  double a, // elevation
22  double b, // slope
23  double c, // vertical_curvature
24  double d) // curvature_change
25  : RoadInfo(s),
26  _elevation(a, b, c, d, s) {}
27 
28  void AcceptVisitor(RoadInfoVisitor &v) final {
29  v.Visit(*this);
30  }
31 
32  /// @todo unused? you can use the polynomial directly.
33  double Evaluate(const double dist, double &out_tan) const {
34  out_tan = _elevation.Tangent(dist);
35  return _elevation.Evaluate(dist);
36  }
37 
39  return _elevation;
40  }
41 
42  private:
43 
45  };
46 
47 } // namespace element
48 } // namespace road
49 } // namespace carla
void AcceptVisitor(RoadInfoVisitor &v) final
Describes a Cubic Polynomial so: f(x) = a + bx + cx^2 + dx^3.
RoadInfoElevation(double s, double a, double b, double c, double d)
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
const geom::CubicPolynomial & GetPolynomial() const
value_type Evaluate(const value_type &x) const
Evaluates f(x) = a + bx + cx^2 + dx^3.
value_type Tangent(const value_type &x) const
Evaluates the tangent using df/dx = b + 2cx + 3dx^2.
double Evaluate(const double dist, double &out_tan) const
const geom::CubicPolynomial _elevation