Merge "fix [3452750] Issue 14634: SensorManager.getRotationMatrixFromVector gets NaN-Values [external] [DO NOT MERGE]" into gingerbread

This commit is contained in:
Mathias Agopian
2011-03-09 16:54:21 -08:00
committed by Android (Google) Code Review

View File

@ -1970,7 +1970,8 @@ public class SensorManager
if (rotationVector.length == 4) {
q0 = rotationVector[3];
} else {
q0 = (float)Math.sqrt(1 - q1*q1 - q2*q2 - q3*q3);
q0 = 1 - q1*q1 - q2*q2 - q3*q3;
q0 = (q0 > 0) ? (float)Math.sqrt(q0) : 0;
}
float sq_q1 = 2 * q1 * q1;