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
Diff: Math/Math.h
- Revision:
- 39:e128071a95b0
- Parent:
- 28:e09b7ac11dea
--- a/Math/Math.h Sat Apr 27 16:06:33 2019 +0000
+++ b/Math/Math.h Mon Apr 29 16:30:47 2019 +0000
@@ -1,8 +1,27 @@
#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);
}
