FastSmoother hinzugefügt

thobaben_serialize
Harald Wolff 2016-04-28 16:26:13 +02:00
parent 0772048927
commit 17fa3cbe0f
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
package org.hwo;
public class FastSmoother {
private float tn;
private float sum;
private float value;
public FastSmoother(float tn){
this.sum = 0;
this.tn = tn;
this.value = 0;
}
public float smooth(float sample){
this.sum += sample;
this.value = this.sum / this.tn;
this.sum -= this.value;
return this.value;
}
public float getValue() {
return value;
}
public float getSum() {
return sum;
}
public void setSum(float sum) {
this.sum = sum;
}
public void setValue(float value) {
this.value = value;
this.sum = (value * this.tn) - value;
}
}