package my10;
/**
 *
 * @author Viliam Krizan
 */



public class MouseData {
    
    private int actualX=0;
    private int prev1X=0;
    private int prev2X=0;
    
    private int actualY=0;
    private int prev1Y=0;
    private int prev2Y=0;
    
    private int entropyX;
    private int entropyY;
    private int[] data = new int[2];
    
    
    public  int[] processData(int x, int y){
        prev2X = prev1X;
        prev1X = actualX;
        actualX = x;
        
        prev2Y = prev1Y;
        prev1Y = actualY;
        actualY = y;
        
        derivation();
        data[0] = entropyX;
        data[1] = entropyY;
        return data;
    }
    
    private  void derivation(){
        entropyX  = actualX - 2*prev1X + prev2X;
        entropyY  = actualY - 2*prev1Y + prev2Y;
    }
}
