st_point.cc 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/******************************************************************************
 * Copyright 2017 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

/**
 * @file st_point.cpp
 **/

#include "modules/planning/common/speed/st_point.h"

#include <iomanip>
#include <sstream>

namespace apollo {
namespace planning {

D
Dong Li 已提交
29
STPoint::STPoint(const double s, const double t) : Vec2d(t, s){};
30

D
Dong Li 已提交
31
double STPoint::s() const { return y_; }
32

D
Dong Li 已提交
33
double STPoint::t() const { return x_; }
34

D
Dong Li 已提交
35
void STPoint::set_s(const double s) { return set_y(s); }
36

D
Dong Li 已提交
37
void STPoint::set_t(const double t) { return set_x(t); }
38 39

std::string STPoint::DebugString() const {
D
Dong Li 已提交
40 41 42 43 44
  std::ostringstream sout;
  sout << "{ \"s\" : " << std::setprecision(6) << s()
       << ", \"t\" : " << std::setprecision(6) << t() << " }";
  sout.flush();
  return sout.str();
45 46
}

D
Dong Li 已提交
47 48
}  // namespace planning
}  // namespace apollo