ControlMath: math optimization

This commit is contained in:
Dennis Mannhart
2018-08-15 15:11:47 +02:00
committed by Dennis Mannhart
parent d94778dd94
commit a9d83b77de
@@ -166,7 +166,7 @@ matrix::Vector2f constrainXY(const matrix::Vector2f &v0, const matrix::Vector2f
matrix::Vector2f u1 = v1.normalized();
float m = u1.dot(v0);
float c = v0.length() * v0.length() - max * max;
float c = v0.dot(v0) - max * max;
float s = -m + sqrtf(m * m - c);
return v0 + u1 * s;
}