Chromium Code Reviews| Index: cc/math_util.cc |
| diff --git a/cc/math_util.cc b/cc/math_util.cc |
| index 83d156cc333ddb395608c5acda019edd0e7a0457..81f1e7d37fcc5aa8ad119e11dd875991a75b61e8 100644 |
| --- a/cc/math_util.cc |
| +++ b/cc/math_util.cc |
| @@ -9,6 +9,7 @@ |
| #include <cmath> |
| #include <limits> |
| +#include "cc/geometry.h" |
|
danakj
2012/11/05 21:13:30
not needed now, will remove.
|
| #include "ui/gfx/quad_f.h" |
| #include "ui/gfx/rect.h" |
| #include "ui/gfx/rect_conversions.h" |
| @@ -20,6 +21,9 @@ using WebKit::WebTransformationMatrix; |
| namespace cc { |
| +const double MathUtil::PI_DOUBLE = 3.14159265358979323846; |
| +const float MathUtil::PI_FLOAT = 3.14159265358979323846f; |
| + |
| static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const gfx::PointF& p) |
| { |
| // In this case, the layer we are trying to project onto is perpendicular to ray |
| @@ -380,18 +384,12 @@ gfx::Vector2dF MathUtil::computeTransform2dScaleComponents(const WebTransformati |
| return gfx::Vector2dF(xScale, yScale); |
| } |
| -static inline double rad2deg(double r) |
| -{ |
| - double pi = 3.14159265358979323846; |
| - return r * 180.0 / pi; |
| -} |
| - |
| float MathUtil::smallestAngleBetweenVectors(gfx::Vector2dF v1, gfx::Vector2dF v2) |
| { |
| double dotProduct = gfx::DotProduct(v1, v2) / v1.Length() / v2.Length(); |
| // Clamp to compensate for rounding errors. |
| dotProduct = std::max(-1.0, std::min(1.0, dotProduct)); |
| - return static_cast<float>(rad2deg(std::acos(dotProduct))); |
| + return static_cast<float>(Rad2Deg(std::acos(dotProduct))); |
| } |
| gfx::Vector2dF MathUtil::projectVector(gfx::Vector2dF source, gfx::Vector2dF destination) |