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

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

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 #include "ui/gfx/vector3d_f.h" 5 #include "ui/gfx/vector3d_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 float z = x_ * other.y() - y_ * other.x(); 69 float z = x_ * other.y() - y_ * other.x();
70 x_ = x; 70 x_ = x;
71 y_ = y; 71 y_ = y;
72 z_ = z; 72 z_ = z;
73 } 73 }
74 74
75 float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs) { 75 float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs) {
76 return lhs.x() * rhs.x() + lhs.y() * rhs.y() + lhs.z() * rhs.z(); 76 return lhs.x() * rhs.x() + lhs.y() * rhs.y() + lhs.z() * rhs.z();
77 } 77 }
78 78
79 Vector3dF ScaleVector3d(
80 const Vector3dF& v, float x_scale, float y_scale, float z_scale) {
sky 2012/11/09 17:06:21 nit on wrapping here too.
danakj 2012/11/09 18:21:47 Done.
81 Vector3dF scaled_v(v);
82 scaled_v.Scale(x_scale, y_scale, z_scale);
83 return scaled_v;
84 }
85
79 } // namespace gfx 86 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698