Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: device/vr/vr_math.cc

Issue 2853843002: Fix controller positioning in VrShell when gyro reads are small (Closed)
Patch Set: Dchecking not null quat Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/elbow_model.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_math.cc
diff --git a/device/vr/vr_math.cc b/device/vr/vr_math.cc
index 567fe6f0f43f2e610c1e22893d2f823114f02a63..8d5d43797816ee847c2bc48756df59b08d161931 100644
--- a/device/vr/vr_math.cc
+++ b/device/vr/vr_math.cc
@@ -120,6 +120,9 @@ float NormalizeVector(gfx::Vector3dF* vec) {
void NormalizeQuat(Quatf* quat) {
float len = sqrt(quat->qx * quat->qx + quat->qy * quat->qy +
quat->qz * quat->qz + quat->qw * quat->qw);
+ DCHECK_NE(len, 0);
+ if (len == 0)
+ return;
quat->qx /= len;
quat->qy /= len;
quat->qz /= len;
« no previous file with comments | « chrome/browser/android/vr_shell/elbow_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698