提交 fd1c92ba 编写于 作者: D Dong Li 提交者: Liangliang Zhang

path: added next lane overlap function

上级 11aca940
......@@ -408,6 +408,17 @@ void Path::GetAllOverlaps(GetOverlapFromLaneFunc GetOverlaps_from_lane,
});
}
const PathOverlap* Path::NextLaneOverlap(double s) const {
auto next = std::upper_bound(
lane_overlaps_.begin(), lane_overlaps_.end(), s,
[](double s, const PathOverlap& o) { return s < o.start_s; });
if (next == lane_overlaps_.end()) {
return nullptr;
} else {
return &(*next);
}
}
void Path::InitOverlaps() {
GetAllOverlaps(std::bind(&LaneInfo::cross_lanes, _1), &lane_overlaps_);
GetAllOverlaps(std::bind(&LaneInfo::signals, _1), &signal_overlaps_);
......
......@@ -264,6 +264,8 @@ class Path {
const PathApproximation* approximation() const { return &approximation_; }
double length() const { return length_; }
const PathOverlap* NextLaneOverlap(double s) const;
const std::vector<PathOverlap>& lane_overlaps() const {
return lane_overlaps_;
}
......
......@@ -369,9 +369,7 @@ const std::vector<ReferencePoint>& ReferenceLine::reference_points() const {
return reference_points_;
}
const MapPath& ReferenceLine::map_path() const {
return map_path_;
}
const MapPath& ReferenceLine::map_path() const { return map_path_; }
bool ReferenceLine::GetLaneWidth(const double s, double* const left_width,
double* const right_width) const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册