libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::math Namespace Reference

Typedefs

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

Functions

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

Typedef Documentation

◆ InterpolationFunction

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

Definition at line 10 of file math.hpp.

Function Documentation

◆ clampDouble()

double libstp::math::clampDouble ( double value,
double min,
double max )

Clamp a double to the inclusive range [min, max].

◆ clampf()

float libstp::math::clampf ( float value,
float min,
float max )

Clamp a float to the inclusive range [min, max].

◆ clampInt()

int libstp::math::clampInt ( int value,
int min,
int max )

Clamp an integer to the inclusive range [min, max].

◆ easeInOut()

float libstp::math::easeInOut ( float a,
float b,
float t )

Cosine-smoothed interpolation between a and b for parameter t.

◆ lerp()

float libstp::math::lerp ( float a,
float b,
float t )

Linear interpolation between a and b for parameter t.

◆ minimalAngleDifference()

float libstp::math::minimalAngleDifference ( float a,
float b )

Return the smallest absolute angular separation between a and b in radians.

◆ quaternionToEuler()

std::tuple< double, double, double > libstp::math::quaternionToEuler ( Eigen::Quaterniond q)

Convert a quaternion to roll, pitch, yaw in radians.

◆ sign()

int libstp::math::sign ( int value)

Return -1, 0, or 1 depending on the sign of value.

◆ signf()

float libstp::math::signf ( float value)

Return -1.0f, 0.0f, or 1.0f depending on the sign of value.