scenario_simulator_v2 C++ API
polynomial_solver.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GEOMETRY__SOLVER__POLYNOMIAL_SOLVER_HPP_
16 #define GEOMETRY__SOLVER__POLYNOMIAL_SOLVER_HPP_
17 
18 #include <complex>
19 #include <vector>
20 
21 namespace math
22 {
23 namespace geometry
24 {
26 {
27 public:
36  const double a, const double b, const double min_value = 0, const double max_value = 1) const
37  -> std::vector<double>;
46  const double a, const double b, const double c, const double min_value = 0,
47  const double max_value = 1) const -> std::vector<double>;
57  auto solveCubicEquation(
58  const double a, const double b, const double c, const double d, const double min_value = 0,
59  const double max_value = 1) const -> std::vector<double>;
68  auto linear(const double a, const double b, const double t) const -> double;
78  auto quadratic(const double a, const double b, const double c, const double t) const -> double;
89  auto cubic(const double a, const double b, const double c, const double d, const double t) const
90  -> double;
102  constexpr static double tolerance = 1e-7;
103 
104 private:
112  auto solveMonicCubicEquationWithComplex(const double a, const double b, const double c) const
113  -> std::vector<std::complex<double>>;
119  auto filterByRange(
120  const std::vector<double> & values, const double min_value, const double max_value) const
121  -> std::vector<double>;
129  auto isApproximatelyEqualTo(const double value0, const double value1) const -> bool;
130 };
131 } // namespace geometry
132 } // namespace math
133 
134 #endif // GEOMETRY__SOLVER__POLYNOMIAL_SOLVER_HPP_
Definition: polynomial_solver.hpp:26
auto linear(const double a, const double b, const double t) const -> double
calculate result of linear function a*t + b
Definition: polynomial_solver.cpp:30
auto solveCubicEquation(const double a, const double b, const double c, const double d, const double min_value=0, const double max_value=1) const -> std::vector< double >
solve cubic function a*t^3 + b*t^2 + c*t + d = 0
Definition: polynomial_solver.cpp:94
auto cubic(const double a, const double b, const double c, const double d, const double t) const -> double
calculate result of cubic function a*t^3 + b*t^2 + c*t + d
Definition: polynomial_solver.cpp:41
auto solveQuadraticEquation(const double a, const double b, const double c, const double min_value=0, const double max_value=1) const -> std::vector< double >
solve quadratic equation a*x^2 + b*x + c = 0
Definition: polynomial_solver.cpp:73
auto quadratic(const double a, const double b, const double c, const double t) const -> double
calculate result of quadratic function a*t^2 + b*t + c
Definition: polynomial_solver.cpp:35
auto solveLinearEquation(const double a, const double b, const double min_value=0, const double max_value=1) const -> std::vector< double >
solve linear equation a*x + b = 0
Definition: polynomial_solver.cpp:47
constexpr static double tolerance
Hard coded parameter, tolerance of calculation results of the PolynomialSolver. This value was determ...
Definition: polynomial_solver.hpp:102
Definition: bounding_box.hpp:32