Apollo 10.0
自动驾驶开放平台
topo_range.cc
浏览该文件的文档.
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
18
19#include <algorithm>
20
22
23namespace apollo {
24namespace routing {
25
26bool NodeSRange::IsEnoughForChangeLane(double start_s, double end_s) {
27 return IsEnoughForChangeLane(end_s - start_s);
28}
29
31 return (length > FLAGS_min_length_for_lane_change);
32}
33
34NodeSRange::NodeSRange(double s1, double s2) : start_s_(s1), end_s_(s2) {}
35
36bool NodeSRange::operator<(const NodeSRange& other) const {
37 return StartS() < other.StartS();
38}
39
40bool NodeSRange::IsValid() const { return start_s_ <= end_s_; }
41
42double NodeSRange::StartS() const { return start_s_; }
43
44double NodeSRange::EndS() const { return end_s_; }
45
46double NodeSRange::Length() const { return end_s_ - start_s_; }
47
51
52void NodeSRange::SetStartS(double start_s) { start_s_ = start_s; }
53
54void NodeSRange::SetEndS(double end_s) { end_s_ = end_s; }
55
57 if (!IsValid() || !other.IsValid()) {
58 return false;
59 }
60 if (other.StartS() > EndS() || other.EndS() < StartS()) {
61 return false;
62 }
63 SetEndS(std::max(EndS(), other.EndS()));
64 SetStartS(std::min(StartS(), other.StartS()));
65 return true;
66}
67
68} // namespace routing
69} // namespace apollo
bool IsEnoughForChangeLane() const
Definition topo_range.cc:48
void SetEndS(double end_s)
Definition topo_range.cc:54
bool MergeRangeOverlap(const NodeSRange &other)
Definition topo_range.cc:56
void SetStartS(double start_s)
Definition topo_range.cc:52
bool operator<(const NodeSRange &other) const
Definition topo_range.cc:36
class register implement
Definition arena_queue.h:37