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 // Defines a simple float vector class. This class is used to indicate a | 5 // Defines a simple float vector class. This class is used to indicate a |
6 // distance in two dimensions between two points. Subtracting two points should | 6 // distance in two dimensions between two points. Subtracting two points should |
7 // produce a vector, and adding a vector to a point produces the point at the | 7 // produce a vector, and adding a vector to a point produces the point at the |
8 // vector's distance from the original point. | 8 // vector's distance from the original point. |
9 | 9 |
10 #ifndef UI_GFX_VECTOR2D_F_H_ | 10 #ifndef UI_GFX_VECTOR2D_F_H_ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 result.Add(rhs); | 69 result.Add(rhs); |
70 return result; | 70 return result; |
71 } | 71 } |
72 | 72 |
73 inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) { | 73 inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) { |
74 Vector2dF result = lhs; | 74 Vector2dF result = lhs; |
75 result.Add(-rhs); | 75 result.Add(-rhs); |
76 return result; | 76 return result; |
77 } | 77 } |
78 | 78 |
| 79 // Return the cross product of two vectors. |
| 80 UI_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs); |
| 81 |
| 82 // Return the dot product of two vectors. |
| 83 UI_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs); |
| 84 |
79 } // namespace gfx | 85 } // namespace gfx |
80 | 86 |
81 #endif // UI_GFX_VECTOR2D_F_H_ | 87 #endif // UI_GFX_VECTOR2D_F_H_ |
OLD | NEW |