25 static constexpr T
Pi() {
26 static_assert(std::is_floating_point<T>::value,
"type must be floating point");
27 return static_cast<T
>(3.14159265358979323846264338327950288);
31 static constexpr T
Pi2() {
32 static_assert(std::is_floating_point<T>::value,
"type must be floating point");
33 return static_cast<T
>(
static_cast<T
>(2) * Pi<T>());
38 static_assert(std::is_floating_point<T>::value,
"type must be floating point");
39 return rad * (T(180.0) / Pi<T>());
44 static_assert(std::is_floating_point<T>::value,
"type must be floating point");
45 return deg * (Pi<T>() / T(180.0));
49 static T
Clamp(T a, T
min = T(0), T max = T(1)) {
50 return std::min(std::max(a,
min), max);
63 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
67 return a.
x * b.
x + a.
y * b.
y;
87 return a * (1.0f - f) + (b * f);
double min(double v1, double v2)
static auto Cross(const Vector3D &a, const Vector3D &b)
static auto DistanceSquared2D(const Vector3D &a, const Vector3D &b)
static Vector3D GetRightVector(const Rotation &rotation)
Compute the unit vector pointing towards the Y-axis of rotation.
static constexpr T ToRadians(T deg)
static float LinearLerp(float a, float b, float f)
static double GetVectorAngle(const Vector3D &a, const Vector3D &b)
Returns the angle between 2 vectors in radians
static Vector3D GetUpVector(const Rotation &rotation)
Compute the unit vector pointing towards the Y-axis of rotation.
static auto Distance2D(const Vector3D &a, const Vector3D &b)
static std::vector< int > GenerateRange(int a, int b)
static Vector3D RotatePointOnOrigin2D(Vector3D p, float angle)
static auto DistanceSquared(const Vector3D &a, const Vector3D &b)
static T Clamp(T a, T min=T(0), T max=T(1))
static auto Dot(const Vector3D &a, const Vector3D &b)
static Vector3D GetForwardVector(const Rotation &rotation)
Compute the unit vector pointing towards the X-axis of rotation.
static std::pair< float, float > DistanceSegmentToPoint(const Vector3D &p, const Vector3D &v, const Vector3D &w)
Returns a pair containing:
static T Square(const T &a)
static auto Distance(const Vector3D &a, const Vector3D &b)
static constexpr T ToDegrees(T rad)
static auto Dot2D(const Vector3D &a, const Vector3D &b)
static std::pair< float, float > DistanceArcToPoint(Vector3D p, Vector3D start_pos, float length, float heading, float curvature)
Returns a pair containing:
This file contains definitions of common data structures used in traffic manager.