Apollo 10.0
自动驾驶开放平台
interpolation_2d.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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#pragma once
17
18#include <map>
19#include <memory>
20#include <tuple>
21#include <utility>
22#include <vector>
23
24namespace apollo {
25namespace dreamview {
26
28 public:
29 typedef std::vector<std::tuple<double, double, double>> DataType;
30 typedef std::pair<double, double> KeyType;
31
32 Interpolation2D() = default;
33
34 // Return true if init is ok.
35 bool init(const DataType& xyz);
36
37 double Interpolate(const KeyType& xy) const;
38
39 private:
40 double InterpolateYz(const std::map<double, double>& yz_table,
41 double y) const;
42
43 double InterpolateValue(const double value_before, const double dist_before,
44 const double value_after,
45 const double dist_after) const;
46
47 std::map<double, std::map<double, double>> _xyz;
48};
49
50} // namespace dreamview
51} // namespace apollo
std::vector< std::tuple< double, double, double > > DataType
std::pair< double, double > KeyType
double Interpolate(const KeyType &xy) const
class register implement
Definition arena_queue.h:37