Overte C++ Documentation
Interpolate.h
1 //
2 // Interpolate.h
3 // libraries/shared/src
4 //
5 // Created by David Rowe on 10 Sep 2015.
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_Interpolate_h
13 #define hifi_Interpolate_h
14 
15 #include "SharedUtil.h"
16 
17 class Interpolate {
18 
19 public:
20  // Bezier interpolate at position u [0.0 - 1.0] between y values equally spaced along the x-axis. The interpolated values
21  // pass through y1 and y3 but not y2; y2 is the Bezier control point.
22  static float bezierInterpolate(float y1, float y2, float y3, float u);
23 
24  // Interpolate at position u [0.0 - 1.0] between y values equally spaced along the x-axis such that the interpolated values
25  // pass through all three y values. Return value lies wholly within the range of y values passed in.
26  static float interpolate3Points(float y1, float y2, float y3, float u);
27 
28  // returns smooth in and out blend between 0 and 1
29  // DANGER: assumes fraction is properly inside range [0, 1]
30  static float simpleNonLinearBlend(float fraction);
31 
32  static float calculateFadeRatio(quint64 start);
33 
34  // Basic ease-in-ease-out function for smoothing values.
35  static float easeInOutQuad(float lerpValue);
36 };
37 
38 #endif // hifi_Interpolate_h