1
/****************************************************************************
2
Copyright (C) 2010 Laszlo Simon <laszlo.simon@gmail.com>
4
This file is part of the HidraVFX project.
6
HidraVFX 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.
11
HidraVFX 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.
16
You should have received a copy of the GNU General Public License
17
along with HidraVFX. If not, see <http://www.gnu.org/licenses/>.
18
****************************************************************************/
23
static inline float linear1(float x1, float x2, float u)
25
return(x1*(1-u)+x2*u);
28
static inline float linear2(float x11, float x21, float x12, float x22, float u,float v)
30
return ((1-u)*x11+u*x21)*(1-v)+v*((1-u)*x12+u*x22);
33
static inline float cosine1(float x1, float x2,float u)
35
u = (1-cos(u*PI))*0.5;
36
return (x1*(1-u)+x2*u);
39
static inline float cosine2(float x11, float x21, float x12, float x22, float u, float v)
41
u = (1-cos(u*PI))*0.5;
42
v = (1-cos(v*PI))*0.5;
43
return ((x11*(1-u)+x21*u)*(1-v)+(x12*(1-u)+x22*u)*v);
46
static inline float cubic1(float x1, float x2, float u)
48
u =(4/9)*pow(u,6)-(17/9)*pow(u,4)+(22/9)*sqr(u);
49
return(x1*(1-u)+x2*u);
52
static inline float cubic2(float x11, float x21, float x12, float x22, float u, float v)
54
u = (4/9)*pow(u,6)-(17/9)*pow(u,4)+(22/9)*sqr(u);
55
v = (4/9)*pow(v,6)-(17/9)*pow(v,4)+(22/9)*sqr(v);
56
return((x11*(1-u)+x21*u)*(1-v)+(x12*(1-u)+x22*u)*v);