mirror of
https://github.com/okalachev/flix.git
synced 2026-02-18 08:02:36 +00:00
Simplify code using angularRatesBetweenVectors
This commit is contained in:
@@ -36,12 +36,10 @@ void applyAcc()
|
||||
|
||||
// calculate accelerometer correction
|
||||
Vector up = attitude.rotate(Vector(0, 0, -1));
|
||||
Vector accCorrDirection = Vector::angularRatesBetweenVectors(acc, up);
|
||||
accCorrDirection.normalize();
|
||||
Vector accCorr = accCorrDirection * Vector::angleBetweenVectors(up, acc) * dt * WEIGHT_ACC;
|
||||
Vector correction = Vector::angularRatesBetweenVectors(acc, up) * dt * WEIGHT_ACC;
|
||||
|
||||
// apply correction
|
||||
attitude *= Quaternion::fromAngularRates(accCorr);
|
||||
attitude *= Quaternion::fromAngularRates(correction);
|
||||
attitude.normalize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user