Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
math.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef MATH_H
22 #define MATH_H
23 
24 #include <QRect>
25 
26 int lerp(int a, int b, double t);
27 float float_lerp(float a, float b, float t);
28 double double_lerp(double a, double b, double t);
29 double quad_from_t(double a, double b, double c, double t);
30 double quad_t_from_x(double x, double a, double b, double c);
31 double cubic_from_t(double a, double b, double c, double d, double t);
32 double cubic_t_from_x(double x_target, double a, double b, double c, double d);
33 double solveCubicBezier(double p0, double p1, double p2, double p3, double x);
34 
35 QRect fit_size_into_rect(const QRect& r, int width, int height);
36 
37 // decibel conversion functions
38 double amplitude_to_db(double amplitude);
39 double db_to_amplitude(double db);
40 
41 #endif // MATH_H
float float_lerp(float a, float b, float t)
Definition: math.cpp:32
uniform vec2 p1
Definition: cornerpin.vert:5
uniform vec2 p2
Definition: cornerpin.vert:6
double db_to_amplitude(double db)
Definition: math.cpp:80
double quad_from_t(double a, double b, double c, double t)
Definition: math.cpp:40
QRect fit_size_into_rect(const QRect &r, int width, int height)
Definition: math.cpp:84
uniform vec2 p0
Definition: cornerpin.vert:4
int lerp(int a, int b, double t)
Definition: math.cpp:28
double cubic_from_t(double a, double b, double c, double d, double t)
Definition: math.cpp:49
double cubic_t_from_x(double x_target, double a, double b, double c, double d)
Definition: math.cpp:53
double solveCubicBezier(double p0, double p1, double p2, double p3, double x)
uniform vec2 p3
Definition: cornerpin.vert:7
double quad_t_from_x(double x, double a, double b, double c)
Definition: math.cpp:44
double double_lerp(double a, double b, double t)
Definition: math.cpp:36
double amplitude_to_db(double amplitude)
Definition: math.cpp:76