ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
cubicpiecewisefunction.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Reza Dariani - initial API and implementation
13  ********************************************************************************/
14 
15 #pragma once
16 #include <iostream>
17 #include <fstream>
18 #include <string>
19 #include <valarray>
20 #include <math.h>
21 #include <stdio.h>
22 #include <iomanip>
23 #include "dlib/matrix/matrix.h"
24 #include "dlib/matrix.h"
26 #include <vector>
27 namespace adore
28 {
29  namespace mad
30  {
36  {
37  private:
38  static inline void repeatedValueInterpolation(double *output_x, double *output_y, double *output_weight,int *outputLength,double *input_x, double *input_y, double *input_weight,int inputLength);
39 
41  {
42  std::vector<double> lc_breaks;
43  std::vector<int> lc_index;
44  };
45 
46  public:
47  /***
48  Pieceweise Polynomial structure
49  */
51  {
52  double *breaks;
53  double *coef_1;
54  double *coef_2;
55  double *coef_3;
56  double *coef_4;
57  int dimension ;
58  };
66  static void BreaksGenerator(double *Userbreaks,int UserbreaksLength,double start, double resolution);
74  static std::vector<double> BreaksGenerator(double start, double end, int NumberOfPoints);
83  static void BreaksGeneratorExp(double *Userbreaks, int NumOfPoints, double start, double end);
93  static void smoothingSpline(PieceweisePolynomial* pp, double* input_x, double* input_y, double* input_w, int inputLength,double smoothingFactor);
103  static void fit(PieceweisePolynomial* pp, double* input_x, double* input_y, double* input_w, int inputLength,double smoothingFactor);
110  static LocalCoordination localCoordination(double *Userbreaks, int UserbreaksLength, PieceweisePolynomial &pp);
121  static void CubicSplineEvaluation( double *interpolatedSpline,double *d_interpolatedSpline,double *dd_interpolatedSpline,double *ddd_interpolatedSpline, double *Userbreaks,int UserbreaksLength,PieceweisePolynomial &pp);
131  static void CubicSplineEvaluation( double *interpolatedSpline,double *d_interpolatedSpline,double *dd_interpolatedSpline, double *Userbreaks,int UserbreaksLength, PieceweisePolynomial &pp);
140  static void CubicSplineEvaluation( double *interpolatedSpline,double *d_interpolatedSpline, double *Userbreaks,int UserbreaksLength, PieceweisePolynomial &pp);
148  static void CubicSplineEvaluation( double *interpolatedSpline, double *Userbreaks,int UserbreaksLength, PieceweisePolynomial &pp);
159  static void toPolynomialFrom(PieceweisePolynomial* pp,double *input_breaks,double *input_coef1,double *input_coef2,double *input_coef3,double *input_coef4,int inputLength);
166  static int findIndex (double point, PieceweisePolynomial &pp);
174  static double splineEvaluation(int index, double point, PieceweisePolynomial &pp );
179  static void deleteCubicSplinepp(PieceweisePolynomial& pp);
185 
186 
187 
188  };
189  }
190 }
Definition: cubicpiecewisefunction.h:36
static void BreaksGenerator(double *Userbreaks, int UserbreaksLength, double start, double resolution)
Definition: cubic_piecewise_function.cpp:40
static void BreaksGeneratorExp(double *Userbreaks, int NumOfPoints, double start, double end)
Definition: cubic_piecewise_function.cpp:61
static double splineEvaluation(int index, double point, PieceweisePolynomial &pp)
Definition: cubic_piecewise_function.cpp:553
static void CubicSplineEvaluation(double *interpolatedSpline, double *d_interpolatedSpline, double *dd_interpolatedSpline, double *ddd_interpolatedSpline, double *Userbreaks, int UserbreaksLength, PieceweisePolynomial &pp)
Definition: cubic_piecewise_function.cpp:134
static void deleteCubicSplinepp(PieceweisePolynomial &pp)
Definition: cubic_piecewise_function.cpp:506
static void fit(PieceweisePolynomial *pp, double *input_x, double *input_y, double *input_w, int inputLength, double smoothingFactor)
Definition: cubic_piecewise_function.cpp:256
static void deleteCubicSplinepp1(PieceweisePolynomial *pp)
Definition: cubic_piecewise_function.cpp:515
static LocalCoordination localCoordination(double *Userbreaks, int UserbreaksLength, PieceweisePolynomial &pp)
Definition: cubic_piecewise_function.cpp:78
static void smoothingSpline(PieceweisePolynomial *pp, double *input_x, double *input_y, double *input_w, int inputLength, double smoothingFactor)
Definition: cubic_piecewise_function.cpp:262
static void toPolynomialFrom(PieceweisePolynomial *pp, double *input_breaks, double *input_coef1, double *input_coef2, double *input_coef3, double *input_coef4, int inputLength)
Definition: cubic_piecewise_function.cpp:21
static void repeatedValueInterpolation(double *output_x, double *output_y, double *output_weight, int *outputLength, double *input_x, double *input_y, double *input_weight, int inputLength)
Definition: cubic_piecewise_function.cpp:146
static int findIndex(double point, PieceweisePolynomial &pp)
Definition: cubic_piecewise_function.cpp:525
Definition: areaofeffectconverter.h:20
Definition: cubicpiecewisefunction.h:41
std::vector< int > lc_index
Definition: cubicpiecewisefunction.h:43
std::vector< double > lc_breaks
Definition: cubicpiecewisefunction.h:42
Definition: cubicpiecewisefunction.h:51
double * coef_1
Definition: cubicpiecewisefunction.h:53
double * coef_3
Definition: cubicpiecewisefunction.h:55
int dimension
Definition: cubicpiecewisefunction.h:57
double * breaks
Definition: cubicpiecewisefunction.h:52
double * coef_2
Definition: cubicpiecewisefunction.h:54
double * coef_4
Definition: cubicpiecewisefunction.h:56