Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
Loading...
Searching...
No Matches
Functions
rdlib_maths Namespace Reference

Name space for maths related utilities. More...

Functions

int mapValue (int x, int in_min, int in_max, int out_min, int out_max)
 Maps a value from one range to another using linear interpolation. This function takes an input value within a specified range and maps it to a corresponding value in a different output range using std::lerp.
 
float sineFromDegrees (float angle)
 Computes the sine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the sine of that angle using the standard C++ sin function.
 
float cosineFromDegrees (float angle)
 Computes the cosine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the cosine of that angle using the standard C++ cos function.
 

Detailed Description

Name space for maths related utilities.

Function Documentation

◆ cosineFromDegrees()

float rdlib_maths::cosineFromDegrees ( float  angle)

Computes the cosine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the cosine of that angle using the standard C++ cos function.

Parameters
angleThe angle in degrees.
Returns
The cosine value of the given angle.

◆ mapValue()

int rdlib_maths::mapValue ( int  x,
int  in_min,
int  in_max,
int  out_min,
int  out_max 
)

Maps a value from one range to another using linear interpolation. This function takes an input value within a specified range and maps it to a corresponding value in a different output range using std::lerp.

Parameters
xThe input value to map.
in_minThe lower bound of the input range.
in_maxThe upper bound of the input range.
out_minThe lower bound of the output range.
out_maxThe upper bound of the output range.
Returns
The mapped value in the output range.

◆ sineFromDegrees()

float rdlib_maths::sineFromDegrees ( float  angle)

Computes the sine of an angle given in degrees. This function converts the input angle from degrees to radians and then calculates the sine of that angle using the standard C++ sin function.

Parameters
angleThe angle in degrees.
Returns
The sine value of the given angle.