Origin of the following equation

53 Views Asked by At
float xx = acceleration.x;
float yy = acceleration.y;
float zz = acceleration.z;

float dot = (px * xx) + (py * yy) + (pz * zz);
float a = ABS(sqrt(px * px + py * py + pz * pz));
float b = ABS(sqrt(xx * xx + yy * yy + zz * zz));

dot /= (a * b);

I run into the equation above on github, but I don't know what is it name, origin, field(DSP, some kind of high pass filter)?

$$ result= \frac{x_{prev} * x + y_{prev} * y + z_{prev} * z }{\sqrt{x^2 + y^2 + z^2} * \sqrt{(x_{prev}^2 + y_{prev}^2 + z_{prev}^2)}} $$

If my question is too obvious please forgive my ignorance, I hope that it is a real question and it not will be closed.