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/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 | 65 |
66 void Vector3dF::Cross(const Vector3dF& other) { | 66 void Vector3dF::Cross(const Vector3dF& other) { |
67 float x = y_ * other.z() - z_ * other.y(); | 67 float x = y_ * other.z() - z_ * other.y(); |
68 float y = z_ * other.x() - x_ * other.z(); | 68 float y = z_ * other.x() - x_ * other.z(); |
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, float x, float y, float z) { |
Alexei Svitkine (slow)
2013/02/21 16:49:59
Instead of this, can you make a Vector3dF construc
motek.
2013/02/21 18:38:43
Well, I would need to call this, in a typical imag
reed1
2013/02/21 19:36:37
+1 -- the inner loop is no place to unnecessarily
Alexei Svitkine (slow)
2013/02/21 19:54:31
I'd be surprised if the compilers we use don't pro
reed1
2013/02/21 19:57:09
Possibly, or the reverse, where we would need a co
| |
76 return lhs.x() * rhs.x() + lhs.y() * rhs.y() + lhs.z() * rhs.z(); | 76 return lhs.x() * x + lhs.y() * y + lhs.z() * z; |
77 } | 77 } |
78 | 78 |
79 Vector3dF ScaleVector3d(const Vector3dF& v, | 79 Vector3dF ScaleVector3d(const Vector3dF& v, |
80 float x_scale, | 80 float x_scale, |
81 float y_scale, | 81 float y_scale, |
82 float z_scale) { | 82 float z_scale) { |
83 Vector3dF scaled_v(v); | 83 Vector3dF scaled_v(v); |
84 scaled_v.Scale(x_scale, y_scale, z_scale); | 84 scaled_v.Scale(x_scale, y_scale, z_scale); |
85 return scaled_v; | 85 return scaled_v; |
86 } | 86 } |
87 | 87 |
88 } // namespace gfx | 88 } // namespace gfx |
OLD | NEW |