libstp
Robotics library for Botball
Loading...
Searching...
No Matches
math.hpp File Reference
#include <functional>
#include "pch.hpp"
Include dependency graph for math.hpp:

Go to the source code of this file.

Namespaces

namespace  libstp
namespace  libstp::math

Typedefs

using libstp::math::InterpolationFunction = std::function<float(float, float, float)>

Functions

float libstp::math::lerp (float a, float b, float t)
 Linear interpolation between a and b for parameter t.
float libstp::math::easeInOut (float a, float b, float t)
 Cosine-smoothed interpolation between a and b for parameter t.
float libstp::math::clampf (float value, float min, float max)
 Clamp a float to the inclusive range [min, max].
double libstp::math::clampDouble (double value, double min, double max)
 Clamp a double to the inclusive range [min, max].
int libstp::math::clampInt (int value, int min, int max)
 Clamp an integer to the inclusive range [min, max].
int libstp::math::sign (int value)
 Return -1, 0, or 1 depending on the sign of value.
float libstp::math::signf (float value)
 Return -1.0f, 0.0f, or 1.0f depending on the sign of value.
float libstp::math::minimalAngleDifference (float a, float b)
 Return the smallest absolute angular separation between a and b in radians.
std::tuple< double, double, double > libstp::math::quaternionToEuler (Eigen::Quaterniond q)
 Convert a quaternion to roll, pitch, yaw in radians.

Variables

constexpr double RAD_TO_DEG = 180.0 / M_PI
 Angle conversion helpers shared across robotics code.
constexpr double DEG_TO_RAD = M_PI / 180.0

Variable Documentation

◆ DEG_TO_RAD

double DEG_TO_RAD = M_PI / 180.0
constexpr

Definition at line 7 of file math.hpp.

◆ RAD_TO_DEG

double RAD_TO_DEG = 180.0 / M_PI
constexpr

Angle conversion helpers shared across robotics code.

Definition at line 6 of file math.hpp.