Apollo 10.0
自动驾驶开放平台
interpolation_2d.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
21#pragma once
22
23#include <map>
24#include <memory>
25#include <tuple>
26#include <utility>
27#include <vector>
28
33namespace apollo {
34namespace control {
41 public:
42 typedef std::vector<std::tuple<double, double, double>> DataType;
43 typedef std::pair<double, double> KeyType;
44
45 Interpolation2D() = default;
46
52 bool Init(const DataType &xyz);
53
59 double Interpolate(const KeyType &xy) const;
60
61 bool CheckMap() const;
62
63 private:
64 double InterpolateYz(const std::map<double, double> &yz_table,
65 double y) const;
66
67 double InterpolateValue(const double value_before, const double dist_before,
68 const double value_after,
69 const double dist_after) const;
70
71 std::map<double, std::map<double, double>> xyz_;
72};
73
74} // namespace control
75} // namespace apollo
linear interpolation from key (double, double) to one double value.
bool Init(const DataType &xyz)
initialize Interpolation2D internal table
std::pair< double, double > KeyType
std::vector< std::tuple< double, double, double > > DataType
double Interpolate(const KeyType &xy) const
linear interpolate from 2D key (double, double) to one double value.
class register implement
Definition arena_queue.h:37