Hi,
I've got an idea for a new formula:
the regular formula is :
Code: Select all
outputValue = smoothingStrength*previousValue + (1-smoothingStrength)*inputValue;
previousValue = outputValue;
and I propose :
Code: Select all
if ( | inputValue - previousInputValue | < | inputValue - previousOutputValue | )
outputValue = smoothingStrength*previousInputValue + (1-smoothingStrength)*inputValue;
else
outputValue = smoothingStrength*previousOutputValue + (1-smoothingStrength)*inputValue;
previousInputValue = inputValue;
previousOutputValue = outputValue ;
to show an exemple, I will compare the course between the regular formula and the proposed formula with 3 points : 1,2 and 3.
We will take 0.5 as smoothingStrength and compare all possible positions of 1,2 and 3
1......#......2...*..!......3
regular formula : positions will be 1 then # then *
proposed formula : positions will be 1 then # then !
1.............3.............2
regular formula : positions will be 1 then 3 then 3
proposed formula : positions will be 1 then 3 then 3 (same as regular formula)
2......#......1...*.........3
regular formula : positions will be 1 then # then *
proposed formula : positions will be 1 then # then * (same as regular formula)
2.............3.............1
same as 1.............3.............2
3.............1.............2
same as 2.............1.............3
3.............2.............1
same as 1.............2.............3
To sum up, the proposed formula is interesting when points succede far and far away in the same direction. The result output will be "more" authentic then the regular formula.
let's imagine distance between
1 and
2 is 41 and between
2 and
3 is 5
1....................#............*........2..!..3
regular formula : positions will be 1 then # then *
proposed formula : positions will be 1 then # then ! -> much more authentical and still smooth