From e56d2d9b434622a63e1485ea5e16b945202d2ba6 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 1 Oct 2015 15:48:37 -0700 Subject: [PATCH] Add asserts --- libraries/shared/src/Interpolate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/shared/src/Interpolate.cpp b/libraries/shared/src/Interpolate.cpp index bc18c087ad..7acc0c8cbd 100644 --- a/libraries/shared/src/Interpolate.cpp +++ b/libraries/shared/src/Interpolate.cpp @@ -11,14 +11,18 @@ #include "Interpolate.h" +#include #include float Interpolate::bezierInterpolate(float y1, float y2, float y3, float u) { // https://en.wikipedia.org/wiki/Bezier_curve + assert(0.0f <= u && u <= 1.0f); return (1.0f - u) * (1.0f - u) * y1 + 2.0f * (1.0f - u) * u * y2 + u * u * y3; } float Interpolate::interpolate3Points(float y1, float y2, float y3, float u) { + assert(0.0f <= u && u <= 1.0f); + if (u <= 0.5f && y1 == y2 || u >= 0.5f && y2 == y3) { // Flat line. return y2;