OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/vector2d_f.h" | 5 #include "ui/gfx/vector2d_f.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs) { | 54 double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs) { |
55 return static_cast<double>(lhs.x()) * rhs.y() - | 55 return static_cast<double>(lhs.x()) * rhs.y() - |
56 static_cast<double>(lhs.y()) * rhs.x(); | 56 static_cast<double>(lhs.y()) * rhs.x(); |
57 } | 57 } |
58 | 58 |
59 double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs) { | 59 double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs) { |
60 return static_cast<double>(lhs.x()) * rhs.x() + | 60 return static_cast<double>(lhs.x()) * rhs.x() + |
61 static_cast<double>(lhs.y()) * rhs.y(); | 61 static_cast<double>(lhs.y()) * rhs.y(); |
62 } | 62 } |
63 | 63 |
| 64 Vector2dF ScaleVector2d(const Vector2dF& v, float x_scale, float y_scale) { |
| 65 Vector2dF scaled_v(v); |
| 66 scaled_v.Scale(x_scale, y_scale); |
| 67 return scaled_v; |
| 68 } |
| 69 |
64 } // namespace gfx | 70 } // namespace gfx |
OLD | NEW |