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

Unified Diff: ui/gfx/geometry/quaternion.cc

Issue 2971903005: Fix matrix interpolation between rotations of 180 degrees (Closed)
Patch Set: forgot to revert a corresponding unit test Created 3 years, 5 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 | « no previous file | ui/gfx/geometry/quaternion_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/quaternion.cc
diff --git a/ui/gfx/geometry/quaternion.cc b/ui/gfx/geometry/quaternion.cc
index edacdda34473178849a9e4231261f678443180a2..9da8f4711140a0a6f2ed7572b2ef40d6aa210eaa 100644
--- a/ui/gfx/geometry/quaternion.cc
+++ b/ui/gfx/geometry/quaternion.cc
@@ -66,15 +66,6 @@ Quaternion Quaternion::Slerp(const Quaternion& q, double t) const {
if (std::abs(dot - 1.0) < kEpsilon || std::abs(dot + 1.0) < kEpsilon)
return *this;
- // TODO(vmpstr): In case the dot is 0, the vectors are exactly opposite
- // of each other. In this case, it's technically not correct to just pick one
- // of the vectors, we instead need to pick how to interpolate. However, the
- // spec isn't clear on this. If we don't handle the -1 case explicitly, it
- // results in inf and nans however, which is worse. See crbug.com/506543 for
- // more discussion.
- if (std::abs(dot) < kEpsilon)
- return *this;
-
double denom = std::sqrt(1.0 - dot * dot);
double theta = std::acos(dot);
double w = std::sin(t * theta) * (1.0 / denom);
« no previous file with comments | « no previous file | ui/gfx/geometry/quaternion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698