提交 1a4fe801 编写于 作者: X Xiangquan Xiao 提交者: Jiaming Tao

Planning: Avoid duplicate code.

上级 4831bf88
......@@ -32,41 +32,6 @@ namespace planning {
using apollo::common::math::LineSegment2d;
using apollo::common::math::Vec2d;
STBoundary::STBoundary(
const std::vector<std::pair<STPoint, STPoint>>& point_pairs) {
CHECK(IsValid(point_pairs)) << "The input point_pairs are NOT valid";
std::vector<std::pair<STPoint, STPoint>> reduced_pairs(point_pairs);
RemoveRedundantPoints(&reduced_pairs);
for (const auto& item : reduced_pairs) {
// use same t for both points
const double t = item.first.t();
lower_points_.emplace_back(item.first.s(), t);
upper_points_.emplace_back(item.second.s(), t);
}
for (const auto& point : lower_points_) {
points_.emplace_back(point.t(), point.s());
}
for (auto rit = upper_points_.rbegin(); rit != upper_points_.rend(); ++rit) {
points_.emplace_back(rit->t(), rit->s());
}
BuildFromPoints();
for (const auto& point : lower_points_) {
min_s_ = std::fmin(min_s_, point.s());
}
for (const auto& point : upper_points_) {
max_s_ = std::fmax(max_s_, point.s());
}
min_t_ = lower_points_.front().t();
max_t_ = lower_points_.back().t();
obstacle_road_right_ending_t_ = std::numeric_limits<double>::lowest();
}
STBoundary::STBoundary(
const std::vector<std::pair<STPoint, STPoint>>& point_pairs,
bool is_accurate_boundary) {
......
......@@ -45,11 +45,9 @@ class STBoundary : public common::math::Polygon2d {
* Each pair refers to a time t, with (lower_s, upper_s).
*/
STBoundary() = default;
explicit STBoundary(
const std::vector<std::pair<STPoint, STPoint>>& point_pairs);
explicit STBoundary(
const std::vector<std::pair<STPoint, STPoint>>& point_pairs,
bool is_accurate_boundary);
bool is_accurate_boundary=false);
explicit STBoundary(const common::math::Box2d& box) = delete;
explicit STBoundary(std::vector<common::math::Vec2d> points) = delete;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册