Apollo  6.0
Open source self driving car software
Namespaces | Functions
math_utils.h File Reference

Math-related util functions. More...

#include <cmath>
#include <limits>
#include <type_traits>
#include <utility>
#include "Eigen/Dense"
#include "modules/common/math/vec2d.h"
Include dependency graph for math_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 apollo::common::math
 apollo::common::math
 
 apollo
 PlanningContext is the runtime context in planning. It is persistent across multiple frames.
 
 apollo::common
 apollo::common
 

Functions

double apollo::common::math::Sqr (const double x)
 
double apollo::common::math::CrossProd (const Vec2d &start_point, const Vec2d &end_point_1, const Vec2d &end_point_2)
 Cross product between two 2-D vectors from the common start point, and end at two other points. More...
 
double apollo::common::math::InnerProd (const Vec2d &start_point, const Vec2d &end_point_1, const Vec2d &end_point_2)
 Inner product between two 2-D vectors from the common start point, and end at two other points. More...
 
double apollo::common::math::CrossProd (const double x0, const double y0, const double x1, const double y1)
 Cross product between two vectors. One vector is formed by 1st and 2nd parameters of the function. The other vector is formed by 3rd and 4th parameters of the function. More...
 
double apollo::common::math::InnerProd (const double x0, const double y0, const double x1, const double y1)
 Inner product between two vectors. One vector is formed by 1st and 2nd parameters of the function. The other vector is formed by 3rd and 4th parameters of the function. More...
 
double apollo::common::math::WrapAngle (const double angle)
 Wrap angle to [0, 2 * PI). More...
 
double apollo::common::math::NormalizeAngle (const double angle)
 Normalize angle to [-PI, PI). More...
 
double apollo::common::math::AngleDiff (const double from, const double to)
 Calculate the difference between angle from and to. More...
 
int apollo::common::math::RandomInt (const int s, const int t, unsigned int rand_seed=1)
 Get a random integer between two integer values by a random seed. More...
 
double apollo::common::math::RandomDouble (const double s, const double t, unsigned int rand_seed=1)
 Get a random double between two integer values by a random seed. More...
 
template<typename T >
apollo::common::math::Square (const T value)
 Compute squared value. More...
 
template<typename T >
apollo::common::math::Clamp (const T value, T bound1, T bound2)
 Clamp a value between two bounds. If the value goes beyond the bounds, return one of the bounds, otherwise, return the original value. More...
 
double apollo::common::math::Gaussian (const double u, const double std, const double x)
 
double apollo::common::math::Sigmoid (const double x)
 
Eigen::Vector2d apollo::common::math::RotateVector2d (const Eigen::Vector2d &v_in, const double theta)
 
std::pair< double, double > apollo::common::math::RFUToFLU (const double x, const double y)
 
std::pair< double, double > apollo::common::math::FLUToRFU (const double x, const double y)
 
void apollo::common::math::L2Norm (int feat_dim, float *feat_data)
 
std::pair< double, double > apollo::common::math::Cartesian2Polar (double x, double y)
 
template<class T >
std::enable_if<!std::numeric_limits< T >::is_integer, bool >::type apollo::common::math::almost_equal (T x, T y, int ulp)
 

Detailed Description

Math-related util functions.