Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17ajf by
Math/Math.h
- Committer:
- el17ajf
- Date:
- 2019-05-09
- Revision:
- 44:44aa01af687e
- Parent:
- 39:e128071a95b0
File content as of revision 44:44aa01af687e:
#ifndef MATH_H
#define MATH_H
/**
* Namespace for maths-related helper functions
*/
namespace Math {
/**
* @brief lerp with a default value basically
* a 'curried' lerp with t = 0.6
* @see lerp
* @returns lerp(a, b, 0.6)
*/
int lerp(int a, int b);
/**
* @brief Linear Interpolation, but works for ints
* so you never lerp to the same value twice, the
* minimum | a - b | is 1.
* @param a The starting value (t = 0)
* @param b The value when t = 1
* @param t The amount to interpolate
* @returns a * (t - 1) + b * t
*/
int lerp(int a, int b, double t);
}
#endif
