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

Side by Side Diff: ui/gfx/vector3d_f.h

Issue 11293193: ui: Add non-member Vector2dScale() and Vector3dScale() methods to create scaled vectors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use it in cc/ Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_VECTOR3D_F_H_ 10 #ifndef UI_GFX_VECTOR3D_F_H_
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Return the cross product of two vectors. 88 // Return the cross product of two vectors.
89 inline Vector3dF CrossProduct(const Vector3dF& lhs, const Vector3dF& rhs) { 89 inline Vector3dF CrossProduct(const Vector3dF& lhs, const Vector3dF& rhs) {
90 Vector3dF result = lhs; 90 Vector3dF result = lhs;
91 result.Cross(rhs); 91 result.Cross(rhs);
92 return result; 92 return result;
93 } 93 }
94 94
95 // Return the dot product of two vectors. 95 // Return the dot product of two vectors.
96 UI_EXPORT float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs); 96 UI_EXPORT float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs);
97 97
98 // Return a vector that is |v| scaled by the given scale factors along each
99 // axis.
100 UI_EXPORT Vector3dF ScaleVector3d(
101 const Vector3dF& v, float x_scale, float y_scale, float z_scale);
sky 2012/11/09 17:06:21 nit on the wrapper here too.
danakj 2012/11/09 18:21:47 Done.
102
103 // Return a vector that is |v| scaled by the given scale factor.
104 inline Vector3dF ScaleVector3d(const Vector3dF& v, float scale) {
105 return ScaleVector3d(v, scale, scale, scale);
106 }
98 107
99 } // namespace gfx 108 } // namespace gfx
100 109
101 #endif // UI_GFX_VECTOR3D_F_H_ 110 #endif // UI_GFX_VECTOR3D_F_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698